diff --git a/app/Http/Controllers/Guest/OrderController.php b/app/Http/Controllers/Guest/OrderController.php index 9ab51267..95e1e0f5 100644 --- a/app/Http/Controllers/Guest/OrderController.php +++ b/app/Http/Controllers/Guest/OrderController.php @@ -83,6 +83,7 @@ class OrderController extends Controller die('order is paid'); } $order->status = 1; + $order->callback_no = $obj['id']; if (!$order->save()) { abort(500, 'fail'); } diff --git a/app/Http/Controllers/OrderController.php b/app/Http/Controllers/OrderController.php index 7c72dbc4..c2818de6 100755 --- a/app/Http/Controllers/OrderController.php +++ b/app/Http/Controllers/OrderController.php @@ -231,13 +231,11 @@ class OrderController extends Controller if (!$source['redirect']['url']) { abort(500, '支付网关请求失败'); } - - Redis::set($source['id'], $order->trade_no); - Redis::expire($source['id'], 3600); - $order->callback_no = $source['id']; - if (!$order->save()) { - abort(500, '订单更新失败'); + + if (!Redis::set($source['id'], $order->trade_no)) { + abort(500, '订单创建失败'); } + Redis::expire($source['id'], 3600); return $source['redirect']['url']; } @@ -258,13 +256,10 @@ class OrderController extends Controller if (!$source['wechat']['qr_code_url']) { abort(500, '支付网关请求失败'); } - - Redis::set($source['id'], $order->trade_no); - Redis::expire($source['id'], 3600); - $order->callback_no = $source['id']; - if (!$order->save()) { - abort(500, '订单更新失败'); + if (!Redis::set($source['id'], $order->trade_no)) { + abort(500, '订单创建失败'); } + Redis::expire($source['id'], 3600); return $source['wechat']['qr_code_url']; } }