Skip to content

定时任务 ​

在 routes/console.php 中定义定时任务,执行情况自动记录到 schedule_logs 表,可在后台"监控管理-调度日志"查看。

任务清单 ​

任务频率说明
auth:clear-resets每日 01:00清理过期密码重置令牌
model:prune每日 01:05清理已标记删除的模型(含调度日志过期清理)
stats:user每日 01:10统计昨日用户数据
telescope:prune --hours=48 --keep-exceptions每日 01:15清理 Telescope 记录
horizon:snapshot每 5 分钟记录应用状态快照
CloseExpiredRechargesJob每 5 分钟关闭超时未支付的充值订单(钱包 Phase 2 交付)
segments:sync-rules每日 02:00同步所有启用的规则分群(增量 diff,仅影响规则打标的成员,不误删手动打标)

调度日志 ​

调度任务执行情况自动记录到 schedule_logs 表:

字段说明
task_name任务名称
task_type任务类型(command/callback/exec)
expressionCron 表达式
status执行状态(running/success/failed/skipped)
exit_code退出码
duration_ms执行耗时(毫秒)
exception异常信息摘要
started_at开始时间
finished_at结束时间

支持按 schedule.log_prunable_days 配置自动清理过期日志。


文档来源:PRD 第 13 章