Kernel.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Console;
  3. use App\Console\Commands\CollectTaskAllocateAgainCommand;
  4. use App\Console\Commands\CollectTaskAllocateCommand;
  5. use App\Console\Commands\CollectTaskCommand;
  6. use Illuminate\Console\Scheduling\Schedule;
  7. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  8. class Kernel extends ConsoleKernel
  9. {
  10. /**
  11. * The Artisan commands provided by your application.
  12. *
  13. * @var array
  14. */
  15. protected $commands = [
  16. CollectTaskAllocateAgainCommand::class,
  17. CollectTaskAllocateCommand::class,
  18. CollectTaskCommand::class,
  19. ];
  20. /**
  21. * Define the application's command schedule.
  22. *
  23. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  24. * @return void
  25. */
  26. protected function schedule(Schedule $schedule)
  27. {
  28. $schedule->command('collect-task')->everyThirtyMinutes();
  29. $schedule->command('collect-task-allocate')->everyThirtyMinutes();
  30. $schedule->command('collect-task-allocate-again')->everyThirtyMinutes();
  31. }
  32. /**
  33. * Register the commands for the application.
  34. *
  35. * @return void
  36. */
  37. protected function commands()
  38. {
  39. // 自动引入任务命令
  40. $this->load(__DIR__.'/Commands');
  41. // 引入任务路由
  42. require base_path('routes/console.php');
  43. }
  44. }