CommonController.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. namespace app\v1\controller;
  3. use app\v1\logic\advert\AgentListLogic;
  4. use app\v1\logic\advert\AgentSiteLogic;
  5. use app\v1\logic\advert\MediaListLogic;
  6. use app\v1\logic\center\GameLogic;
  7. use plugin\saiadmin\basic\BaseController;
  8. use app\v1\logic\center\GameMainLogic;
  9. use app\v1\logic\gameLog\GamePackageLogic;
  10. use plugin\saiadmin\app\logic\system\SystemUserLogic;
  11. use support\Request;
  12. use support\Response;
  13. /**
  14. * 公共接口管理控制器
  15. */
  16. class CommonController extends BaseController
  17. {
  18. protected $gameMainLogic;
  19. protected $gameLogic;
  20. protected $mediaListLogic;
  21. protected $agentListLogic;
  22. protected $systemUserLogic;
  23. protected $gamePackageLogic;
  24. protected $agentSiteLogic;
  25. /**
  26. * 构造函数
  27. */
  28. public function __construct()
  29. {
  30. parent::__construct();
  31. $this->gameMainLogic = new GameMainLogic();
  32. $this->gameLogic = new GameLogic();
  33. $this->mediaListLogic = new MediaListLogic();
  34. $this->agentListLogic = new AgentListLogic();
  35. $this->systemUserLogic = new SystemUserLogic();
  36. $this->gamePackageLogic = new GamePackageLogic();
  37. $this->agentSiteLogic = new AgentSiteLogic();
  38. }
  39. /**
  40. * 获取主游戏options列表
  41. * @return Response
  42. */
  43. public function getMainGameOptions(Request $request): Response
  44. {
  45. $data = $this->gameMainLogic->getMainGameOptions();
  46. return $this->success($data);
  47. }
  48. /**
  49. * 获取子游戏options列表(有权限)
  50. * @return Response
  51. */
  52. public function getGameOptions(Request $request): Response
  53. {
  54. $where = $request->get();
  55. $data = $this->gameLogic->getGameOptions($where);
  56. return $this->success($data);
  57. }
  58. /**
  59. * 获取子游戏options列表(无权限)
  60. * @return Response
  61. */
  62. public function getGameOptionsNoAuth(Request $request): Response
  63. {
  64. $where = $request->get();
  65. $data = $this->gameLogic->getGameOptionsNoAuth($where);
  66. return $this->success($data);
  67. }
  68. /**
  69. * 获取树形游戏options列表(有权限)
  70. * @return Response
  71. */
  72. public function getTreeGameOptions(Request $request): Response
  73. {
  74. $where = $request->get();
  75. $data = $this->gameLogic->getGameListByPermission($where);
  76. return $this->success($data);
  77. }
  78. /**
  79. * 查询媒体列表Options
  80. */
  81. public function getMediaOptions(Request $request): Response
  82. {
  83. $data = $this->mediaListLogic->getMediaOptions();
  84. $data = $data->toArray();
  85. return $this->success($data);
  86. }
  87. /**
  88. * 查询渠道列表Options
  89. */
  90. public function getAgentOptions(Request $request): Response
  91. {
  92. $data = $this->agentListLogic->getAgentOptions();
  93. return $this->success($data);
  94. }
  95. /**
  96. * 后台归属人列表Options
  97. */
  98. public function getAuthOptions(Request $request): Response
  99. {
  100. $data = $this->systemUserLogic->field('id as value, username as label')->select()->toArray();
  101. return $this->success($data);
  102. }
  103. /**
  104. * 获取母包列表Options
  105. */
  106. public function getPackageOptions(Request $request): Response
  107. {
  108. $where = $request->get();
  109. $data = $this->gamePackageLogic->getPackageOptions($where);
  110. return $this->success($data);
  111. }
  112. /**
  113. * 获取广告位options
  114. */
  115. public function getAgentSiteOptions(Request $request): Response
  116. {
  117. $data = $this->agentSiteLogic->getAgentSiteOptions();
  118. return $this->success($data);
  119. }
  120. }