Jelajahi Sumber

[智价云] 清洗校验更新

tangyuanwang 1 hari lalu
induk
melakukan
7f1089f2c2

+ 21 - 17
app/Jobs/Manager/Process/LowPriceGoodsDataJobs.php

@@ -91,35 +91,38 @@ class LowPriceGoodsDataJobs implements ShouldQueue
         $product_data = $message_data['product_data'];
         $index_number = $message_data['index_number'];
         $data_totle = $message_data['data_totle'];
-
-    //-------------------------------------- 清洗规则(开始) --------------------------------------
+        
+        //-------------------------------------- 清洗规则(开始) --------------------------------------
         //过滤没有链接数据
         if (trim($product_data['link_url']) == '')  return true;
         //数据是否命中低价
-        if ($product_data['number'] < 1 || $product_data['min_price'] < 0.01) return true;
+        if ($product_data['number'] < 1 || $product_data['min_price'] < 0.01)   return true;
         //计算单盒价格
         $unit_price = round($product_data['min_price'] / $product_data['number'], 2);
-        if ($unit_price > $suggested_price) return true;
+        if ($unit_price > $suggested_price)   return true;
         //数据是否命中商品名称
-        $hit_product_name = false;
-        if (strpos($product_data['product_name'], $product_name) !== false) {
-            $hit_product_name = true;
-        }      
-        if ($hit_product_name != true) return true;
+        if ($product_name != '') {
+            $hit_product_name = false;
+            if (strpos($product_data['product_name'], $product_name) !== false) {
+                $hit_product_name = true;
+            }
+            if ($hit_product_name != true)   return true;
+        }
         //数据是否命中规格
-        $hit_product_specs = false;
         if ($enable_full_quantity == 1 && $product_specs) {
+            $hit_product_specs = false;
             //product_name 包含规格
             if (strpos($product_data['product_name'], $product_specs) !== false) {
                 $hit_product_specs = true;
             } else if (strpos($product_data['product_specs'], $product_specs) !== false) {
                 $hit_product_specs = true;
             }
+            if ($hit_product_specs != true)   return true;
         }
-        if ($hit_product_specs != true) return true;
+
         //数据是否命中关键字
-        $hit_product_keywords = false;
         if (!empty($product_keywords)) {
+            $hit_product_keywords = false;
             $product_keywords = explode(',', $product_keywords);
             foreach ($product_keywords as $product_keyword) {
                 if (empty($product_keyword)) continue;
@@ -128,25 +131,26 @@ class LowPriceGoodsDataJobs implements ShouldQueue
                     break;
                 }
             }
+            if ($hit_product_keywords != true)   return true;
         }
-        if ($hit_product_keywords != true) return true;
         //数据是否命中指定公司
-        $hit_company_scope = false;
         if ($company_scope == 2 && $social_credit_code != '') {
+            $hit_company_scope = false;
             if ($product_data['qualification_number'] == $social_credit_code) {
                 $hit_company_scope = true;
             }
+            if ($hit_company_scope != true)   return true;
         }
-        if ($hit_company_scope != true) return true;
+
         //数据是否命中平台
-        $hit_platform = false;
         if ($platform != '0' && !empty($platform)) {
+            $hit_platform = false;
             $platform = explode(',', $platform);
             if (in_array($product_data['platform_id'], $platform)) {
                 $hit_platform = true;
             }
+            if ($hit_platform != true)   return true;
         }
-        if ($hit_platform != true) return true;       
         //-------------------------------------- 清洗规则(结束) --------------------------------------
 
         //-------------------------------------- 处理营业执照地区信息(开始) --------------------------------------

+ 16 - 12
app/Jobs/Manager/Process/ViolationProductDataJobs.php

@@ -94,25 +94,28 @@ class ViolationProductDataJobs implements ShouldQueue
         //过滤没有链接数据
         if (trim($product_data['link_url']) == '')  return true;
         //数据是否命中商品名称
-        $hit_product_name = false;
-        if (strpos($product_data['product_name'], $product_name) !== false) {
-            $hit_product_name = true;
+        if ($product_name != '') {
+            $hit_product_name = false;
+            if (strpos($product_data['product_name'], $product_name) !== false) {
+                $hit_product_name = true;
+            }
+            if ($hit_product_name != true)   return true;
         }
-        if ($hit_product_name != true) return true;
         //数据是否命中规格
-        $hit_product_specs = false;
         if ($enable_full_quantity == 1 && $product_specs) {
+            $hit_product_specs = false;
             //product_name 包含规格
             if (strpos($product_data['product_name'], $product_specs) !== false) {
                 $hit_product_specs = true;
             } else if (strpos($product_data['product_specs'], $product_specs) !== false) {
                 $hit_product_specs = true;
             }
+            if ($hit_product_specs != true)   return true;
         }
-        if ($hit_product_specs != true) return true;
+
         //数据是否命中关键字
-        $hit_product_keywords = false;
         if (!empty($product_keywords)) {
+            $hit_product_keywords = false;
             $product_keywords = explode(',', $product_keywords);
             foreach ($product_keywords as $product_keyword) {
                 if (empty($product_keyword)) continue;
@@ -121,25 +124,26 @@ class ViolationProductDataJobs implements ShouldQueue
                     break;
                 }
             }
+            if ($hit_product_keywords != true)   return true;
         }
-        if ($hit_product_keywords != true) return true;
         //数据是否命中指定公司
-        $hit_company_scope = false;
         if ($company_scope == 2 && $social_credit_code != '') {
+            $hit_company_scope = false;
             if ($product_data['qualification_number'] == $social_credit_code) {
                 $hit_company_scope = true;
             }
+            if ($hit_company_scope != true)   return true;
         }
-        if ($hit_company_scope != true) return true;
+
         //数据是否命中平台
-        $hit_platform = false;
         if ($platform != '0' && !empty($platform)) {
+            $hit_platform = false;
             $platform = explode(',', $platform);
             if (in_array($product_data['platform_id'], $platform)) {
                 $hit_platform = true;
             }
+            if ($hit_platform != true)   return true;
         }
-        if ($hit_platform != true) return true;
         //-------------------------------------- 清洗规则(结束) --------------------------------------