wesmiler 2 주 전
부모
커밋
977aba194c
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      app/Services/Common/GoodsService.php

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

@@ -196,7 +196,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);
         }
 
@@ -208,6 +209,14 @@ class GoodsService extends BaseService
             return message('商品单价格式不正确', false);
         }
 
+        $bdScore = isset($data['bs_score'])?$data['bs_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'];
 
         // 确保content字段存在(即使为空字符串或null)