QueueController.php 945 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace addons\RfDevTool\backend\controllers;
  3. use Yii;
  4. /**
  5. * Class QueueController
  6. * @package addons\RfDevTool\backend\controllers
  7. * @author jianyan74 <751393839@qq.com>
  8. */
  9. class QueueController extends BaseController
  10. {
  11. /**
  12. * 队列ID列表
  13. *
  14. * @var array
  15. */
  16. public $queueList = [
  17. 'queue'
  18. ];
  19. /**
  20. * @return string
  21. */
  22. public function actionInfo()
  23. {
  24. $data = [];
  25. foreach ($this->queueList as $item) {
  26. if ($info = $this->getInfo($item)) {
  27. $data[$item] = $info;
  28. }
  29. }
  30. return $this->render($this->action->id, [
  31. 'data' => $data
  32. ]);
  33. }
  34. /**
  35. * @param string $id
  36. * @return mixed
  37. */
  38. protected function getInfo($id)
  39. {
  40. $command = "cd " . Yii::getAlias('@root') . "&& php yii $id/info";
  41. exec($command, $output);
  42. return $output;
  43. }
  44. }
粤ICP备19079148号