From 01c5f76f4191d3f47be98f3b7d4b880a203bc52f Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Thu, 28 May 2026 10:48:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=87=E6=8D=A2=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/EventCalendarService.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Services/EventCalendarService.php b/app/Services/EventCalendarService.php index 36a0a46..76faa56 100644 --- a/app/Services/EventCalendarService.php +++ b/app/Services/EventCalendarService.php @@ -260,9 +260,15 @@ class EventCalendarService extends BaseService 'event_calendar.update' ); } - + $now_time = date("Y-m-d H:i:s", time()); $query = EventCalendar::query()->where('pattern_id', $pattern_id) - ->whereIn('status', [0, 1])->first(); + ->whereIn('status', [0, 1]) + ->where(function ($query) use ($now_time) { + $query->whereRaw( + "'{$now_time}' BETWEEN start_time AND end_time" + ); + }) + ->first(); $end_time = get_datetime('datetime', strtotime($end_time)); $save = [