CheckVideoGenerationTasksCommand.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Services\AIGeneration\AIVideoGenerationService;
  4. use Illuminate\Console\Command;
  5. class CheckVideoGenerationTasksCommand extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'AIGeneration:checkVideoTasks';
  13. /**
  14. * The console command description.
  15. *
  16. * @var string
  17. */
  18. protected $description = '检查视频生成任务状态并更新结果';
  19. /**
  20. * Execute the console command.
  21. *
  22. * @return int
  23. */
  24. public function handle(AIVideoGenerationService $videoGenerationService)
  25. {
  26. $this->info('开始检查视频生成任务状态...');
  27. try {
  28. // 更新所有待处理的视频生成任务状态
  29. $videoGenerationService->updatePendingTasks();
  30. $this->info('视频生成任务状态检查完成');
  31. } catch (\Exception $e) {
  32. $this->error('视频生成任务状态检查失败: ' . $e->getMessage());
  33. return 1;
  34. }
  35. return 0;
  36. }
  37. }