CommonController.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 app\v1\logic\center\GameMainLogic;
  10. use plugin\saiadmin\app\logic\system\SystemUserLogic;
  11. use plugin\saiadmin\basic\BaseController;
  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. */
  84. public function getMediaOptions(Request $request): Response
  85. {
  86. $data = $this->mediaListLogic->getMediaOptions();
  87. $data = $data->toArray();
  88. return $this->success($data);
  89. }
  90. /**
  91. * 查询渠道列表Options
  92. */
  93. public function getAgentOptions(Request $request): Response
  94. {
  95. $data = $this->agentListLogic->getAgentOptions();
  96. return $this->success($data);
  97. }
  98. /**
  99. * 后台归属人列表Options
  100. */
  101. public function getAuthOptions(Request $request): Response
  102. {
  103. $data = $this->systemUserLogic->field('id as value, username as label')->select()->toArray();
  104. return $this->success($data);
  105. }
  106. /**
  107. * 设计归属人列表Options
  108. */
  109. public function getDesignAuthOptions(Request $request): Response
  110. {
  111. $data = $this->systemUserLogic->field('id as value, username as label')->where('dept_id', 11)->select()->toArray();
  112. return $this->success($data);
  113. }
  114. /**
  115. * 获取母包列表Options
  116. */
  117. public function getPackageOptions(Request $request): Response
  118. {
  119. $where = $request->get();
  120. $data = $this->gamePackageLogic->getPackageOptions($where);
  121. return $this->success($data);
  122. }
  123. /**
  124. * 获取广告位options
  125. */
  126. public function getAgentSiteOptions(Request $request): Response
  127. {
  128. $data = $this->agentSiteLogic->getAgentSiteOptions();
  129. return $this->success($data);
  130. }
  131. /**
  132. * 获取充值渠道
  133. */
  134. public function getPayChannelOptions(Request $request): Response
  135. {
  136. $data = Db::connect('db_center')->table('pay_channel')->where('status', 1)->select()->toArray();
  137. return $this->success($data);
  138. }
  139. /**
  140. * 给游戏分组用的游戏列表
  141. */
  142. public function getGameListOptionsByGroup(Request $request): Response
  143. {
  144. $where = $request->more([
  145. ['game_group_id', '']
  146. ]);
  147. $data = $this->gameGroupLogic->getGameListOptionsByGroup($where);
  148. return $this->success($data);
  149. }
  150. }