diff --git a/app/api/controller/CronController.php b/app/api/controller/CronController.php index 64742a928..07ef6609c 100644 --- a/app/api/controller/CronController.php +++ b/app/api/controller/CronController.php @@ -62,14 +62,19 @@ class CronController extends BaseApiController */ public function settlement(){ // $all=TaskSchedulingPlan::where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray(); - $all = TaskSchedulingPlan::whereDay('end_time','today') + $all = TaskSchedulingPlan::whereDay('end_time','yesterday') ->withJoin(['scheduling'], 'left') ->where('scheduling.company_type', 18) ->where('is_pay',0) ->with(['template_info']) ->select() ->toArray(); + foreach($all as $k=>$v){ + // 任务运行中,后台删除了任务模板 + if (empty($v['template_info'])) { + continue; + } queue(TaskInformationJob::class,$v); } Log::info('小组服务公司定时任务结算执行成功'.date('Y-m-d H:i:s')); @@ -128,6 +133,10 @@ class CronController extends BaseApiController ->select() ->toArray(); foreach($taskSchedulingPlanList as $taskSchedulingPlan){ + // 任务运行中,后台删除了任务模板 + if (empty($taskSchedulingPlan['template_info'])) { + continue; + } queue(VillageTaskSettlementJob::class, $taskSchedulingPlan); } Log::info('村管理公司定时任务结算执行-结束'.date('Y-m-d H:i:s')); @@ -185,6 +194,10 @@ class CronController extends BaseApiController ->select() ->toArray(); foreach($taskSchedulingPlanList as $taskSchedulingPlan){ + // 任务运行中,后台删除了任务模板 + if (empty($taskSchedulingPlan['template_info'])) { + continue; + } // 解耦 三个角色分开结算,避免某个角色的结算逻辑出现异常,导致整个镇农科公司的任务结算都终止 $taskTemplateInfo = $taskSchedulingPlan['template_info']; // 负责人任务结算