Kernel.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Console;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  5. class Kernel extends ConsoleKernel
  6. {
  7. /**
  8. * The Artisan commands provided by your application.
  9. *
  10. * @var array
  11. */
  12. protected $commands = [
  13. Commands\BookAdjust::class,
  14. Commands\BookAdjustOne::class,
  15. Commands\BookSpider::class,
  16. Commands\BookUpdate::class,
  17. Commands\BookUpdateOne::class,
  18. Commands\BookTest::class,
  19. Commands\BookAfterSpider::class,
  20. Commands\BookAttr::class,
  21. Commands\YqBook::class,
  22. Commands\channelCpcCode::class,
  23. Commands\updateFromNewYunqi::class,
  24. Commands\CheckOrderStatus::class,
  25. ];
  26. /**
  27. * Define the application's command schedule.
  28. *
  29. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  30. * @return void
  31. */
  32. protected function schedule(Schedule $schedule)
  33. {
  34. //$schedule->command('book:update')->dailyAt('06:00');
  35. //$schedule->command('book:update')->dailyAt('18:00');
  36. $schedule->command('book:update')->hourly()->when(function (){
  37. $now_hour = date('G');
  38. if($now_hour %4 ==0){
  39. return true;
  40. }
  41. return false;
  42. });
  43. //$schedule->command('checkOrderStatus')->everyMinute();
  44. }
  45. }