Sfoglia il codice sorgente

支付成功后推送话费订单

xialei 1 anno fa
parent
commit
5042650fab
2 ha cambiato i file con 38 aggiunte e 32 eliminazioni
  1. 8 0
      app/controller/api/Notify.php
  2. 30 32
      app/controller/api/store/service/Huafei.php

+ 8 - 0
app/controller/api/Notify.php

@@ -4,6 +4,7 @@ namespace app\controller\api;
4 4
 use AdaPaySdk\AdapayTools;
5 5
 use app\common\repositories\store\order\StoreRefundOrderRepository;
6 6
 use app\controller\api\merchant\sxy\Access;
7
+use app\controller\api\store\service\Huafei;
7 8
 use think\facade\Db;
8 9
 use think\facade\Log;
9 10
 use think\facade\Request;
@@ -54,6 +55,13 @@ class Notify
54 55
                             }catch (\Exception $e) {
55 56
                                 Db::name('log')->insert(['data'=>'话费充值支付回调错误:'.$e->getFile().':'.$e->getLine().'【'.$e->getMessage().'】']);
56 57
                             }
58
+                            //话费充值支付成功推送
59
+                            try{
60
+                                $Huafei = new Huafei();
61
+                                $Huafei->pushHf($order_data['uid'], $order_data['order_no'], $order_data['mobile'], $order_data['pay_price']);
62
+                            }catch (\Exception $e) {
63
+                                Db::name('log')->insert(['data'=>'话费充值支付回调推送订单错误:'.$e->getFile().':'.$e->getLine().'【'.$e->getMessage().'】']);
64
+                            }
57 65
                             break;
58 66
                         case 'pay':
59 67
                             //商城集合订单

+ 30 - 32
app/controller/api/store/service/Huafei.php

@@ -20,12 +20,6 @@ class Huafei extends BaseController
20 20
     protected $apiVersion = "1.0";
21 21
 
22 22
 
23
-    public function __construct(App $app)
24
-    {
25
-        parent::__construct($app);
26
-    }
27
-
28
-
29 23
 	//充值话费回调
30 24
 	public function notify(){
31 25
 		$param = $this->request->param();
@@ -106,38 +100,42 @@ class Huafei extends BaseController
106 100
 			}else{
107 101
 				return app('json')->fail('创建话费充值预支付订单失败');
108 102
 			}
109
-
110
-			//推送订单
111
-			// $push = $this->pushOrder($order_sn, $params['phone'], $params['money']);
112
-			// if($push['code'] == '0000'){
113
-			// 	//入库记录
114
-			// 	$insertdata = [
115
-			// 		'uid'=> $uid,
116
-			// 		'mobile' => $params['phone'],
117
-			// 		'commission'=> 0,
118
-			// 		'commission_share'=> 0.04,
119
-			// 		'order_number' => $push['data']['order_number'],
120
-			// 		'order_sn' => $order_sn,
121
-			// 		'amount_price' => $push['data']['amount'],
122
-			// 		'fanli_price' => $push['data']['fanli'],
123
-			// 		'cost_price' => $push['data']['cost_price'],
124
-			// 		'pay_money' => $params['money'],
125
-			// 		'status' => 0,
126
-			// 		'create_time' => time(),
127
-			// 		'finish_time' => time(),
128
-			// 		'modify_time' => time(),
129
-			// 	];
130
-			// 	Db::name('order_huafei')->insert($insertdata);
131
-			// 	return app('json')->success('话费推送成功', $push);
132
-			// }else{
133
-			// 	return app('json')->fail($push['msg']);
134
-			// }
135 103
 		}else{
136 104
 			return app('json')->fail($verify['msg']);
137 105
 		}
138 106
     }
139 107
 
140 108
 
109
+	//话费充值推送
110
+	public function pushHf($uid, $order_sn, $phone, $money){
111
+		//推送订单
112
+		$push = $this->pushOrder($order_sn, $phone, $money);
113
+		if($push['code'] == '0000'){
114
+			//入库记录
115
+			$insertdata = [
116
+				'uid'=> $uid,
117
+				'mobile' => $phone,
118
+				'commission'=> 0,
119
+				'commission_share'=> 0.04,
120
+				'order_number' => $push['data']['order_number'],
121
+				'order_sn' => $order_sn,
122
+				'amount_price' => $push['data']['amount'],
123
+				'fanli_price' => $push['data']['fanli'],
124
+				'cost_price' => $push['data']['cost_price'],
125
+				'pay_money' => $money,
126
+				'status' => 0,
127
+				'create_time' => time(),
128
+				'finish_time' => time(),
129
+				'modify_time' => time(),
130
+			];
131
+			Db::name('order_huafei')->insert($insertdata);
132
+			return $push;
133
+		}else{
134
+			return false;
135
+		}
136
+	}
137
+
138
+
141 139
 
142 140
 	//话费充值记录
143 141
 	public function record(){