Ver código fonte

[智价云] 推送统计更新

tangyuanwang 2 dias atrás
pai
commit
53e24947ef

+ 3 - 3
app/Http/Controllers/Manager/Process/SubNotice.php

@@ -40,11 +40,11 @@ class SubNotice extends Controller
             $company_push_time = $NoticeConfigModel->query()->where('company_id', $item['id'])->value('push_time');
             if (empty($company_push_time)) continue;
             $company_push_time_string = date('Y-m-d', time()) . ' ' . $company_push_time . ':00';
-            //如果当前时间在公司配置时间前5个小时,则开始继续执行
+            //如果当前时间在公司配置时间前20分钟统计,则开始继续执行
             $company_push_time_timestamp = strtotime($company_push_time_string);
-            if (time() < $company_push_time_timestamp - 3600*5) continue;
+            if (time() < $company_push_time_timestamp - 60 * 20) continue;
 
-            $second = 60 * $key_index; // 每个商户延迟 60 秒
+            $second = 10; // 每个商户延迟 10 秒
             // 准备数据
             $message_data = ['company_id' => $item['id']];
 

+ 6 - 3
app/Jobs/Manager/Process/SubNoticeJobs.php

@@ -226,10 +226,13 @@ class SubNoticeJobs implements ShouldQueue
         if ($statistics_day < 1) {
             return ['now_week' => $now_week, 'statistics_day' => $statistics_day, 'statistics_start_time' => '', 'statistics_end_time' => '', 'push_time' => '', 'notice_week_config' => $notice_week_config];
         }
-        //获取统计开始时间
+
+        /**  新规则,统计时间为上一后期延长一天,且包扩今天的时间 */
+        $statistics_day = $statistics_day -1;
         $statistics_start_time = Carbon::today()->subDays($statistics_day)->startOfDay()->toDateTimeString();
-        //获取昨日结束时间
-        $statistics_end_time = Carbon::today()->subDays(1)->endOfDay()->toDateTimeString();
+        //获取今日结束时间
+        $statistics_end_time = Carbon::today()->endOfDay()->toDateTimeString();
+
         return ['now_week' => $now_week, 'statistics_day' => $statistics_day, 'statistics_start_time' => $statistics_start_time, 'statistics_end_time' => $statistics_end_time, 'push_time' => $data->push_time, 'notice_week_config' => $notice_week_config];
     }