正在显示
1 个修改的文件
包含
14 行增加
和
2 行删除
@@ -28,20 +28,30 @@ class SomepayController extends HomeBaseController | @@ -28,20 +28,30 @@ class SomepayController extends HomeBaseController | ||
28 | // 微信支付 | 28 | // 微信支付 |
29 | public function pay($openId , $price , $order_sn , $url,$content) | 29 | public function pay($openId , $price , $order_sn , $url,$content) |
30 | { | 30 | { |
31 | + $a['a'] ='11'; | ||
32 | + Db::name('Test')->insertGetId($a); | ||
31 | $price = intval($price * 100); | 33 | $price = intval($price * 100); |
32 | $tools = new \JsApiPay(); | 34 | $tools = new \JsApiPay(); |
33 | $input = new \WxPayUnifiedOrder(); | 35 | $input = new \WxPayUnifiedOrder(); |
36 | + $a['a'] ='22'; | ||
37 | + Db::name('Test')->insertGetId($a); | ||
34 | $input->SetBody($content); | 38 | $input->SetBody($content); |
35 | $input->SetAttach($content); | 39 | $input->SetAttach($content); |
40 | + $a['a'] ='33'; | ||
41 | + Db::name('Test')->insertGetId($a); | ||
36 | $input->SetOut_trade_no($order_sn); | 42 | $input->SetOut_trade_no($order_sn); |
37 | $input->SetTotal_fee($price); | 43 | $input->SetTotal_fee($price); |
38 | $input->SetTime_start(date("YmdHis")); | 44 | $input->SetTime_start(date("YmdHis")); |
39 | $input->SetTime_expire(date("YmdHis", time() + 600)); | 45 | $input->SetTime_expire(date("YmdHis", time() + 600)); |
40 | $input->SetGoods_tag($content); | 46 | $input->SetGoods_tag($content); |
41 | $input->SetNotify_url($url); | 47 | $input->SetNotify_url($url); |
48 | + $a['a'] ='44'; | ||
49 | + Db::name('Test')->insertGetId($a); | ||
42 | $input->SetTrade_type("JSAPI"); | 50 | $input->SetTrade_type("JSAPI"); |
43 | $input->SetOpenid($openId); | 51 | $input->SetOpenid($openId); |
44 | $config = new \WxPayConfig(); | 52 | $config = new \WxPayConfig(); |
53 | + $a['a'] ='55'; | ||
54 | + Db::name('Test')->insertGetId($a); | ||
45 | $order = \WxPayApi::unifiedOrder($config, $input); | 55 | $order = \WxPayApi::unifiedOrder($config, $input); |
46 | $jsApiParameters = $tools->GetJsApiParameters($order); | 56 | $jsApiParameters = $tools->GetJsApiParameters($order); |
47 | return json_decode($jsApiParameters); | 57 | return json_decode($jsApiParameters); |
@@ -54,10 +64,12 @@ class SomepayController extends HomeBaseController | @@ -54,10 +64,12 @@ class SomepayController extends HomeBaseController | ||
54 | //微信回调 | 64 | //微信回调 |
55 | public function pay_notify() | 65 | public function pay_notify() |
56 | { | 66 | { |
57 | - $a['a'] ='7'; | 67 | + $a['a'] ='333'; |
58 | Db::name('Test')->insertGetId($a); | 68 | Db::name('Test')->insertGetId($a); |
59 | $config = new \WxPayConfig(); | 69 | $config = new \WxPayConfig(); |
60 | $notify = new \WxPayNotify(); | 70 | $notify = new \WxPayNotify(); |
71 | + $a['a'] ='888'; | ||
72 | + Db::name('Test')->insertGetId($a); | ||
61 | $notify->Handle($config, false); | 73 | $notify->Handle($config, false); |
62 | $xml = file_get_contents("php://input"); | 74 | $xml = file_get_contents("php://input"); |
63 | $base = new \WxPayResults(); | 75 | $base = new \WxPayResults(); |
@@ -65,7 +77,7 @@ class SomepayController extends HomeBaseController | @@ -65,7 +77,7 @@ class SomepayController extends HomeBaseController | ||
65 | //验签 | 77 | //验签 |
66 | if ($base->CheckSign($config)) { | 78 | if ($base->CheckSign($config)) { |
67 | if ($data["return_code"] == "SUCCESS") { | 79 | if ($data["return_code"] == "SUCCESS") { |
68 | - $a['a'] ='9'; | 80 | + $a['a'] ='99'; |
69 | $a['c'] = json_decode($data); | 81 | $a['c'] = json_decode($data); |
70 | Db::name('Test')->insertGetId($a); | 82 | Db::name('Test')->insertGetId($a); |
71 | // 支付成功 | 83 | // 支付成功 |
-
请 注册 或 登录 后发表评论