From 0c54ba8c341c9f7a294dcfb373a5d2b641e4d1df Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Fri, 24 Nov 2023 11:58:58 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E5=90=8E=E5=8F=B0=E5=9C=A8=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E8=BF=90=E8=A1=8C=E4=B8=AD=E5=88=A0=E9=99=A4=E4=BA=86?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A8=A1=E6=9D=BF=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E5=87=BA=E7=8E=B0=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/CronController.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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']; // 负责人任务结算