Bläddra i källkod

[智价云] 全量清洗字段补充

tangyuanwang 1 dag sedan
förälder
incheckning
488040b40e

+ 18 - 2
app/Http/Controllers/Manager/WashConfig/LowPriceGoods.php

@@ -187,6 +187,11 @@ class LowPriceGoods extends Controller
         $product_keyword = request('product_keyword', '');
         $all_data['product_brand'] = $product_brand;
         $all_data['product_keyword'] = $product_keyword;
+        $enable_full_quantity = request('enable_full_quantity', 1); //全量,0启用,1禁用
+        $all_data['enable_full_quantity'] = $enable_full_quantity;
+        if ($enable_full_quantity == 1 && !isset($all_data['product_specs'])) {
+            return json_send(['code' => 'error', 'msg' => '非全量清洗时,商品规格不能为空']);
+        }
         if(trim($product_keyword) !=''){
             $product_keyword_count = count(explode(',', $product_keyword));
             if ($product_keyword_count > 5) {
@@ -202,7 +207,10 @@ class LowPriceGoods extends Controller
         $specify_responsible_person = request('specify_responsible_person', '0');
         $all_data['specify_responsible_person'] = $specify_responsible_person;
         //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        $map = ['product_name' => $all_data['product_name'], 'platform' => $all_data['platform']];
+        if(isset($all_data['product_specs']) && $all_data['product_specs'] !=''){
+            $map['product_specs'] = $all_data['product_specs'];
+        }
         if ($is_admin != 1 && $company_id != 0) {
             $map['company_id'] = $company_id;
             $all_data['company_id'] = $company_id;
@@ -247,6 +255,11 @@ class LowPriceGoods extends Controller
         $product_keyword = request('product_keyword', '');
         $all_data['product_brand'] = $product_brand;
         $all_data['product_keyword'] = $product_keyword;
+        $enable_full_quantity = request('enable_full_quantity', 1); //全量,0启用,1禁用
+        $all_data['enable_full_quantity'] = $enable_full_quantity;
+        if ($enable_full_quantity == 1 && !isset($all_data['product_specs'])) {
+            return json_send(['code' => 'error', 'msg' => '非全量清洗时,商品规格不能为空']);
+        }
         if(trim($product_keyword) !=''){
             $product_keyword_count = count(explode(',', $product_keyword));
             if ($product_keyword_count > 5) {
@@ -262,7 +275,10 @@ class LowPriceGoods extends Controller
         $specify_responsible_person = request('specify_responsible_person', '0');
         $all_data['specify_responsible_person'] = $specify_responsible_person;
         //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        $map = ['product_name' => $all_data['product_name'], 'platform' => $all_data['platform']];
+        if(isset($all_data['product_specs']) && $all_data['product_specs'] !=''){
+            $map['product_specs'] = $all_data['product_specs'];
+        }
         if ($is_admin != 1 && $company_id != 0) {
             $map['company_id'] = $company_id;
         } else {

+ 18 - 2
app/Http/Controllers/Manager/WashConfig/ViolationProduct.php

@@ -193,6 +193,11 @@ class ViolationProduct extends Controller
         $product_keyword = request('product_keyword', '');
         $all_data['product_brand'] = $product_brand;
         $all_data['product_keyword'] = $product_keyword;
+        $enable_full_quantity = request('enable_full_quantity', 1); //全量,0启用,1禁用
+        $all_data['enable_full_quantity'] = $enable_full_quantity;
+        if ($enable_full_quantity == 1 && !isset($all_data['product_specs'])) {
+            return json_send(['code' => 'error', 'msg' => '非全量清洗时,商品规格不能为空']);
+        }
         if(trim($product_keyword) !=''){
             $product_keyword_count = count(explode(',', $product_keyword));
             if ($product_keyword_count > 5) {
@@ -208,7 +213,10 @@ class ViolationProduct extends Controller
         $specify_responsible_person = request('specify_responsible_person', '0');
         $all_data['specify_responsible_person'] = $specify_responsible_person;
         //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        $map = ['product_name' => $all_data['product_name'],'platform' => $all_data['platform']];
+        if(isset($all_data['product_specs']) && $all_data['product_specs'] !=''){
+            $map['product_specs'] = $all_data['product_specs'];
+        }
         if ($is_admin != 1 && $company_id != 0) {
             $map['company_id'] = $company_id;
             $all_data['company_id'] = $company_id;
@@ -253,6 +261,11 @@ class ViolationProduct extends Controller
         $product_keyword = request('product_keyword', '');
         $all_data['product_brand'] = $product_brand;
         $all_data['product_keyword'] = $product_keyword;
+        $enable_full_quantity = request('enable_full_quantity', 1); //全量,0启用,1禁用
+        $all_data['enable_full_quantity'] = $enable_full_quantity;
+        if ($enable_full_quantity == 1 && !isset($all_data['product_specs'])) {
+            return json_send(['code' => 'error', 'msg' => '非全量清洗时,商品规格不能为空']);
+        }
         if(trim($product_keyword) !=''){
             $product_keyword_count = count(explode(',', $product_keyword));
             if ($product_keyword_count > 5) {
@@ -268,7 +281,10 @@ class ViolationProduct extends Controller
         $specify_responsible_person = request('specify_responsible_person', '0');
         $all_data['specify_responsible_person'] = $specify_responsible_person;
         //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        $map = ['product_name' => $all_data['product_name'], 'platform' => $all_data['platform']];
+        if(isset($all_data['product_specs']) && $all_data['product_specs'] !=''){
+            $map['product_specs'] = $all_data['product_specs'];
+        }
         if ($is_admin != 1 && $company_id != 0) {
             $map['company_id'] = $company_id;
             $all_data['company_id'] = $company_id;

+ 6 - 3
app/Http/Requests/Manager/WashConfig/LowPriceGoods.php

@@ -35,7 +35,7 @@ class LowPriceGoods extends BaseRequest
             'suggested_price'   => 'required',
             'store_scope'       => 'required',
             'platform'          => 'required',
-            'file' => 'required|mimes:xlsx,xls,csv|max:10240'
+            'enable_full_quantity' => 'required|integer|in:0,1',
         ];
     }
 
@@ -44,8 +44,8 @@ class LowPriceGoods extends BaseRequest
     protected   $scenes         = [
         'detail'             => ['id'],
         'list'               => ['page', 'limit'],
-        'add'                      => ['platform','product_name', 'product_specs', 'suggested_price'],
-        'edit'                  => ['id','platform', 'product_name', 'product_specs', 'suggested_price'],
+        'add'                      => ['platform','product_name', 'suggested_price','enable_full_quantity'],
+        'edit'                  => ['id','platform', 'product_name','suggested_price','enable_full_quantity'],
         'set_status'              => ['id', 'status'],
         'delete'                  => ['id'],
         'spec_list'             => ['page', 'limit'],
@@ -81,6 +81,9 @@ class LowPriceGoods extends BaseRequest
             'suggested_price.required' => '建议价格未知',
             'store_scope.required'    => '适用门店未知',
             'platform.required'     => '平台未知',
+            'enable_full_quantity.required' => '是否全量未知',
+            'enable_full_quantity.integer' => '是否全量格式错误',
+            'enable_full_quantity.in' => '是否全量格式错误',
         ];
     }
 }

+ 7 - 4
app/Http/Requests/Manager/WashConfig/ViolationProduct.php

@@ -35,7 +35,7 @@ class ViolationProduct extends BaseRequest
             'suggested_price'   => 'required',
             'store_scope'       => 'required',
             'platform'          => 'required',
-            'file' => 'required|mimes:xlsx,xls,csv|max:10240'
+            'enable_full_quantity' => 'required|integer|in:0,1',
         ];
     }
 
@@ -44,11 +44,11 @@ class ViolationProduct extends BaseRequest
     protected   $scenes         = [
         'detail'             => ['id'],
         'list'               => ['page', 'limit'],
-        'add'                      => ['platform','product_name', 'product_specs'],
-        'edit'                  => ['id','platform','product_name', 'product_specs'],
+        'add'                      => ['platform', 'product_name', 'enable_full_quantity'],
+        'edit'                  => ['id', 'platform', 'product_name', 'enable_full_quantity'],
         'set_status'              => ['id', 'status'],
         'delete'                  => ['id'],
-        'import_data'            =>['file'],
+        'import_data'            => ['file'],
     ];
 
     /**
@@ -80,6 +80,9 @@ class ViolationProduct extends BaseRequest
             'suggested_price.required' => '建议价格未知',
             'store_scope.required'    => '适用门店未知',
             'platform.required'      => '平台未知',
+            'enable_full_quantity.required' => '是否全量未知',
+            'enable_full_quantity.integer' => '是否全量格式错误',
+            'enable_full_quantity.in' => '是否全量格式错误',
         ];
     }
 }

+ 12 - 7
app/Models/Manager/WashConfig/LowPriceGoods.php

@@ -37,7 +37,10 @@ class LowPriceGoods extends Model
     public function addLowProduct_content($data)
     {
         $insert_data = [
+            'company_id' => $data['company_id'],
+            'product_brand' => $data['product_brand'],
             'platform' => $data['platform'],
+            'enable_full_quantity' => $data['enable_full_quantity'],
             'product_name' => $data['product_name'],
             'product_specs' => $data['product_specs'],
             'suggested_price' => $data['suggested_price'],
@@ -45,7 +48,6 @@ class LowPriceGoods extends Model
             'company_scope'    => $data['company_scope'] != '' ? 2 : 1, //公司范围1=全部公司 2=指定公司
             'category_id' => $data['category_id'],
             'specify_responsible_person' => $data['specify_responsible_person'],
-            'product_brand' => $data['product_brand'],
             'insert_time' => time(),
         ];
         $LowProduct_id = $this->insertGetId($insert_data);
@@ -59,8 +61,9 @@ class LowPriceGoods extends Model
      * @version 1.0
      * @date 2026-03-31
      */
-    public function product_keyword(){
-        return $this->hasMany(LowPriceGoodsKeywordModel::class,'lowprice_product_id','id')->orderBy('id','asc');
+    public function product_keyword()
+    {
+        return $this->hasMany(LowPriceGoodsKeywordModel::class, 'lowprice_product_id', 'id')->orderBy('id', 'asc');
     }
 
 
@@ -81,6 +84,7 @@ class LowPriceGoods extends Model
                 'company_id' => $data['company_id'],
                 'product_brand' => $data['product_brand'],
                 'platform' => $data['platform'],
+                'enable_full_quantity' => $data['enable_full_quantity'],
                 'product_name' => $data['product_name'],
                 'product_specs' => $data['product_specs'],
                 'suggested_price' => $data['suggested_price'],
@@ -118,12 +122,12 @@ class LowPriceGoods extends Model
             }
             // 如果存在采集配置的关键字
             $product_keyword = $data['product_keyword'];
-            if (trim($product_keyword) !='') {
+            if (trim($product_keyword) != '') {
                 $ProductKeywordModel = new LowPriceGoodsKeywordModel();
                 $product_keyword_data = explode(',', $product_keyword);
-                $keyword_data =[];
+                $keyword_data = [];
                 foreach ($product_keyword_data as $key => $value) {
-                    if(trim($value) == '') continue;
+                    if (trim($value) == '') continue;
                     $keyword_data[] = [
                         'lowprice_product_id' => $LowProduct_id,
                         'keyword' => $value,
@@ -160,6 +164,7 @@ class LowPriceGoods extends Model
             $store_scope = $data['store_scope'] != '' ? 2 : 1; //店铺范围1=全部店铺 2=指定店铺
             $company_scope = $data['company_scope'] != '' ? 2 : 1; //公司范围1=全部公司 2=指定公司
             $LowProduct->company_id = $data['company_id'];
+            $LowProduct->enable_full_quantity = $data['enable_full_quantity'];
             $LowProduct->platform = $data['platform'];
             $LowProduct->product_brand = $data['product_brand'];
             $LowProduct->product_name = $data['product_name'];
@@ -212,7 +217,7 @@ class LowPriceGoods extends Model
             }
             // 如果存在采集配置的关键字
             $product_keyword = $data['product_keyword'];
-            if (trim($product_keyword) !='') {
+            if (trim($product_keyword) != '') {
                 $product_keyword_data = explode(',', $product_keyword);
                 $keyword_data = [];
                 foreach ($product_keyword_data as $key => $value) {

+ 6 - 3
app/Models/Manager/WashConfig/ViolationProduct.php

@@ -39,6 +39,7 @@ class ViolationProduct extends Model
         $insert_data = [
             'company_id' => $data['company_id'],
             'platform' => $data['platform'],
+            'enable_full_quantity' => $data['enable_full_quantity'],
             'product_brand' => $data['product_brand'],
             'product_name' => $data['product_name'],
             'product_specs' => $data['product_specs'],
@@ -46,7 +47,6 @@ class ViolationProduct extends Model
             'company_scope'    => $data['company_scope'] != '' ? 2 : 1, //公司范围1=全部公司 2=指定公司
             'category_id' => $data['category_id'],
             'specify_responsible_person' => $data['specify_responsible_person'],
-            'product_brand' => $data['product_brand'],
             'insert_time' => time(),
         ];
         $ViolationProduct_id = $this->insertGetId($insert_data);
@@ -60,8 +60,9 @@ class ViolationProduct extends Model
      * @version 1.0
      * @date 2026-03-31
      */
-    public function product_keyword(){
-        return $this->hasMany(ViolationProductKeywordModel::class,'violation_product_id','id')->orderBy('id','asc');;
+    public function product_keyword()
+    {
+        return $this->hasMany(ViolationProductKeywordModel::class, 'violation_product_id', 'id')->orderBy('id', 'asc');;
     }
 
 
@@ -82,6 +83,7 @@ class ViolationProduct extends Model
             $insert_data = [
                 'company_id' => $data['company_id'],
                 'platform' => $data['platform'],
+                'enable_full_quantity' => $data['enable_full_quantity'],
                 'product_brand' => $data['product_brand'],
                 'product_name' => $data['product_name'],
                 'product_specs' => $data['product_specs'],
@@ -161,6 +163,7 @@ class ViolationProduct extends Model
             $company_scope = $data['company_scope'] != '' ? 2 : 1; //公司范围1=全部公司 2=指定公司
             $ViolationProduct->company_id = $data['company_id'];
             $ViolationProduct->platform = $data['platform'];
+            $ViolationProduct->enable_full_quantity = $data['enable_full_quantity'];
             $ViolationProduct->product_brand = $data['product_brand'];
             $ViolationProduct->product_name = $data['product_name'];
             $ViolationProduct->product_specs = $data['product_specs'];