diff --git a/app/api/logic/OrderLogic.php b/app/api/logic/OrderLogic.php index e6c56970..507220d8 100755 --- a/app/api/logic/OrderLogic.php +++ b/app/api/logic/OrderLogic.php @@ -112,8 +112,6 @@ class OrderLogic extends Logic } } - - foreach ($goods as &$good) { $good['delivery_type'] = !isset($good['delivery_type']) ? OrderEnum::DELIVERY_TYPE_EXPRESS : $good['delivery_type']; } @@ -121,15 +119,19 @@ class OrderLogic extends Logic Db::startTrans(); try { - if ($post['order_type'] == 4) { + $in_activity = Order::where('user_id', $post['user_id'])->where('order_status', '<', 4)->find(); + if ($in_activity) { + throw new Exception('每位用户只能限抢一件商品'); + } + foreach ($goods as $activ) { $isOrder = Db::name('order')->where([ 'activity_sn' => $activ['activity_sn'], 'user_id' => $post['user_id'] ]) - ->where('order_status', '<>', 4) - ->find(); + ->where('order_status', '<>', 4) + ->find(); if($isOrder){ throw new Exception('您已抢购过此商品'); }