This commit is contained in:
2026-03-27 14:02:32 +08:00
parent a7874901d8
commit b0c1a36a8e

View File

@@ -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) {