diff --git a/app/Console/Commands/AutomaticallyStartActivity.php b/app/Console/Commands/AutomaticallyStartActivity.php index a530d61..b9b6d20 100644 --- a/app/Console/Commands/AutomaticallyStartActivity.php +++ b/app/Console/Commands/AutomaticallyStartActivity.php @@ -52,6 +52,7 @@ class AutomaticallyStartActivity extends Command $runRes = EventCalendar::query()->where($where)->orderBy('created_at') ->first(); + $start_default = false; $start = true; $EventCalendarService = new EventCalendarService($this->logService); // 数据存在,且结束时间到了,结束时间 @@ -61,6 +62,7 @@ class AutomaticallyStartActivity extends Command $is_manual = $runRes['is_manual']; if ($end_time && strtotime($end_time) <= $now_times) { $EventCalendarService->updateStatus($run_id, $this->user_id, 2); + $start_default = true; } elseif ($is_manual == 1) { // 手动开始的不切换模式 $start = false; @@ -87,15 +89,18 @@ class AutomaticallyStartActivity extends Command $EventCalendarService->updateStatus($run_id, $this->user_id, 2); } $EventCalendarService->updateStatus($new_id, $this->user_id, 1, true); - } else { - // 如果不存在新活动模式,撤回默认模式 - $pattern_id = EventCalendarService::getTargetModeId(); - if ($pattern_id) { - // 更新车位类型 - $EventCalendarService->syncUpdateSpaceType($pattern_id); - // 记录日志 - //AdminNoticeService::addChangeModeNotice($pattern_id, $this->user_id); - } + $start_default = false; + } + } + + // 如果不存在新活动模式,撤回默认模式 + if ($start_default) { + $pattern_id = EventCalendarService::getTargetModeId(); + if ($pattern_id) { + // 更新车位类型 + $EventCalendarService->syncUpdateSpaceType($pattern_id); + // 记录日志 + AdminNoticeService::addChangeModeNotice($pattern_id, $this->user_id); } } }