Browse Source

[智价云] 优化清洗时间日志时间计算

tangyuanwang 15 hours ago
parent
commit
c3902f130c

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

@@ -87,6 +87,8 @@ class LowPriceGoodsDataJobs implements ShouldQueue
         $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']; //关键字
+        $item_totle_page = $message_data['item_totle_page']; //清洗商品总页数
+        $item_now_page = $message_data['item_now_page']; //清洗商品当前页
 
         $where = [];
         if ($platform != '0') {
@@ -117,7 +119,7 @@ class LowPriceGoodsDataJobs implements ShouldQueue
         $product_data_info = $ScrapeDataModel->where($where)->paginate($limit, ['*'], 'page', $page)->toarray();
         $product_datas = $product_data_info['data'];
         if (empty($product_datas)) {
-            if ($executeLog_id) {
+            if ($executeLog_id && $item_now_page >= $item_totle_page) {
                 (new ExecuteLogModel())->where('id', $executeLog_id)->update(['status' => 0, 'update_time' => time()]);
             }
             return true;

+ 5 - 1
app/Jobs/Manager/Process/LowPriceGoodsJobs.php

@@ -62,11 +62,13 @@ class LowPriceGoodsJobs implements ShouldQueue
             if ($company_id) {
                 $ConfigLowPriceGoodsModel = $ConfigLowPriceGoodsModel->where('washconfig_lowprice_product.company_id', $company_id);
             }
+            $totle_page = 0;
             $list_config_data = $ConfigLowPriceGoodsModel->with(['product_keyword'])->paginate($limit, ['*'], 'page', $page)->toarray();
-
             if (!$list_config_data || empty($list_config_data['data'])) {
                 return true;
             }
+            //获取总页码
+            $totle_page = $list_config_data['last_page'];
             $list_data = $list_config_data['data'];
             foreach ($list_data as $key => $value) {
                 $company_data = $LowPriceGoodsCompanyModel->where('washconfig_lowprice_product_company.lowprice_product_logid', $value['id'])
@@ -89,6 +91,8 @@ class LowPriceGoodsJobs implements ShouldQueue
                     'specify_responsible_person' => $value['specify_responsible_person'],
                     'product_brand' => $value['product_brand'],
                     'product_keyword' => $value['product_keyword'],
+                    'item_totle_page' => $totle_page,
+                    'item_now_page' => $page,
                 ];
                 LowPriceGoodsDataJobs::dispatch($message_data);
                 // LowPriceGoodsDataJobs::dispatchSync($message_data);

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

@@ -86,6 +86,8 @@ class ViolationProductDataJobs implements ShouldQueue
         $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']; //关键字
+        $item_totle_page = $message_data['item_totle_page']; //清洗商品总页数
+        $item_now_page = $message_data['item_now_page']; //清洗商品当前页
 
         $where = [];
         if ($platform != '0') {
@@ -115,7 +117,7 @@ class ViolationProductDataJobs implements ShouldQueue
         $product_data_info = $ScrapeDataModel->where($where)->paginate($limit, ['*'], 'page', $page)->toarray();
         $product_datas = $product_data_info['data'];
         if (empty($product_datas)) {
-            if ($executeLog_id) {
+            if ($executeLog_id && $item_now_page >= $item_totle_page) {
                 (new ExecuteLogModel())->where('id', $executeLog_id)->update(['status' => 0,'update_time' => time()]);
             }
             return true;

+ 4 - 0
app/Jobs/Manager/Process/ViolationProductJobs.php

@@ -61,10 +61,12 @@ class ViolationProductJobs implements ShouldQueue
             if($company_id){
                 $ConfigViolationProductModel = $ConfigViolationProductModel->where('washconfig_violation_product.company_id', $company_id);
             }
+            $totle_page = 0;
             $list_config_data = $ConfigViolationProductModel->with(['product_keyword'])->paginate($limit, ['*'], 'page', $page)->toarray();
             if (!$list_config_data || empty($list_config_data['data'])) {
                 return true;
             }
+            $totle_page = $list_config_data['last_page'];
             $list_data = $list_config_data['data'];
             foreach ($list_data as $key => $value) {
                 $company_data = $ViolationProductCompanyModel->where('washconfig_violation_product_company.violation_product_logid', $value['id'])
@@ -86,6 +88,8 @@ class ViolationProductJobs implements ShouldQueue
                     'specify_responsible_person' => $value['specify_responsible_person'],
                     'product_brand' => $value['product_brand'],
                     'product_keyword' => $value['product_keyword'],
+                    'item_totle_page' => $totle_page,
+                    'item_now_page' => $page,
                 ];
                 ViolationProductDataJobs::dispatch($message_data);
                 // ViolationProductDataJobs::dispatchSync($message_data);

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

@@ -81,6 +81,8 @@ class ViolationStoreDataJobs 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
+        $item_totle_page = $message_data['item_totle_page']; //清洗店铺总页数
+        $item_now_page = $message_data['item_now_page']; //清洗店铺当前页
 
         $yesterdayStart = Carbon::today()->subDays(6)->startOfDay()->getTimestamp(); // 最近7天开始时间 00:00:00
         // $yesterdayStart = Carbon::yesterday()->startOfDay()->getTimestamp(); // 昨天开始时间 00:00:00
@@ -98,7 +100,7 @@ class ViolationStoreDataJobs implements ShouldQueue
         $product_data_info = $ScrapeDataModel->paginate($limit, ['*'], 'page', $page)->toarray();
         $product_datas = $product_data_info['data'];
         if (empty($product_datas)) {
-            if ($executeLog_id) {
+            if ($executeLog_id && $item_now_page >= $item_totle_page) {
                 (new ExecuteLogModel())->where('id', $executeLog_id)->update(['status' => 0,'update_time' => time()]);
             }
             return true;

+ 4 - 0
app/Jobs/Manager/Process/ViolationStoreJobs.php

@@ -58,10 +58,12 @@ class ViolationStoreJobs implements ShouldQueue
             if($company_id){
                 $ViolationStoreModel = $ViolationStoreModel->where('washconfig_violation_store.company_id', $company_id);
             }
+            $totle_page = 0;
             $list_config_data = $ViolationStoreModel->paginate($limit, ['*'], 'page', $page)->toarray();
             if (!$list_config_data || empty($list_config_data['data'])) {
                 return true;
             }
+            $totle_page = $list_config_data['last_page'];
             $list_data = $list_config_data['data'];
             foreach ($list_data as $key => $value) {
                 $message_data = [
@@ -75,6 +77,8 @@ class ViolationStoreJobs implements ShouldQueue
                     'executeLog_id' => $executeLog_id,
                     'company_category_name' => $value['category_name'],
                     'specify_responsible_person' => $value['specify_responsible_person'],
+                    'item_totle_page' => $totle_page,
+                    'item_now_page' => $page,
                 ];
                 ViolationStoreDataJobs::dispatch($message_data);
                 // ViolationStoreDataJobs::dispatchSync($message_data);