diff --git a/plugin/webman/gateway/Events.php b/plugin/webman/gateway/Events.php index afc8f62..5784b74 100644 --- a/plugin/webman/gateway/Events.php +++ b/plugin/webman/gateway/Events.php @@ -237,8 +237,15 @@ class Events base::gateway_query('sendToUid', [$s_id, json_encode($snd_data)]); return; } + $product = Db::query(" + SELECT * FROM `tb_product` WHERE + `id`={$message['product_id']}"); // 如果是新增或者编辑,查询库存够不够 - if ((!empty($message['operate_type']) && ($message['operate_type'] == 'add' || $message['operate_type'] == 'edit')) && (!empty($message['product_id']) && !empty($message['shop_id']) && !empty($message['number']))) { + if ( + (!empty($message['operate_type']) && ($message['operate_type'] == 'add' || $message['operate_type'] == 'edit')) && + (!empty($message['product_id']) && !empty($message['shop_id']) && !empty($message['number'])) && + (!empty($product) && $product[0]['is_stock'] == 1) + ) { $gate_way = GateWay::class; $number = $message['number']; try { @@ -287,9 +294,6 @@ class Events } } $d_data = false; - $product = Db::query(" - SELECT * FROM `tb_product` WHERE - `id`={$message['product_id']}"); // 如果是套餐商品, 拿到商品总数量 if(!empty($message['goods_type']) && $message['goods_type'] == 'package') { if($product) {