Explorar el Código

[智价云] 去重规则校验更新

tangyuanwang hace 5 días
padre
commit
c6117a092b

+ 15 - 10
app/Models/Manager/Process/LowPriceGoods.php

@@ -123,17 +123,22 @@ class LowPriceGoods extends Model
     {
         if ($is_import == false) {
             //检查是否重复清洗
-            $source_data_log = $this->where('source_id', $data['source_id'])->count();
+            $source_data_log = $this->where([['company_id','=', $data['company_id']],['source_id','=', $data['source_id']]])->count();
             if(!empty($source_data_log) && $source_data_log > 0) return true;
-            //去重规则:品牌方公司ID+店铺公司名称+店铺名称+品牌名称+商品名称+规格+盒数(针对采集)
-            $source_where[] = ['company_id', '=', $data['company_id']]; //品牌方公司ID
-            $source_where[] = ['platform', '=', $data['platform']]; //平台
-            $source_where[] = ['company_name', '=', $data['company_name']]; //店铺公司名称
-            $source_where[] = ['store_name', '=', $data['store_name']]; //店铺名称
-            $source_where[] = ['product_brand', '=', $data['product_brand']]; //品牌名称
-            $source_where[] = ['product_name', '=', $data['product_name']]; //商品名称
-            $source_where[] = ['product_specs', '=', $data['product_specs']]; //规格
-            $source_where[] = ['scrape_date', '=', $data['scrape_date']]; //采集日期
+            // 如果是美团跟拼多多链接为动态
+            if (in_array($data['platform'], ['3', '4'])) {
+                //去重规则:品牌方公司ID+平台ID+公司名称+店铺名称+品牌名称+商品名称+规格+采集日期(针对采集)
+                $source_where[] = ['company_id', '=', $data['company_id']]; //品牌方公司ID
+                $source_where[] = ['platform', '=', $data['platform']]; //平台ID
+                $source_where[] = ['company_name', '=', $data['company_name']]; //公司名称
+                $source_where[] = ['store_name', '=', $data['store_name']]; //店铺名称
+                $source_where[] = ['product_brand', '=', $data['product_brand']]; //品牌名称
+                $source_where[] = ['product_name', '=', $data['product_name']]; //商品名称
+                $source_where[] = ['product_specs', '=', $data['product_specs']]; //规格
+                $source_where[] = ['scrape_date', '=', $data['scrape_date']]; //采集日期
+            } else {
+                $source_where[] = ['link_url', '=', $data['link_url']]; //链接地址
+            }
             $source_id_log = $this->where($source_where)->select(['id', 'online_posting_price'])->first();
             if (!empty($source_id_log)) {
                 if ($source_id_log->online_posting_price > $data['online_posting_price']) {

+ 15 - 10
app/Models/Manager/Process/ViolationProduct.php

@@ -117,17 +117,22 @@ class ViolationProduct extends Model
     {
         if ($is_import == false) {
             //检查是否重复清洗
-            $source_data_log = $this->where('source_id', $data['source_id'])->count();
+            $source_data_log = $this->where([['company_id','=', $data['company_id']],['source_id','=', $data['source_id']]])->count();
             if(!empty($source_data_log) && $source_data_log > 0) return true;
-            //去重规则:品牌方公司ID+店铺公司名称+店铺名称+品牌名称+商品名称+规格+盒数(针对采集)
-            $source_where[] = ['company_id', '=', $data['company_id']]; //品牌方公司ID
-            $source_where[] = ['platform', '=', $data['platform']]; //平台
-            $source_where[] = ['company_name', '=', $data['company_name']]; //店铺公司名称
-            $source_where[] = ['store_name', '=', $data['store_name']]; //店铺名称
-            $source_where[] = ['product_brand', '=', $data['product_brand']]; //品牌名称
-            $source_where[] = ['product_name', '=', $data['product_name']]; //商品名称
-            $source_where[] = ['product_specs', '=', $data['product_specs']]; //规格
-            $source_where[] = ['scrape_date', '=', $data['scrape_date']]; //采集日期
+            // 如果是美团跟拼多多链接为动态
+            if (in_array($data['platform'], ['3', '4'])) {
+                //去重规则:品牌方公司ID+店铺公司名称+店铺名称+品牌名称+商品名称+规格+盒数(针对采集)
+                $source_where[] = ['company_id', '=', $data['company_id']]; //品牌方公司ID
+                $source_where[] = ['platform', '=', $data['platform']]; //平台ID
+                $source_where[] = ['company_name', '=', $data['company_name']]; //店铺名称
+                $source_where[] = ['store_name', '=', $data['store_name']]; //店铺名称
+                $source_where[] = ['product_brand', '=', $data['product_brand']]; //品牌名称
+                $source_where[] = ['product_name', '=', $data['product_name']]; //商品名称
+                $source_where[] = ['product_specs', '=', $data['product_specs']]; //规格
+                $source_where[] = ['scrape_date', '=', $data['scrape_date']]; //采集日期
+            } else {
+                $source_where[] = ['link_url', '=', $data['link_url']]; //链接地址
+            }
             $source_id_log = $this->where($source_where)->count();
             if ($source_id_log > 0) {
                 return true;