Browse Source

自动切换模式4

master
wanghongjun 3 weeks ago
parent
commit
b42f0966e0
  1. 10
      app/Console/Commands/AutomaticallyStartActivity.php

10
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) {
// 新活动运行 直接关闭旧活动

Loading…
Cancel
Save