Browse Source

fix(store): 修复商品下架状态检查逻辑

- 修正了商品下架状态判断条件,移除注释并启用验证
- 当商品 is_show 字段为 0 时抛出商品已下架异常
- 确保购物车操作时正确验证商品上下架状态
shichen 2 months ago
parent
commit
73e68b676c
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/controller/api/store/order/StoreCart.php

+ 1 - 1
app/controller/api/store/order/StoreCart.php

@@ -99,7 +99,7 @@ class StoreCart extends BaseController
99 99
         if( $data['cart_num'] < 0 ) throw new ValidateException('数量必须大于0');
100 100
         $product = $product_make->getWhere(['product_id' => $data['product_id']],'*');
101 101
         if(!$product) throw new ValidateException('商品不存在');
102
-        // if (!$product['is_show'] == 0) throw new ValidateException('商品已下架');
102
+        if ($product['is_show'] == 0) throw new ValidateException('商品已下架');
103 103
         $res = $value_make->getOptionByUnique($data['product_attr_unique']);
104 104
         if(!$res) throw new ValidateException('SKU不存在');
105 105
         if($res['product_id'] != $data['product_id']) throw new ValidateException('数据不一致');