|
@@ -31,7 +31,7 @@ class NewUserPushMsgDelay implements ShouldQueue
|
|
|
$this->uid = $uid;
|
|
|
}
|
|
|
|
|
|
- private function findUserTasks(): array
|
|
|
+ private function findUserTasks()
|
|
|
{
|
|
|
$user = User::find($this->uid);
|
|
|
if ($user) {
|
|
@@ -45,7 +45,6 @@ class NewUserPushMsgDelay implements ShouldQueue
|
|
|
->get();
|
|
|
}
|
|
|
}
|
|
|
- return [];
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -56,10 +55,12 @@ class NewUserPushMsgDelay implements ShouldQueue
|
|
|
public function handle()
|
|
|
{
|
|
|
$tasks = $this->findUserTasks();
|
|
|
- foreach ($tasks as $task) {
|
|
|
- $job = new NewUserPushMsg($this->uid, $task);
|
|
|
- dispatch($job)->onConnection('rabbitmq')->onQueue('new_user_push_msg')->delay($task->time_delay);
|
|
|
- myLog('new_user_push_msg')->info("task_id:{$task->id}; uid: {$this->uid}");
|
|
|
+ if ($tasks) {
|
|
|
+ foreach ($tasks as $task) {
|
|
|
+ $job = new NewUserPushMsg($this->uid, $task);
|
|
|
+ dispatch($job)->onConnection('rabbitmq')->onQueue('new_user_push_msg')->delay($task->time_delay);
|
|
|
+ myLog('new_user_push_msg')->info("task_id:{$task->id}; uid: {$this->uid}");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|