Kernel.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace App\Console;
  3. use App\Console\Commands\Push\HwPushTest;
  4. use App\Console\Commands\Push\MiPushTest;
  5. use App\Console\Commands\Push\OppoPushTest;
  6. use App\Console\Commands\Push\PushTask;
  7. use App\Console\Commands\Push\PushTest;
  8. use Illuminate\Console\Scheduling\Schedule;
  9. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  10. class Kernel extends ConsoleKernel
  11. {
  12. /**
  13. * The Artisan commands provided by your application.
  14. *
  15. * @var array
  16. */
  17. protected $commands = [
  18. MiPushTest::class,
  19. HwPushTest::class,
  20. OppoPushTest::class,
  21. PushTest::class,
  22. PushTask::class,
  23. Commands\BookAdjust::class,
  24. Commands\BookAdjustOne::class,
  25. Commands\BookSpider::class,
  26. Commands\BookUpdate::class,
  27. Commands\BookUpdateOne::class,
  28. Commands\BookTest::class,
  29. Commands\BookAfterSpider::class,
  30. Commands\BookAttr::class,
  31. Commands\YqBook::class,
  32. Commands\channelCpcCode::class,
  33. Commands\updateFromNewYunqi::class,
  34. Commands\CheckOrderStatus::class,
  35. Commands\NewVersionPrepare::class,
  36. ];
  37. /**
  38. * Define the application's command schedule.
  39. *
  40. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  41. * @return void
  42. */
  43. protected function schedule(Schedule $schedule)
  44. {
  45. $schedule->command('book:update')->hourly()->when(function () {
  46. $now_hour = date('G');
  47. if ($now_hour % 4 == 0) {
  48. return true;
  49. }
  50. return false;
  51. });
  52. // 推送任务每分钟执行
  53. $schedule->command('push:task')->everyMinute()->sendOutputTo(storage_path('pushCommand-' . date('Y-m-d')));
  54. }
  55. }