Parcourir la source

[智价云] 数据清洗补充品牌以及关键字搜索

tangyuanwang il y a 11 heures
Parent
commit
28586286ab

+ 10 - 0
app/Jobs/Manager/Process/LowPriceGoodsDataJobs.php

@@ -85,6 +85,8 @@ class LowPriceGoodsDataJobs implements ShouldQueue
         $limit = isset($message_data['limit']) ? $message_data['limit'] : 50;
         $page = isset($message_data['page']) ? $message_data['page'] : 1;
         $company_id = isset($message_data['company_id']) ? $message_data['company_id'] : 0; //品牌方公司ID
+        $product_brand = $message_data['product_brand']; //商品品牌名称
+        $product_keywords = $message_data['product_keyword']; //关键字
 
         $where = [];
         if ($platform != '0') {
@@ -98,6 +100,14 @@ class LowPriceGoodsDataJobs implements ShouldQueue
         $where[] = ['product_name', 'like', '%' . $product_name . '%'];
         $where[] = ['product_specs', 'like', '%' . $product_specs . '%'];
         $where[] = ['one_box_price', '<', $suggested_price];
+        
+        if ($product_brand) $where[] = ['product_name', 'like', '%' . $product_brand . '%'];
+        if (!empty($product_keyword)) {
+            foreach ($product_keywords as $key => $keywords) {
+                if (trim($keywords) == '') continue;
+                $where[] = ['product_name', 'like', '%' . $keywords . '%'];
+            }
+        }
         if ($company_scope == 2 && $social_credit_code != '') {
             $ScrapeDataModel->whereIn('qualification_number', $social_credit_code);
         }

+ 4 - 2
app/Jobs/Manager/Process/LowPriceGoodsJobs.php

@@ -62,7 +62,7 @@ class LowPriceGoodsJobs implements ShouldQueue
             if ($company_id) {
                 $ConfigLowPriceGoodsModel = $ConfigLowPriceGoodsModel->where('washconfig_lowprice_product.company_id', $company_id);
             }
-            $list_config_data = $ConfigLowPriceGoodsModel->paginate($limit, ['*'], 'page', $page)->toarray();
+            $list_config_data = $ConfigLowPriceGoodsModel->with(['product_keyword'])->paginate($limit, ['*'], 'page', $page)->toarray();
 
             if (!$list_config_data || empty($list_config_data['data'])) {
                 return true;
@@ -77,7 +77,7 @@ class LowPriceGoodsJobs implements ShouldQueue
                 $message_data = [
                     'company_id' => $value['company_id'],
                     'id' => $value['id'],
-                    'platform' => $value['platform'],
+                    'platform' => $value['platform'],  
                     'product_name' => $value['product_name'],
                     'product_specs' => $value['product_specs'],
                     'suggested_price' => $value['suggested_price'],
@@ -87,6 +87,8 @@ class LowPriceGoodsJobs implements ShouldQueue
                     'executeLog_id' => $executeLog_id,
                     'category_name' => $value['category_name'] ? $value['category_name'] : '',
                     'specify_responsible_person' => $value['specify_responsible_person'],
+                    'product_brand' => $value['product_brand'],
+                    'product_keyword' => $value['product_keyword'],
                 ];
                 LowPriceGoodsDataJobs::dispatch($message_data);
                 // LowPriceGoodsDataJobs::dispatchSync($message_data);

+ 10 - 0
app/Jobs/Manager/Process/ViolationProductDataJobs.php

@@ -84,6 +84,8 @@ class ViolationProductDataJobs implements ShouldQueue
         $limit = isset($message_data['limit']) ? $message_data['limit'] : 50;
         $page = isset($message_data['page']) ? $message_data['page'] : 1;
         $company_id = isset($message_data['company_id']) ? $message_data['company_id'] : 0;//品牌方公司ID
+        $product_brand = $message_data['product_brand']; //商品品牌名称
+        $product_keywords = $message_data['product_keyword']; //关键字
 
         $where = [];
         if ($platform != '0') {
@@ -96,6 +98,14 @@ class ViolationProductDataJobs implements ShouldQueue
         $where[] = ['insert_time', '<=', $last7DaysEnd];
         $where[] = ['product_name', 'like', '%' . $product_name . '%'];
         $where[] = ['product_specs', 'like', '%' . $product_specs . '%'];
+        
+        if ($product_brand) $where[] = ['product_name', 'like', '%' . $product_brand . '%'];
+        if (!empty($product_keyword)) {
+            foreach ($product_keywords as $key => $keywords) {
+                if (trim($keywords) == '') continue;
+                $where[] = ['product_name', 'like', '%' . $keywords . '%'];
+            }
+        }
         if ($company_scope == 2) {
             $ScrapeDataModel->whereIn('qualification_number', $social_credit_code);
         }

+ 3 - 1
app/Jobs/Manager/Process/ViolationProductJobs.php

@@ -61,7 +61,7 @@ class ViolationProductJobs implements ShouldQueue
             if($company_id){
                 $ConfigViolationProductModel = $ConfigViolationProductModel->where('washconfig_violation_product.company_id', $company_id);
             }
-            $list_config_data = $ConfigViolationProductModel->paginate($limit, ['*'], 'page', $page)->toarray();
+            $list_config_data = $ConfigViolationProductModel->with(['product_keyword'])->paginate($limit, ['*'], 'page', $page)->toarray();
             if (!$list_config_data || empty($list_config_data['data'])) {
                 return true;
             }
@@ -84,6 +84,8 @@ class ViolationProductJobs implements ShouldQueue
                     'executeLog_id' => $executeLog_id,
                     'category_name' => $value['category_name'] ? $value['category_name']:'',
                     'specify_responsible_person' => $value['specify_responsible_person'],
+                    'product_brand' => $value['product_brand'],
+                    'product_keyword' => $value['product_keyword'],
                 ];
                 ViolationProductDataJobs::dispatch($message_data);
                 // ViolationProductDataJobs::dispatchSync($message_data);