From b0c1a36a8e1e49500ae26a69a85c80e8724e1ed7 Mon Sep 17 00:00:00 2001 From: ASUS <515617283@qq.com> Date: Fri, 27 Mar 2026 14:02:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/webman/gateway/Events.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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) {