Kernel.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Console;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  5. use App\Jobs\FiveSecondTaskJob;
  6. class Kernel extends ConsoleKernel
  7. {
  8. protected $commands = [
  9. \App\Console\Commands\StartFiveSecondTask::class,
  10. ];
  11. /**
  12. * Define the application's command schedule.
  13. *
  14. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  15. * @return void
  16. */
  17. protected function schedule(Schedule $schedule)
  18. {
  19. // $schedule->command('inspire')->hourly();
  20. // $schedule->job(new FiveSecondTaskJob)
  21. // ->cron('*/5 * * * * *') // 每秒的第0,5,10,15...秒执行
  22. // ->withoutOverlapping() // 防止重复执行
  23. // ->name('five-second-task') // 给任务起个名字
  24. // ->onOneServer(); // 如果在多服务器环境
  25. $schedule->command('sport')->dailyAt('23:59:00');
  26. $schedule->command('third-game:sync-orders')
  27. ->everyMinute()
  28. ->withoutOverlapping(5);
  29. $schedule->command('agent:settle')
  30. ->dailyAt('04:10')
  31. ->withoutOverlapping(180);
  32. }
  33. /**
  34. * Register the commands for the application.
  35. *
  36. * @return void
  37. */
  38. protected function commands()
  39. {
  40. $this->load(__DIR__.'/Commands');
  41. require base_path('routes/console.php');
  42. }
  43. }