Query.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkAdmin
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://demo.thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
  12. // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
  13. // +----------------------------------------------------------------------
  14. namespace app\admin\queue\task;
  15. use library\command\Task;
  16. use think\console\Input;
  17. use think\console\Output;
  18. /**
  19. * 查询正在执行中的进程PID信息
  20. * Class Query
  21. * @package app\admin\queue\task
  22. */
  23. class Query extends Task
  24. {
  25. /**
  26. * 指令属性配置
  27. */
  28. protected function configure()
  29. {
  30. $this->setName('xtask:query')->setDescription('[控制]查询正在执行的所有任务进程');
  31. }
  32. /**
  33. * 执行相关进程查询
  34. * @param Input $input
  35. * @param Output $output
  36. * @return int|void|null
  37. */
  38. protected function execute(Input $input, Output $output)
  39. {
  40. $this->cmd = "{$this->bin} xtask:";
  41. if (count($this->queryProcess()) < 1) {
  42. $output->writeln('没有查询到相关任务进程');
  43. } else foreach ($this->queryProcess() as $item) {
  44. $output->writeln("{$item['pid']}\t{$item['cmd']}");
  45. }
  46. }
  47. }