= $reminderTimes[1] - 1 && $times[1] <= $reminderTimes[1] + 1){ // Cache::put("UnclaimedTaskRemindTask:His", date('H:i:s'), Carbon::now()->addMinutes(5)); // Project::whereNull('deleted_at')->whereNull('archived_at')->chunk(100,function($projects) { foreach ($projects as $project) { // $count = ProjectTask::query() ->leftJoin('project_task_users', function ($query) { $query->on('project_tasks.id', '=', 'project_task_users.task_id'); }) ->where('project_tasks.project_id',$project->id) ->whereNull('project_tasks.deleted_at') ->whereNull('project_tasks.archived_at') ->whereNull('project_task_users.id') ->count(); if($count > 0){ $botUser = User::botGetOrCreate('task-alert'); if (empty($botUser)) { return; } if (!ProjectUser::whereUserid($botUser->userid)->whereProjectId($project->id)->exists()) { $project->joinProject($botUser->userid); $project->syncDialogUser(); } WebSocketDialogMsg::sendMsg(null, $project->dialog_id , 'text', [ 'text' => "当前存在{$count}个未领取任务" ], $botUser->userid); } } }); } } public function end() { } }