CommonController.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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\GamePackageLogic;
  6. use app\v1\logic\advert\MediaListLogic;
  7. use app\v1\logic\center\GameGroupLogic;
  8. use app\v1\logic\center\GameLogic;
  9. use plugin\saiadmin\basic\BaseController;
  10. use app\v1\logic\center\GameMainLogic;
  11. use plugin\saiadmin\app\logic\system\SystemUserLogic;
  12. use support\Request;
  13. use support\Response;
  14. use support\think\Db;
  15. /**
  16. * 公共接口管理控制器
  17. */
  18. class CommonController extends BaseController
  19. {
  20. protected $gameMainLogic;
  21. protected $gameLogic;
  22. protected $mediaListLogic;
  23. protected $agentListLogic;
  24. protected $systemUserLogic;
  25. protected $gamePackageLogic;
  26. protected $agentSiteLogic;
  27. protected $gameGroupLogic;
  28. /**
  29. * 构造函数
  30. */
  31. public function __construct()
  32. {
  33. parent::__construct();
  34. $this->gameMainLogic = new GameMainLogic();
  35. $this->gameLogic = new GameLogic();
  36. $this->mediaListLogic = new MediaListLogic();
  37. $this->agentListLogic = new AgentListLogic();
  38. $this->systemUserLogic = new SystemUserLogic();
  39. $this->gamePackageLogic = new GamePackageLogic();
  40. $this->agentSiteLogic = new AgentSiteLogic();
  41. $this->gameGroupLogic = new GameGroupLogic();
  42. }
  43. /**
  44. * 按照权限获取游戏信息,通过游戏分组
  45. */
  46. public function getGameListOptions(Request $request): Response
  47. {
  48. $where = $request->get();
  49. $data = $this->gameGroupLogic->getGameListOptions($where);
  50. return $this->success($data);
  51. }
  52. /**
  53. * 获取主游戏options列表
  54. * @return Response
  55. */
  56. public function getMainGameOptions(Request $request): Response
  57. {
  58. $data = $this->gameMainLogic->getMainGameOptions();
  59. return $this->success($data);
  60. }
  61. /**
  62. * 获取子游戏options列表(有权限)
  63. * @return Response
  64. */
  65. public function getGameOptions(Request $request): Response
  66. {
  67. $where = $request->get();
  68. $data = $this->gameLogic->getGameOptions($where);
  69. return $this->success($data);
  70. }
  71. /**
  72. * 获取子游戏options列表(无权限)
  73. * @return Response
  74. */
  75. public function getGameOptionsNoAuth(Request $request): Response
  76. {
  77. $where = $request->get();
  78. $data = $this->gameLogic->getGameOptionsNoAuth($where);
  79. return $this->success($data);
  80. }
  81. /**
  82. * 获取游戏options列表(有权限)
  83. * @return Response
  84. */
  85. public function getTreeGameOptions(Request $request): Response
  86. {
  87. $where = $request->get();
  88. $data = $this->gameLogic->getGameListByPermission($where);
  89. return $this->success($data);
  90. }
  91. /**
  92. * 获取树形游戏options列表(无权限)
  93. * @return Response
  94. */
  95. public function getGameListTreeNoAuth(Request $request): Response
  96. {
  97. $where = $request->get();
  98. $data = $this->gameLogic->getGameListTreeNoAuth($where);
  99. return $this->success($data);
  100. }
  101. /**
  102. * 获取树形游戏options列表(有权限)
  103. * @return Response
  104. */
  105. public function getGameListTree(Request $request): Response
  106. {
  107. $where = $request->get();
  108. $data = $this->gameLogic->getGameListTree($where);
  109. return $this->success($data);
  110. }
  111. /**
  112. * 查询媒体列表Options
  113. */
  114. public function getMediaOptions(Request $request): Response
  115. {
  116. $data = $this->mediaListLogic->getMediaOptions();
  117. $data = $data->toArray();
  118. return $this->success($data);
  119. }
  120. /**
  121. * 查询渠道列表Options
  122. */
  123. public function getAgentOptions(Request $request): Response
  124. {
  125. $data = $this->agentListLogic->getAgentOptions();
  126. return $this->success($data);
  127. }
  128. /**
  129. * 后台归属人列表Options
  130. */
  131. public function getAuthOptions(Request $request): Response
  132. {
  133. $data = $this->systemUserLogic->field('id as value, username as label')->select()->toArray();
  134. return $this->success($data);
  135. }
  136. /**
  137. * 获取母包列表Options
  138. */
  139. public function getPackageOptions(Request $request): Response
  140. {
  141. $where = $request->get();
  142. $data = $this->gamePackageLogic->getPackageOptions($where);
  143. return $this->success($data);
  144. }
  145. /**
  146. * 获取广告位options
  147. */
  148. public function getAgentSiteOptions(Request $request): Response
  149. {
  150. $data = $this->agentSiteLogic->getAgentSiteOptions();
  151. return $this->success($data);
  152. }
  153. /**
  154. * 获取充值渠道
  155. */
  156. public function getPayChannelOptions(Request $request): Response
  157. {
  158. $data = Db::connect('db_center')->table('pay_channel')->where('status',1)->select()->toArray();
  159. return $this->success($data);
  160. }
  161. /**
  162. * 给游戏分组用的游戏列表
  163. */
  164. public function getGameListOptionsByGroup(Request $request): Response
  165. {
  166. $where = $request->more([
  167. ['game_group_id', '']
  168. ]);
  169. $data = $this->gameGroupLogic->getGameListOptionsByGroup($where);
  170. return $this->success($data);
  171. }
  172. }