DemoTime.php 722 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\task\time;
  3. use app\job\DemoJob;
  4. use app\task\Kernel;
  5. use app\utils\Queue;
  6. use think\console\Command;
  7. use think\console\Input;
  8. use think\console\Output;
  9. /**
  10. * 定时任务管理器
  11. * 业务代码执行时间过长,会造成堵塞,请合理安排执行任务
  12. * Class Kernel
  13. * @package app\task
  14. */
  15. class DemoTime extends Command{
  16. protected function configure()
  17. {
  18. $this->setName('DemoTime')->setDescription('Here is the remark ');
  19. }
  20. // 业务代码 业务代码执行时间过长,会造成堵塞,请合理安排执行任务
  21. protected function execute(Input $input, Output $output)
  22. {
  23. Queue::work(DemoJob::class,['a' => 1]);
  24. return 0;
  25. }
  26. }