作者 lihan
1 个管道 的构建 通过 耗费 0 秒

支付宝

@@ -224,9 +224,9 @@ class OrderController extends HomeBaseController @@ -224,9 +224,9 @@ class OrderController extends HomeBaseController
224 echo json_encode(['msg' => '未知错误', 'code' => 40000]); 224 echo json_encode(['msg' => '未知错误', 'code' => 40000]);
225 exit(); 225 exit();
226 } 226 }
227 - //再次支付的支付方式,先更新支付方式 227 + //再次支付的支付方式,先更新支付方式,和即将支付的金额
228 $payment = $request->param('payment'); 228 $payment = $request->param('payment');
229 - Db::name('order_info')->update(['id' => $oid, 'payment' => $payment]); 229 + Db::name('order_info')->update(['id' => $oid, 'payment' => $payment,'order_amount'=>$order_amount]);
230 if ($payment == 0) { 230 if ($payment == 0) {
231 $model = new OrderModel; 231 $model = new OrderModel;
232 $balance = Db::name('user')->where(['id' => session('user.id')])->value('balance'); 232 $balance = Db::name('user')->where(['id' => session('user.id')])->value('balance');
@@ -436,9 +436,17 @@ class OrderController extends HomeBaseController @@ -436,9 +436,17 @@ class OrderController extends HomeBaseController
436 $alipaySevice = new \AlipayTradeService($config); 436 $alipaySevice = new \AlipayTradeService($config);
437 $alipaySevice->writeLog(var_export($_POST, true)); 437 $alipaySevice->writeLog(var_export($_POST, true));
438 $result = $alipaySevice->check($arr); 438 $result = $alipaySevice->check($arr);
439 - cache('notify', $result);  
440 if ($result) { 439 if ($result) {
441 - Db::name('user')->where(['id' => 10])->setInc('balance', 1); 440 + if ($arr['trade_status'] == 'TRADE_SUCCESS') {
  441 + $out_trade_no = $arr['out_trade_no'];
  442 + $temp = explode('_', $out_trade_no);
  443 + $order_sn = $temp[0];
  444 + $oid = Db::name('order_info')->where(['order_sn' => $order_sn])->value('id');
  445 + $order = new OrderModel;
  446 + $order->orderCallBack($oid, $arr['']);
  447 + } else {
  448 + //严谨需要退款
  449 + }
442 } 450 }
443 } 451 }
444 452