Browse Source

自动脚本2

master
wanghongjun 7 days ago
parent
commit
33219e1d78
  1. 23
      app/Console/Commands/AutomaticallyStartActivity.php

23
app/Console/Commands/AutomaticallyStartActivity.php

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

Loading…
Cancel
Save