| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- namespace app\v1\controller;
- use app\v1\logic\advert\AgentListLogic;
- use app\v1\logic\advert\MediaListLogic;
- use app\v1\logic\center\GameLogic;
- use plugin\saiadmin\basic\BaseController;
- use app\v1\logic\center\GameMainLogic;
- use plugin\saiadmin\app\logic\system\SystemUserLogic;
- use support\Request;
- use support\Response;
- /**
- * 公共接口管理控制器
- */
- class CommonController extends BaseController
- {
- protected $gameMainLogic;
- protected $gameLogic;
- protected $mediaListLogic;
- protected $agentListLogic;
- protected $systemUserLogic;
- /**
- * 构造函数
- */
- public function __construct()
- {
- parent::__construct();
- $this->gameMainLogic = new GameMainLogic();
- $this->gameLogic = new GameLogic();
- $this->mediaListLogic = new MediaListLogic();
- $this->agentListLogic = new AgentListLogic();
- $this->systemUserLogic = new SystemUserLogic();
- }
-
- /**
- * 获取主游戏options列表
- * @return Response
- */
- public function getMainGameOptions(Request $request): Response
- {
- $data = $this->gameMainLogic->getMainGameOptions();
- return $this->success($data);
- }
- /**
- * 获取子游戏options列表
- * @return Response
- */
- public function getGameOptions(Request $request): Response
- {
- $where = $request->get();
- $data = $this->gameLogic->getGameOptions($where);
- return $this->success($data);
- }
- /**
- * 获取树形游戏options列表
- * @return Response
- */
- public function getTreeGameOptions(Request $request): Response
- {
- $where = $request->get();
- $data = $this->gameLogic->getGameListByPermission($where);
- return $this->success($data);
- }
- /**
- * 查询媒体列表Options
- */
- public function getMediaOptions(Request $request): Response
- {
- $data = $this->mediaListLogic->getMediaOptions();
- $data = $data->toArray();
- $data = array_map(function ($item) {
- return [
- 'label' => $item['name'].'【' . $item['id'] . '】',
- 'value' => $item['id'],
- ];
- }, $data);
- return $this->success($data);
- }
- /**
- * 查询渠道列表Options
- */
- public function getAgentOptions(Request $request): Response
- {
- $data = $this->agentListLogic->getAgentOptions();
- return $this->success($data);
- }
- /**
- * 后台归属人列表Options
- */
- public function getAuthOptions(Request $request): Response
- {
- $data = $this->systemUserLogic->field('id as value, username as label')->select()->toArray();
- return $this->success($data);
- }
- }
|