wesmiler пре 2 недеља
родитељ
комит
b2c5b3a815
1 измењених фајлова са 10 додато и 5 уклоњено
  1. 10 5
      app/Services/Common/GoodsService.php

+ 10 - 5
app/Services/Common/GoodsService.php

@@ -307,7 +307,8 @@ class GoodsService extends BaseService
         }
         }
 
 
         // 验证分类
         // 验证分类
-        if (!isset($data['category_id']) || $data['category_id'] <= 0) {
+        $type = isset($data['type'])&&$data['type']?$data['type']:1;
+        if ($type==1 && (!isset($data['category_id']) || $data['category_id'] <= 0)) {
             return message('请选择商品分类', false);
             return message('请选择商品分类', false);
         }
         }
 
 
@@ -315,14 +316,18 @@ class GoodsService extends BaseService
             return message('请填写商品单价', false);
             return message('请填写商品单价', false);
         }
         }
 
 
-        if (!isset($data['status']) || $data['status'] == 3) {
-            $data['status'] = 2; // 默认
-        }
-
         if (!is_numeric($data['price'])) {
         if (!is_numeric($data['price'])) {
             return message('商品单价格式不正确', false);
             return message('商品单价格式不正确', false);
         }
         }
 
 
+        $bdScore = isset($data['bd_score'])?$data['bd_score']:0;
+        if($type==2){
+            $data['stock'] = isset($data['stock'])&&$data['stock']?$data['stock']: 999999;
+            if($bdScore<=0){
+                return message('创业礼包商品需设置报单积分数量', false);
+            }
+        }
+
         $data['price'] = (float)$data['price'];
         $data['price'] = (float)$data['price'];
 
 
         // 确保content字段存在(即使为空字符串或null)- 编辑时允许保存空字符串
         // 确保content字段存在(即使为空字符串或null)- 编辑时允许保存空字符串