فهرست منبع

[智价云] 数据清洗低价禁止去重校验更新

tangyuanwang 20 ساعت پیش
والد
کامیت
b24e946b6d

+ 5 - 5
app/Http/Controllers/Manager/Collect/Product.php

@@ -283,7 +283,7 @@ class Product extends Controller
             $platforms = $platform_string ?  explode(',', $platform_string) : '';
             $platforms = $platforms ? array_unique($platforms) : '';
 
-            $platform_data = $ProductModel->platform_data();
+            $platform_data = $ProductModel->platform_index_data();
             foreach ($platforms as $platform) {
                 $product_specs_log = $ProductModel
                     ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
@@ -307,7 +307,7 @@ class Product extends Controller
             $platforms = $platform_string ?  explode(',', $platform_string) : '';
             $platforms = $platforms ? array_unique($platforms) : '';
 
-            $platform_data = $ProductModel->platform_data();
+            $platform_data = $ProductModel->platform_index_data();
             foreach ($platforms as $platform) {
                 $product_specs_log = $ProductModel
                     ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
@@ -396,7 +396,7 @@ class Product extends Controller
             $platforms = $platform_string ?  explode(',', $platform_string) : '';
             $platforms = $platforms ? array_unique($platforms) : '';
 
-            $platform_data = $ProductModel->platform_data();
+            $platform_data = $ProductModel->platform_index_data();
             foreach ($platforms as $platform) {
                 $product_specs_log = $ProductModel
                     ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
@@ -421,7 +421,7 @@ class Product extends Controller
             $platforms = $platform_string ?  explode(',', $platform_string) : '';
             $platforms = $platforms ? array_unique($platforms) : '';
 
-            $platform_data = $ProductModel->platform_data();
+            $platform_data = $ProductModel->platform_index_data();
             foreach ($platforms as $platform) {
                 $product_specs_log = $ProductModel
                     ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
@@ -527,7 +527,7 @@ class Product extends Controller
             $platforms = $platform_string ?  explode(',', $platform_string) : '';
             $platforms = $platforms ? array_unique($platforms) : '';
 
-            $platform_data = $ProductModel->platform_data();
+            $platform_data = $ProductModel->platform_index_data();
             foreach ($platforms as $platform) {
                 $product_specs_log = $ProductModel
                     ->whereRaw("FIND_IN_SET(?, platform)", [$platform])

+ 151 - 9
app/Http/Controllers/Manager/WashConfig/LowPriceGoods.php

@@ -194,7 +194,7 @@ class LowPriceGoods extends Controller
         if ($enable_full_quantity == 1 && !isset($all_data['product_specs'])) {
             return json_send(['code' => 'error', 'msg' => '非全量清洗时,商品规格不能为空']);
         }
-        if(trim($product_keyword) !=''){
+        if (trim($product_keyword) != '') {
             $product_keyword_count = count(explode(',', $product_keyword));
             if ($product_keyword_count > 5) {
                 return json_send(['code' => 'error', 'msg' => '商品关键词不能超过5个']);
@@ -202,6 +202,7 @@ class LowPriceGoods extends Controller
         }
         $store_scope = request('store_scope', '');
         $all_data['store_scope'] = $store_scope;
+        $platform_string = $all_data['platform'];
         $company_scope = request('company_scope', '');
         $all_data['company_scope'] = $company_scope;
         $category_id = request('category_id', '0');
@@ -209,8 +210,8 @@ 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'], 'platform' => $all_data['platform']];
-        if(isset($all_data['product_specs']) && $all_data['product_specs'] !=''){
+        $map = ['product_brand' => $all_data['product_brand'], 'product_name' => $all_data['product_name'],'suggested_price'=> $all_data['suggested_price']];
+        if (isset($all_data['product_specs']) && $all_data['product_specs'] != '') {
             $map['product_specs'] = $all_data['product_specs'];
         }
         if ($is_admin != 1 && $company_id != 0) {
@@ -221,7 +222,52 @@ class LowPriceGoods extends Controller
             $all_data['company_id'] = $admin_company_id;
         }
         $data = $LowPriceGoodsModel->where($map)->first();
-        if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
+        if (!empty($data) && $enable_full_quantity == 1) {
+            //继续校验规格是否存在
+            $product_specs_tring = $all_data['product_specs'];
+            $product_specs = $product_specs_tring ?  explode(',', $product_specs_tring) : '';
+            $product_specs = $product_specs ? array_unique($product_specs) : '';
+            //继续校平台是否存在
+
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $LowPriceGoodsModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $LowPriceGoodsModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $product_brand, 'product_name' => $all_data['product_name'],'suggested_price'=> $all_data['suggested_price'], 'status' => '0'])
+                    ->where(function ($query) use ($product_specs) {
+                        // 平台条件(固定)
+                        $query->where(function ($query_li) use ($product_specs) {
+
+                            foreach ($product_specs as $product_spec) {
+                                if (empty($product_specs)) continue;
+                                $query_li->orWhereRaw("FIND_IN_SET(?, product_specs)", [$product_spec]);
+                            }
+                        });
+                    })->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品规格记录']);
+                }
+            }
+        } else if (!empty($data) && $enable_full_quantity == 0) {
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $LowPriceGoodsModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $LowPriceGoodsModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $product_brand, 'product_name' => $all_data['product_name'],'suggested_price'=> $all_data['suggested_price'], 'status' => '0'])
+                    ->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品记录']);
+                }
+            }
+        }
         // 写入数据表
         $result     =  $LowPriceGoodsModel->addLowProduct($all_data);
         // 如果操作失败
@@ -264,7 +310,7 @@ class LowPriceGoods extends Controller
         if ($enable_full_quantity == 1 && !isset($all_data['product_specs'])) {
             return json_send(['code' => 'error', 'msg' => '非全量清洗时,商品规格不能为空']);
         }
-        if(trim($product_keyword) !=''){
+        if (trim($product_keyword) != '') {
             $product_keyword_count = count(explode(',', $product_keyword));
             if ($product_keyword_count > 5) {
                 return json_send(['code' => 'error', 'msg' => '商品关键词不能超过5个']);
@@ -272,6 +318,7 @@ class LowPriceGoods extends Controller
         }
         $store_scope = request('store_scope', '');
         $all_data['store_scope'] = $store_scope;
+        $platform_string = $all_data['platform'];
         $company_scope = request('company_scope', '');
         $all_data['company_scope'] = $company_scope;
         $category_id = request('category_id', '0');
@@ -279,8 +326,8 @@ 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'], 'platform' => $all_data['platform']];
-        if(isset($all_data['product_specs']) && $all_data['product_specs'] !=''){
+        $map = ['product_brand' => $all_data['product_brand'], 'product_name' => $all_data['product_name'],'suggested_price'=> $all_data['suggested_price']];
+        if (isset($all_data['product_specs']) && $all_data['product_specs'] != '') {
             $map['product_specs'] = $all_data['product_specs'];
         }
         if ($is_admin != 1 && $company_id != 0) {
@@ -288,8 +335,54 @@ class LowPriceGoods extends Controller
         } else {
             $map['company_id'] = $admin_company_id;
         }
-        $data = $LowPriceGoodsModel->where($map)->where('id', '!=', $id)->first();
-        if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
+        $data = $LowPriceGoodsModel->where($map)->first();
+        if (!empty($data) && $enable_full_quantity == 1) {
+            //继续校验规格是否存在
+            $product_specs_tring = $all_data['product_specs'];
+            $product_specs = $product_specs_tring ?  explode(',', $product_specs_tring) : '';
+            $product_specs = $product_specs ? array_unique($product_specs) : '';
+            //继续校平台是否存在
+
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $LowPriceGoodsModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $LowPriceGoodsModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $product_brand, 'product_name' => $all_data['product_name'],'suggested_price'=> $all_data['suggested_price'], 'status' => '0'])
+                    ->where('id', '!=', $id)
+                    ->where(function ($query) use ($product_specs) {
+                        // 平台条件(固定)
+                        $query->where(function ($query_li) use ($product_specs) {
+
+                            foreach ($product_specs as $product_spec) {
+                                if (empty($product_specs)) continue;
+                                $query_li->orWhereRaw("FIND_IN_SET(?, product_specs)", [$product_spec]);
+                            }
+                        });
+                    })->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品规格记录']);
+                }
+            }
+        } else if (!empty($data) && $enable_full_quantity == 0) {
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $LowPriceGoodsModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $LowPriceGoodsModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $product_brand, 'product_name' => $all_data['product_name'],'suggested_price'=> $all_data['suggested_price'], 'status' => '0'])
+                    ->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品记录']);
+                }
+            }
+        }
         // 更新数据表
         $where = ['id' => $id];
         if ($is_admin != 1 && $company_id != 0) {
@@ -355,6 +448,55 @@ class LowPriceGoods extends Controller
         }
         $LowProduct = $LowPriceGoodsModel->where($where)->first();
         if (!$LowProduct) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        if (!empty($LowProduct) && $LowProduct->enable_full_quantity == 1) {
+            //继续校验规格是否存在
+            $product_specs_tring = $LowProduct->product_specs;
+            $product_specs = $product_specs_tring ?  explode(',', $product_specs_tring) : '';
+            $product_specs = $product_specs ? array_unique($product_specs) : '';
+            //继续校平台是否存在
+
+            $platform_string = $LowProduct->platform;
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $LowPriceGoodsModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $LowPriceGoodsModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $LowProduct->product_brand, 'product_name' => $LowProduct->product_name,'suggested_price'=> $LowProduct->suggested_price, 'status' => '0'])
+                    ->where('id', '!=', $id)
+                    ->where(function ($query) use ($product_specs) {
+                        // 平台条件(固定)
+                        $query->where(function ($query_li) use ($product_specs) {
+
+                            foreach ($product_specs as $product_spec) {
+                                if (empty($product_specs)) continue;
+                                $query_li->orWhereRaw("FIND_IN_SET(?, product_specs)", [$product_spec]);
+                            }
+                        });
+                    })->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品规格启用记录']);
+                }
+            }
+        } else if (!empty($data) && $LowProduct->enable_full_quantity == 0) {
+            $platform_string = $LowProduct->platform;
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $LowPriceGoodsModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $LowPriceGoodsModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $LowProduct->product_brand, 'product_name' => $LowProduct->product_name,'suggested_price'=> $LowProduct->suggested_price,  'status' => '0'])
+                    ->where('id', '!=', $id)->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品启用记录']);
+                }
+            }
+        }
         // 执行修改
         $result            =  $LowPriceGoodsModel->changeStatus($LowProduct, $status);
         // 提示新增失败

+ 150 - 8
app/Http/Controllers/Manager/WashConfig/ViolationProduct.php

@@ -169,7 +169,7 @@ class ViolationProduct extends Controller
      * @date      2025-12-03
      * 
      */
-    public function add(Request $request, ViolationProductModel $ViolationProductModel, LowPriceGoodsModel $LowPriceGoodsModel)
+    public function add(Request $request, ViolationProductModel $ViolationProductModel )
     {
         $request->scene('add')->validate();
         $admin_company_id = request('admin_company_id', '0');
@@ -184,7 +184,7 @@ class ViolationProduct extends Controller
         //获取禁止商品启动数量
         $violation_product_count = $ViolationProductModel->where($status_where)->count();
         //获取低价挂网商品启用数量
-        $lowprice_product_count = $LowPriceGoodsModel->where($status_where)->count();
+        $lowprice_product_count = $ViolationProductModel->where($status_where)->count();
         //计算总数量
         $product_totle = $violation_product_count + $lowprice_product_count;
         // 接收数据
@@ -208,6 +208,7 @@ class ViolationProduct extends Controller
         }
         $store_scope = request('store_scope', '');
         $all_data['store_scope'] = $store_scope;
+        $platform_string = request('platform', '');
         $company_scope = request('company_scope', '');
         $all_data['company_scope'] = $company_scope;
         $category_id = request('category_id', '0');
@@ -215,7 +216,7 @@ 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'],'platform' => $all_data['platform']];
+        $map = ['product_brand' => $all_data['product_brand'], 'product_name' => $all_data['product_name']];
         if(isset($all_data['product_specs']) && $all_data['product_specs'] !=''){
             $map['product_specs'] = $all_data['product_specs'];
         }
@@ -227,7 +228,52 @@ class ViolationProduct extends Controller
             $all_data['company_id'] = $admin_company_id;
         }
         $data = $ViolationProductModel->where($map)->first();
-        if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
+        if (!empty($data) && $enable_full_quantity == 1) {
+            //继续校验规格是否存在
+            $product_specs_tring = $all_data['product_specs'];
+            $product_specs = $product_specs_tring ?  explode(',', $product_specs_tring) : '';
+            $product_specs = $product_specs ? array_unique($product_specs) : '';
+            //继续校平台是否存在
+
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $ViolationProductModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $ViolationProductModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $product_brand, 'product_name' => $all_data['product_name'], 'status' => '0'])
+                    ->where(function ($query) use ($product_specs) {
+                        // 平台条件(固定)
+                        $query->where(function ($query_li) use ($product_specs) {
+
+                            foreach ($product_specs as $product_spec) {
+                                if (empty($product_specs)) continue;
+                                $query_li->orWhereRaw("FIND_IN_SET(?, product_specs)", [$product_spec]);
+                            }
+                        });
+                    })->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品规格记录']);
+                }
+            }
+        } else if (!empty($data) && $enable_full_quantity == 0) {
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $ViolationProductModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $ViolationProductModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $product_brand, 'product_name' => $all_data['product_name'], 'status' => '0'])
+                    ->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品记录']);
+                }
+            }
+        }
         // 写入数据表
        
         $result     =  $ViolationProductModel->addViolationProduct($all_data);
@@ -279,13 +325,14 @@ class ViolationProduct extends Controller
         $store_scope = request('store_scope', '');
         $all_data['store_scope'] = $store_scope;
         $company_scope = request('company_scope', '');
+        $platform_string = request('platform', '');
         $all_data['company_scope'] = $company_scope;
         $category_id = request('category_id', '0');
         $all_data['category_id'] = $category_id;
         $specify_responsible_person = request('specify_responsible_person', '0');
         $all_data['specify_responsible_person'] = $specify_responsible_person;
         //查询是否存在
-        $map = ['product_name' => $all_data['product_name'], 'platform' => $all_data['platform']];
+        $map = ['product_brand' => $all_data['product_brand'], 'product_name' => $all_data['product_name']];
         if(isset($all_data['product_specs']) && $all_data['product_specs'] !=''){
             $map['product_specs'] = $all_data['product_specs'];
         }
@@ -297,7 +344,53 @@ class ViolationProduct extends Controller
             $all_data['company_id'] = $admin_company_id;
         }
         $data = $ViolationProductModel->where($map)->where('id', '!=', $id)->first();
-        if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
+        if (!empty($data) && $enable_full_quantity == 1) {
+            //继续校验规格是否存在
+            $product_specs_tring = $all_data['product_specs'];
+            $product_specs = $product_specs_tring ?  explode(',', $product_specs_tring) : '';
+            $product_specs = $product_specs ? array_unique($product_specs) : '';
+            //继续校平台是否存在
+
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $ViolationProductModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $ViolationProductModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $product_brand, 'product_name' => $all_data['product_name'], 'status' => '0'])
+                    ->where('id', '!=', $id)
+                    ->where(function ($query) use ($product_specs) {
+                        // 平台条件(固定)
+                        $query->where(function ($query_li) use ($product_specs) {
+
+                            foreach ($product_specs as $product_spec) {
+                                if (empty($product_specs)) continue;
+                                $query_li->orWhereRaw("FIND_IN_SET(?, product_specs)", [$product_spec]);
+                            }
+                        });
+                    })->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品规格记录']);
+                }
+            }
+        } else if (!empty($data) && $enable_full_quantity == 0) {
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $ViolationProductModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $ViolationProductModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $product_brand, 'product_name' => $all_data['product_name'], 'status' => '0'])
+                    ->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品记录']);
+                }
+            }
+        }
         // 更新数据表
         $where = ['id' => $id];
         if ($is_admin != 1 && $company_id != 0) {
@@ -327,7 +420,7 @@ class ViolationProduct extends Controller
      * @date      2025-12-03
      * 
      */
-    public function set_status(Request $request, ViolationProductModel $ViolationProductModel, LowPriceGoodsModel $LowPriceGoodsModel)
+    public function set_status(Request $request, ViolationProductModel $ViolationProductModel)
     {
         // 验证参数
         $request->scene('set_status')->validate();
@@ -341,7 +434,7 @@ class ViolationProduct extends Controller
             //获取禁止商品启动数量
             $violation_product_count = $ViolationProductModel->where('status', 0)->count();
             //获取低价挂网商品启用数量
-            $lowprice_product_count = $LowPriceGoodsModel->where('status', 0)->count();
+            $lowprice_product_count = $ViolationProductModel->where('status', 0)->count();
             //计算总数量
             $product_totle = $violation_product_count + $lowprice_product_count;
         }
@@ -354,6 +447,55 @@ class ViolationProduct extends Controller
         }
         $ViolationProduct = $ViolationProductModel->where($where)->first();
         if (!$ViolationProduct) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        if (!empty($ViolationProduct) && $ViolationProduct->enable_full_quantity == 1) {
+            //继续校验规格是否存在
+            $product_specs_tring = $ViolationProduct->product_specs;
+            $product_specs = $product_specs_tring ?  explode(',', $product_specs_tring) : '';
+            $product_specs = $product_specs ? array_unique($product_specs) : '';
+            //继续校平台是否存在
+
+            $platform_string = $ViolationProduct->platform;
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $ViolationProductModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $ViolationProductModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $ViolationProduct->product_brand, 'product_name' => $ViolationProduct->product_name, 'status' => '0'])
+                    ->where('id', '!=', $id)
+                    ->where(function ($query) use ($product_specs) {
+                        // 平台条件(固定)
+                        $query->where(function ($query_li) use ($product_specs) {
+
+                            foreach ($product_specs as $product_spec) {
+                                if (empty($product_specs)) continue;
+                                $query_li->orWhereRaw("FIND_IN_SET(?, product_specs)", [$product_spec]);
+                            }
+                        });
+                    })->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品规格启用记录']);
+                }
+            }
+        } else if (!empty($data) && $ViolationProduct->enable_full_quantity == 0) {
+            $platform_string = $ViolationProduct->platform;
+            $platforms = $platform_string ?  explode(',', $platform_string) : '';
+            $platforms = $platforms ? array_unique($platforms) : '';
+
+            $platform_data = $ViolationProductModel->platform_index_data();
+            foreach ($platforms as $platform) {
+                $product_specs_log = $ViolationProductModel
+                    ->whereRaw("FIND_IN_SET(?, platform)", [$platform])
+                    ->where(['product_brand' => $ViolationProduct->product_brand, 'product_name' => $ViolationProduct->product_name, 'status' => '0'])
+                    ->where('id', '!=', $id)->first();
+                $platform_name = isset($platform_data[$platform]) ? $platform_data[$platform] : '';
+                if (!empty($product_specs_log)) {
+                    return json_send(['code' => 'error', 'msg' => $platform_name . '存在重复的商品启用记录']);
+                }
+            }
+        }
         // 执行修改
         $result            =  $ViolationProductModel->changeStatus($ViolationProduct, $status);
         // 提示新增失败

+ 4 - 2
app/Http/Requests/Manager/WashConfig/LowPriceGoods.php

@@ -36,6 +36,7 @@ class LowPriceGoods extends BaseRequest
             'store_scope'       => 'required',
             'platform'          => 'required',
             'enable_full_quantity' => 'required|integer|in:0,1',
+            'product_brand'     => 'required',
         ];
     }
 
@@ -44,8 +45,8 @@ class LowPriceGoods extends BaseRequest
     protected   $scenes         = [
         'detail'             => ['id'],
         'list'               => ['page', 'limit'],
-        'add'                      => ['platform','product_name', 'suggested_price','enable_full_quantity'],
-        'edit'                  => ['id','platform', 'product_name','suggested_price','enable_full_quantity'],
+        'add'                      => ['platform','product_brand','product_name', 'suggested_price','enable_full_quantity'],
+        'edit'                  => ['id','product_brand','platform', 'product_name','suggested_price','enable_full_quantity'],
         'set_status'              => ['id', 'status'],
         'delete'                  => ['id'],
         'spec_list'             => ['page', 'limit'],
@@ -84,6 +85,7 @@ class LowPriceGoods extends BaseRequest
             'enable_full_quantity.required' => '是否全量未知',
             'enable_full_quantity.integer' => '是否全量格式错误',
             'enable_full_quantity.in' => '是否全量格式错误',
+            'product_brand.required'    => '品牌名称未知',
         ];
     }
 }

+ 2 - 2
app/Models/Manager/Collect/Product.php

@@ -25,13 +25,13 @@ class Product extends Model
     // const UPDATED_AT = 'update_time';
 
 
-        /**
+    /**
      * 平台定义
      * @author 唐远望
      * @version 1.0
      * @date 2025-12-31
      */
-    public function platform_data()
+    public function platform_index_data()
     {
         //平台0=全部,1=淘宝,2=京东,3=拼多多,4=美团,5=药师帮,6=1药城,7=药久久,8=药易购,9=药帮忙,10=熊猫药药11=药房网
         $platform_data = [

+ 27 - 0
app/Models/Manager/WashConfig/LowPriceGoods.php

@@ -337,4 +337,31 @@ class LowPriceGoods extends Model
         ];
         return $platform_data;
     }
+
+
+    /**
+     * 平台定义
+     * @author 唐远望
+     * @version 1.0
+     * @date 2025-12-31
+     */
+    public function platform_index_data()
+    {
+        //平台0=全部,1=淘宝,2=京东,3=拼多多,4=美团,5=药师帮,6=1药城,7=药久久,8=药易购,9=药帮忙,10=熊猫药药11=药房网
+        $platform_data = [
+            '1' => '淘宝',
+            '2' => '京东',
+            '3' => '拼多多',
+            '4' => '美团',
+            '5' => '药师帮',
+            '6' => '1药城',
+            '7' => '药久久',
+            '8' => '药易购',
+            '9' => '药帮忙',
+            '10' => '熊猫药药',
+            '11' => '药房网',
+        ];
+        return $platform_data;
+    }
+
 }

+ 25 - 0
app/Models/Manager/WashConfig/ViolationProduct.php

@@ -332,4 +332,29 @@ class ViolationProduct extends Model
         ];
         return $platform_data;
     }
+
+    /**
+     * 平台定义
+     * @author 唐远望
+     * @version 1.0
+     * @date 2025-12-31
+     */
+    public function platform_index_data()
+    {
+        //平台0=全部,1=淘宝,2=京东,3=拼多多,4=美团,5=药师帮,6=1药城,7=药久久,8=药易购,9=药帮忙,10=熊猫药药11=药房网
+        $platform_data = [
+            '1' => '淘宝',
+            '2' => '京东',
+            '3' => '拼多多',
+            '4' => '美团',
+            '5' => '药师帮',
+            '6' => '1药城',
+            '7' => '药久久',
+            '8' => '药易购',
+            '9' => '药帮忙',
+            '10' => '熊猫药药',
+            '11' => '药房网',
+        ];
+        return $platform_data;
+    }
 }