0
0

QueueController.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: ZhangFeng
  5. * Date: 2018/1/29
  6. * Time: 16:00
  7. * Description:
  8. */
  9. namespace backend\controllers;
  10. use yii\web\Controller;
  11. use common\logic\Queue;
  12. class QueueController extends Controller
  13. {
  14. /**
  15. * 创建队列
  16. */
  17. public function actionCreateQueue()
  18. {
  19. $params = \Yii::$app->request->get();
  20. $queue = new Queue();
  21. $queue->load(['Queue' => $params]);
  22. if ($queue->validate()) {
  23. $res = $queue->createQueue();
  24. echo json_encode(['code' => 200,'message' => 'OK','data' => ['name' => $res]]);
  25. } else {
  26. echo json_encode(['code' => 201,'message' => '']);
  27. }
  28. }
  29. /**
  30. * 删除队列
  31. */
  32. public function actionDeleteQueue()
  33. {
  34. $params = \Yii::$app->request->get();
  35. $queue = new Queue();
  36. $queue->load(['Queue' => $params]);
  37. if ($queue->validate()) {
  38. $res = $queue->deleteQueue();
  39. echo json_encode(['code' => 200,'message' => 'OK','data' => [$res]]);
  40. } else {
  41. }
  42. }
  43. /**
  44. * 获取队列列表
  45. */
  46. public function actionListQueue()
  47. {
  48. $params = \Yii::$app->request->get();
  49. $queue = new Queue();
  50. $queue->load(['Queue' => $params]);
  51. if ($queue->validate()) {
  52. $res = $queue->listQueue();
  53. echo json_encode(['code' => 200,'message' => 'OK','data' => $res]);
  54. } else {
  55. }
  56. }
  57. public function actionSetQueueAttributes()
  58. {
  59. }
  60. }