From 5f65e3d25f7254b44eb9c7d8acba50b822e2f18c Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Sat, 19 Sep 2020 16:07:32 +0800 Subject: [PATCH] =?UTF-8?q?fixed:=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=B8=8D=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/monitor/command/process/RegisterSignal.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/catch/monitor/command/process/RegisterSignal.php b/catch/monitor/command/process/RegisterSignal.php index 65dede9..edce007 100644 --- a/catch/monitor/command/process/RegisterSignal.php +++ b/catch/monitor/command/process/RegisterSignal.php @@ -89,11 +89,13 @@ trait RegisterSignal $crontabs = Crontab::where('status', Crontab::ENABLE) ->where('tactics', '<>', Crontab::EXECUTE_FORBIDDEN) ->select()->toArray(); + // 任务 foreach ($crontabs as $crontab) { - $can = CronExpression::factory(trim($crontab['cron'])) + $can = date('Y-m-d H:i', CronExpression::factory(trim($crontab['cron'])) ->getNextRunDate(date('Y-m-d H:i:s'), 0 , true) - ->getTimestamp() == time(); + ->getTimestamp()) == date('Y-m-d H:i', time()); + if ($can) { // 如果任务只执行一次 之后禁用该任务 if ($crontab['tactics'] === Crontab::EXECUTE_ONCE) {