Просмотр исходного кода

[智价云] 调整清洗规则中午12点清洗昨天的数据

tangyuanwang 6 часов назад
Родитель
Сommit
45ee4d2210

+ 6 - 6
app/Jobs/Manager/Process/LowPriceGoodsDataJobs.php

@@ -93,12 +93,12 @@ class LowPriceGoodsDataJobs implements ShouldQueue
             $platform = explode(',', $platform);
             $ScrapeDataModel = $ScrapeDataModel->whereIn('platform_id', $platform);
         }
-        $last7DaysStart = Carbon::today()->subDays(6)->startOfDay()->getTimestamp(); // 7天前开始
-        $last7DaysEnd = Carbon::today()->endOfDay()->getTimestamp(); // 到今天结束
-        $last7DaysStart = date('Y-m-d H:i:s', $last7DaysStart);
-        $last7DaysEnd = date('Y-m-d H:i:s', $last7DaysEnd);
-        $where[] = ['insert_time', '>=', $last7DaysStart];
-        $where[] = ['insert_time', '<=', $last7DaysEnd];
+        $yesterdayStart = Carbon::yesterday()->startOfDay()->getTimestamp(); // 昨天开始时间 00:00:00
+        $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
+        $yesterdayStart = date('Y-m-d H:i:s', $yesterdayStart);
+        $yesterdayEnd = date('Y-m-d H:i:s', $yesterdayEnd);
+        $where[] = ['insert_time', '>=', $yesterdayStart];
+        $where[] = ['insert_time', '<=', $yesterdayEnd];
         $where[] = ['product_name', 'like', '%' . $product_name . '%'];
         $where[] = ['product_specs', 'like', '%' . $product_specs . '%'];
         $where[] = ['one_box_price', '<', $suggested_price];

+ 6 - 6
app/Jobs/Manager/Process/ViolationProductDataJobs.php

@@ -92,12 +92,12 @@ class ViolationProductDataJobs implements ShouldQueue
             $platform = explode(',', $platform);
             $ScrapeDataModel = $ScrapeDataModel->whereIn('platform_id', $platform);
         }
-        $last7DaysStart = Carbon::today()->subDays(6)->startOfDay()->getTimestamp(); // 7天前开始
-        $last7DaysEnd = Carbon::today()->endOfDay()->getTimestamp(); // 到今天结束
-        $last7DaysStart = date('Y-m-d H:i:s', $last7DaysStart);
-        $last7DaysEnd = date('Y-m-d H:i:s', $last7DaysEnd);
-        $where[] = ['insert_time', '>=', $last7DaysStart];
-        $where[] = ['insert_time', '<=', $last7DaysEnd];
+        $yesterdayStart = Carbon::yesterday()->startOfDay()->getTimestamp(); // 昨天开始时间 00:00:00
+        $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
+        $yesterdayStart = date('Y-m-d H:i:s', $yesterdayStart);
+        $yesterdayEnd = date('Y-m-d H:i:s', $yesterdayEnd);
+        $where[] = ['insert_time', '>=', $yesterdayStart];
+        $where[] = ['insert_time', '<=', $yesterdayEnd];
         $where[] = ['product_name', 'like', '%' . $product_name . '%'];
         $where[] = ['product_specs', 'like', '%' . $product_specs . '%'];
         

+ 6 - 7
app/Jobs/Manager/Process/ViolationStoreDataJobs.php

@@ -82,13 +82,12 @@ class ViolationStoreDataJobs implements ShouldQueue
         $page = isset($message_data['page']) ? $message_data['page'] : 1;
         $company_id = isset($message_data['company_id']) ? $message_data['company_id'] : 0;//品牌方公司ID
 
-
-        $last7DaysStart = Carbon::today()->subDays(6)->startOfDay()->getTimestamp(); // 7天前开始
-        $last7DaysEnd = Carbon::today()->endOfDay()->getTimestamp(); // 到今天结束
-        $last7DaysStart = date('Y-m-d H:i:s', $last7DaysStart);
-        $last7DaysEnd = date('Y-m-d H:i:s', $last7DaysEnd);
-        $where_map[] = ['insert_time', '>=', $last7DaysStart];
-        $where_map[] = ['insert_time', '<=', $last7DaysEnd];
+        $yesterdayStart = Carbon::yesterday()->startOfDay()->getTimestamp(); // 昨天开始时间 00:00:00
+        $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
+        $yesterdayStart = date('Y-m-d H:i:s', $yesterdayStart);
+        $yesterdayEnd = date('Y-m-d H:i:s', $yesterdayEnd);
+        $where_map[] = ['insert_time', '>=', $yesterdayStart];
+        $where_map[] = ['insert_time', '<=', $yesterdayEnd];
         if ($platform != '0') {
             $platform = explode(',', $platform);
             $ScrapeDataModel = $ScrapeDataModel->where('qualification_number', $social_credit_code)->where($where_map)->whereIn('platform_id', $platform);