commands([ \UCore\Commands\GenerateModelAnnotation::class, \UCore\Commands\GenerateAppTreeCommand::class, \UCore\Commands\CleanSizeRotatingLogsCommand::class, \UCore\Commands\ExampleCommand::class ]); // 注册UCore定时任务 $this->registerSchedules(); } public function register() { // } /** * 注册UCore相关的定时任务 * * 将原本在 routes/console.php 中的UCore调度配置迁移到此处 */ protected function registerSchedules(): void { // 在应用完全启动后注册定时任务 $this->app->booted(function () { // 每天凌晨3点清理 size_rotating_daily 日志文件(保留配置的天数) Schedule::command('ucore:clean-size-rotating-logs') ->dailyAt('03:00') ->description('清理UCore轮转日志文件'); }); } }