林海涛 1 год назад
Родитель
Сommit
7af70b46ad

+ 1 - 1
app/api/controller/FirmController.php

@@ -57,7 +57,7 @@ class FirmController extends BaseApiController
     }
     public function submitGood()
     {
-        $params = (new GoodsValidate())->post()->goCheck('add');
+        $params = (new GoodsValidate())->post()->goCheck('submitGood');
         $result = GoodsLogic::sync($params,$this->userId);
         if (true === $result) {
             return $this->success('已提交', [], 1, 1);

+ 3 - 2
app/api/logic/GoodsLogic.php

@@ -88,8 +88,9 @@ class GoodsLogic extends BaseLogic
             } else{
                 $model = new Goods();
             }
-            $model->goods_category_id =  end($params['goods_category_ids']);
-            $model->category_type = GoodsCategory::where('id', end($params['goods_category_ids']))->value('category_type');
+            $params['goods_category_id'] = end($params['goods_category_ids']);
+            $model->goods_category_id = $params['goods_category_id'];
+            $model->category_type = GoodsCategory::where('id',$params['goods_category_id'])->value('category_type');
             $model->goods_category_ids =  $params['goods_category_ids'];
             $model->goods_category_id = $params['goods_category_id'];
             $model->goods_name = $params['goods_name'];

+ 4 - 0
app/api/validate/GoodsValidate.php

@@ -57,6 +57,10 @@ class GoodsValidate extends BaseValidate
         return $this->only(['goods_category_id']);
     }
 
+    public function sceneSubmitGood()
+    {
+        return $this->only(['goods_category_ids','goods_name','goods_number','base_service_fee','service_total','service_fee']);
+    }
     /**
      * @notes 详情场景
      * @return GoodsValidate