Kernel.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. Commands\NewVersionPrepare::class,
  26. ];
  27. /**
  28. * Define the application's command schedule.
  29. *
  30. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  31. * @return void
  32. */
  33. protected function schedule(Schedule $schedule)
  34. {
  35. $schedule->command('book:update')->hourly()->when(function () {
  36. $now_hour = date('G');
  37. if ($now_hour % 4 == 0) {
  38. return true;
  39. }
  40. return false;
  41. });
  42. }
  43. }