CommonController.php 2.8 KB

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