2026-02-26 12:02:00 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Inspiring;
|
|
|
|
|
|
use Illuminate\Support\Facades\Artisan;
|
2026-02-27 00:12:16 +08:00
|
|
|
|
use Illuminate\Support\Facades\Schedule;
|
2026-02-26 12:02:00 +08:00
|
|
|
|
|
|
|
|
|
|
Artisan::command('inspire', function () {
|
|
|
|
|
|
$this->comment(Inspiring::quote());
|
|
|
|
|
|
})->purpose('Display an inspiring quote');
|
2026-02-27 00:12:16 +08:00
|
|
|
|
|
|
|
|
|
|
// 每天凌晨 3 点清理超过 30 天的聊天记录
|
|
|
|
|
|
Schedule::command('messages:purge')->dailyAt('03:00');
|
2026-02-27 12:39:23 +08:00
|
|
|
|
|
|
|
|
|
|
// 每 5 分钟为所有在线用户自动存点(经验/金币/等级)
|
|
|
|
|
|
Schedule::command('chatroom:auto-save-exp')->everyFiveMinutes();
|
2026-03-01 15:16:46 +08:00
|
|
|
|
|
|
|
|
|
|
// ──────────── 婚姻系统定时任务 ────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
|
|
// 每 5 分钟:扫描超时求婚(48h后失效 + 戒指消失 + 广播通知)
|
|
|
|
|
|
Schedule::job(new \App\Jobs\ExpireMarriageProposals)->everyFiveMinutes();
|
|
|
|
|
|
|
|
|
|
|
|
// 每 5 分钟:触发到时的定时婚礼(红包分发 + 广播庆典)
|
|
|
|
|
|
Schedule::job(new \App\Jobs\TriggerScheduledWeddings)->everyFiveMinutes();
|
|
|
|
|
|
|
|
|
|
|
|
// 每小时:协议离婚超时自动升级为强制(72h无响应)
|
|
|
|
|
|
Schedule::job(new \App\Jobs\AutoExpireDivorces)->hourly();
|
|
|
|
|
|
|
|
|
|
|
|
// 每小时:清理过期婚礼红包(expired_at 过后标记 completed)
|
|
|
|
|
|
Schedule::job(new \App\Jobs\ExpireWeddingEnvelopes)->hourly();
|
|
|
|
|
|
|
|
|
|
|
|
// 每天 00:05:全量处理婚姻亲密度时间奖励(每日加分)
|
|
|
|
|
|
Schedule::job(new \App\Jobs\ProcessMarriageIntimacy)->dailyAt('00:05');
|
2026-03-01 20:06:53 +08:00
|
|
|
|
|
|
|
|
|
|
// ──────────── 节日福利定时任务 ────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
|
|
// 每分钟:扫描并触发到期的节日福利活动
|
|
|
|
|
|
Schedule::call(function () {
|
|
|
|
|
|
\App\Models\HolidayEvent::pendingToTrigger()
|
|
|
|
|
|
->each(fn ($e) => \App\Jobs\TriggerHolidayEventJob::dispatch($e));
|
|
|
|
|
|
})->everyMinute()->name('holiday-events:trigger')->withoutOverlapping();
|
2026-03-01 20:25:09 +08:00
|
|
|
|
|
|
|
|
|
|
// ──────────── 百家乐定时任务 ─────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
|
|
// 每分钟:检查是否应开新一局(游戏开启 + 无正在进行的局)
|
|
|
|
|
|
Schedule::call(function () {
|
|
|
|
|
|
if (! \App\Models\GameConfig::isEnabled('baccarat')) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$config = \App\Models\GameConfig::forGame('baccarat')?->params ?? [];
|
|
|
|
|
|
$interval = (int) ($config['interval_minutes'] ?? 2);
|
|
|
|
|
|
|
|
|
|
|
|
// 检查距上一局触发时间是否已达到间隔
|
|
|
|
|
|
$lastRound = \App\Models\BaccaratRound::latest()->first();
|
|
|
|
|
|
if ($lastRound && $lastRound->created_at->diffInMinutes(now()) < $interval) {
|
|
|
|
|
|
return; // 还没到开局时间
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 无当前进行中的局才开新局
|
|
|
|
|
|
if (! \App\Models\BaccaratRound::currentRound()) {
|
|
|
|
|
|
\App\Jobs\OpenBaccaratRoundJob::dispatch();
|
|
|
|
|
|
}
|
|
|
|
|
|
})->everyMinute()->name('baccarat:open-round')->withoutOverlapping();
|