From b42f0966e08911432086f59e8b5ab32ac4090446 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Wed, 27 May 2026 16:20:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=87=E6=8D=A2=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/AutomaticallyStartActivity.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/AutomaticallyStartActivity.php b/app/Console/Commands/AutomaticallyStartActivity.php index badc80d..423164b 100644 --- a/app/Console/Commands/AutomaticallyStartActivity.php +++ b/app/Console/Commands/AutomaticallyStartActivity.php @@ -69,11 +69,13 @@ class AutomaticallyStartActivity extends Command // 启动 新模式 if ($start) { $where = [ - ['status', '=', 0], - ['start_time', '>=', $now_time], - ['end_time', '<=', $now_time] + ['status', '=', 0] ]; - $res = EventCalendar::query()->where($where)->orderBy('start_time') + $res = EventCalendar::query()->where($where)->where(function ($query) use ($now_time) { + $query->whereRaw( + "'{$now_time}' BETWEEN start_time AND end_time" + ); + })->orderBy('start_time') ->first(['id']); if ($res) { // 新活动运行 直接关闭旧活动