Kernel.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace App\Console;
  3. use App\Console\Anime\AnimeCheckImgUrlCommand;
  4. use App\Console\Anime\SegmentCheckAudioCommand;
  5. use App\Console\Test\RegisterUserCommand;
  6. use Illuminate\Console\Scheduling\Schedule;
  7. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  8. class Kernel extends ConsoleKernel
  9. {
  10. protected $commands = [
  11. Test\TestCommand::class,
  12. RegisterUserCommand::class,
  13. AnimeCheckImgUrlCommand::class,
  14. Commands\ProcessImageGenerationQueueCommand::class,
  15. Commands\ProcessBatchEpisodeGenerationCommand::class,
  16. SegmentCheckAudioCommand::class,
  17. Commands\SyncTaskCenterCommand::class
  18. ];
  19. /**
  20. * Define the application's command schedule.
  21. *
  22. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  23. * @return void
  24. */
  25. protected function schedule(Schedule $schedule)
  26. {
  27. // 检查图片生成任务状态
  28. $schedule->command('AIGeneration:checkImgTasks')->everyMinute();
  29. // 检查视频生成任务状态
  30. $schedule->command('AIGeneration:checkVideoTasks')->everyMinute()->withoutOverlapping(5);
  31. // 检查动漫对话图片生成状态
  32. $schedule->command('Anime:checkImgUrl')->everyMinute();
  33. // 检查分镜音频生成状态
  34. $schedule->command('Segment:checkAudio')->everyMinute();
  35. // 处理图片生成任务队列
  36. $schedule->command('image-generation:process-queue')->everyMinute();
  37. // 批量生成分集任务(每分钟执行一次,并发调度不同anime_id的子进程处理,默认并发5)
  38. $schedule->command('batch:generate-episodes')->everyMinute()->withoutOverlapping();
  39. // 同步任务中心状态和结果(关联图片/视频任务)
  40. $schedule->command('taskCenter:sync')->everyMinute()->withoutOverlapping(5);
  41. }
  42. /**
  43. * Register the commands for the application.
  44. *
  45. * @return void
  46. */
  47. protected function commands()
  48. {
  49. $this->load(__DIR__ . '/Commands');
  50. require base_path('routes/console.php');
  51. }
  52. }