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

支付宝

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