Browse Source

Revert "[智价云] 商品配置校验规则更新"

This reverts commit 5d1cc2ecd2905b59f38b201997488bc051faa5d1.
tangyuanwang 5 days ago
parent
commit
5e48e6ef5a

+ 3 - 21
app/Http/Controllers/Manager/WashConfig/ControlGoods.php

@@ -109,16 +109,7 @@ class ControlGoods extends Controller
         $store_scope = request('store_scope', '');
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs']];
-        $ControlGoodsModel = $ControlGoodsModel->query();
-        if($all_data['platform'] != ''){
-            $platforms = explode(',', $all_data['platform']);
-            $ControlGoodsModel->where(function ($query) use ($platforms) {
-                foreach ($platforms as $platform) {
-                    $query->orWhere('platform', 'like', "%{$platform}%");
-                }
-            });
-        }
+        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'],'platform'=> $all_data['platform']];
         $data = $ControlGoodsModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
@@ -145,17 +136,8 @@ class ControlGoods extends Controller
         $all_data = request()->all();
         $store_scope = request('store_scope','');
         $all_data['store_scope'] = $store_scope;
-        //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs']];
-        $ControlGoodsModel = $ControlGoodsModel->query();
-        if($all_data['platform'] != ''){
-            $platforms = explode(',', $all_data['platform']);
-            $ControlGoodsModel->where(function ($query) use ($platforms) {
-                foreach ($platforms as $platform) {
-                    $query->orWhere('platform', 'like', "%{$platform}%");
-                }
-            });
-        }
+                //查询是否存在
+        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'],'platform'=> $all_data['platform']];
         $data = $ControlGoodsModel->where($map)->where('id', '!=', $id)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表

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

@@ -110,16 +110,7 @@ class LowPriceGoods extends Controller
         $store_scope = request('store_scope', '');
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs']];
-        $LowPriceGoodsModel = $LowPriceGoodsModel->query();
-        if($all_data['platform'] != ''){
-            $platforms = explode(',', $all_data['platform']);
-            $LowPriceGoodsModel->where(function ($query) use ($platforms) {
-                foreach ($platforms as $platform) {
-                    $query->orWhere('platform', 'like', "%{$platform}%");
-                }
-            });
-        }
+        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'],'platform'=> $all_data['platform']];
         $data = $LowPriceGoodsModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
@@ -147,16 +138,7 @@ class LowPriceGoods extends Controller
         $store_scope = request('store_scope','');
         $all_data['store_scope'] = $store_scope;
                 //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs']];
-        $LowPriceGoodsModel = $LowPriceGoodsModel->query();
-        if($all_data['platform'] != ''){
-            $platforms = explode(',', $all_data['platform']);
-            $LowPriceGoodsModel->where(function ($query) use ($platforms) {
-                foreach ($platforms as $platform) {
-                    $query->orWhere('platform', 'like', "%{$platform}%");
-                }
-            });
-        }
+        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'],'platform'=> $all_data['platform']];
         $data = $LowPriceGoodsModel->where($map)->where('id', '!=', $id)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表

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

@@ -110,16 +110,7 @@ class ViolationProduct extends Controller
         $store_scope = request('store_scope', '');
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs']];
-        $ViolationProductModel = $ViolationProductModel->query();
-        if($all_data['platform'] != ''){
-            $platforms = explode(',', $all_data['platform']);
-            $ViolationProductModel->where(function ($query) use ($platforms) {
-                foreach ($platforms as $platform) {
-                    $query->orWhere('platform', 'like', "%{$platform}%");
-                }
-            });
-        }
+        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'],'platform'=> $all_data['platform']];
         $data = $ViolationProductModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
@@ -147,16 +138,7 @@ class ViolationProduct extends Controller
         $store_scope = request('store_scope','');
         $all_data['store_scope'] = $store_scope;
                 //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs']];
-        $ViolationProductModel = $ViolationProductModel->query();
-        if($all_data['platform'] != ''){
-            $platforms = explode(',', $all_data['platform']);
-            $ViolationProductModel->where(function ($query) use ($platforms) {
-                foreach ($platforms as $platform) {
-                    $query->orWhere('platform', 'like', "%{$platform}%");
-                }
-            });
-        }
+        $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'],'platform'=> $all_data['platform']];
         $data = $ViolationProductModel->where($map)->where('id', '!=', $id)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表