This commit is contained in:
root 2019-11-29 19:52:55 +08:00
parent be37bcb3bf
commit 78673af6e8
2 changed files with 8 additions and 12 deletions

View File

@ -83,6 +83,7 @@ class OrderController extends Controller
die('order is paid'); die('order is paid');
} }
$order->status = 1; $order->status = 1;
$order->callback_no = $obj['id'];
if (!$order->save()) { if (!$order->save()) {
abort(500, 'fail'); abort(500, 'fail');
} }

View File

@ -231,13 +231,11 @@ class OrderController extends Controller
if (!$source['redirect']['url']) { if (!$source['redirect']['url']) {
abort(500, '支付网关请求失败'); abort(500, '支付网关请求失败');
} }
Redis::set($source['id'], $order->trade_no); if (!Redis::set($source['id'], $order->trade_no)) {
Redis::expire($source['id'], 3600); abort(500, '订单创建失败');
$order->callback_no = $source['id'];
if (!$order->save()) {
abort(500, '订单更新失败');
} }
Redis::expire($source['id'], 3600);
return $source['redirect']['url']; return $source['redirect']['url'];
} }
@ -258,13 +256,10 @@ class OrderController extends Controller
if (!$source['wechat']['qr_code_url']) { if (!$source['wechat']['qr_code_url']) {
abort(500, '支付网关请求失败'); abort(500, '支付网关请求失败');
} }
if (!Redis::set($source['id'], $order->trade_no)) {
Redis::set($source['id'], $order->trade_no); abort(500, '订单创建失败');
Redis::expire($source['id'], 3600);
$order->callback_no = $source['id'];
if (!$order->save()) {
abort(500, '订单更新失败');
} }
Redis::expire($source['id'], 3600);
return $source['wechat']['qr_code_url']; return $source['wechat']['qr_code_url'];
} }
} }