Files
chatroom/routes/console.php
lkddi 143601c251 功能:婚姻系统第11步(Horizon Jobs + 定时任务)
5个 Job:
- ExpireMarriageProposals:每5分钟扫描超时求婚(广播通知)
- TriggerScheduledWeddings:每5分钟触发定时婚礼(广播庆典)
- AutoExpireDivorces:每小时处理离婚超时自动解除
- ExpireWeddingEnvelopes:每小时清理过期红包
- ProcessMarriageIntimacy:每日00:05全量亲密度时间奖励

console.php 注册5个 Schedule
2026-03-01 15:16:46 +08:00

33 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
// 每天凌晨 3 点清理超过 30 天的聊天记录
Schedule::command('messages:purge')->dailyAt('03:00');
// 每 5 分钟为所有在线用户自动存点(经验/金币/等级)
Schedule::command('chatroom:auto-save-exp')->everyFiveMinutes();
// ──────────── 婚姻系统定时任务 ────────────────────────────────────
// 每 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');