|
|
@@ -49,14 +49,18 @@ class SendNoticeJobs implements ShouldQueue
|
|
|
try {
|
|
|
$company_id = $this->message_data['company_id'];
|
|
|
$SubNoticeLogModel = new SubNoticeLogModel();
|
|
|
- //查询需要发送的通知,push_time等于当前时间,或者大于当前时间5分钟的通知
|
|
|
$now_time = time();
|
|
|
+ $start_time = $now_time - 300; // 5分钟前
|
|
|
+ $delay_time = $now_time - 0; // 0分钟前
|
|
|
+
|
|
|
$sub_notice_list = $SubNoticeLogModel->where('company_id', $company_id)
|
|
|
- ->where(function($query) use ($now_time) {
|
|
|
- $query->where('push_time', '=', $now_time)
|
|
|
- ->orWhere('push_time', '>', $now_time - 300);
|
|
|
- })
|
|
|
- ->get()->toarray();
|
|
|
+ ->where('push_time', '=', $now_time) // 正好当前时间
|
|
|
+ ->orWhere(function($query) use ($delay_time, $start_time) {
|
|
|
+ $query->where('push_time', '<', $delay_time)
|
|
|
+ ->where('push_time', '>=', $start_time); // 只查询0-5分钟内的
|
|
|
+ })
|
|
|
+ ->get()
|
|
|
+ ->toarray();
|
|
|
if (empty($sub_notice_list)) return true;
|
|
|
//执行发送站内信
|
|
|
$status1 = $this->send_internal_msg($sub_notice_list);
|