| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php
- namespace app\v1\controller\advert;
- use app\v1\logic\advert\AgentListLogic;
- use plugin\saiadmin\basic\BaseController;
- use app\v1\logic\advert\AgentSiteLogic;
- use app\v1\logic\advert\MediaListLogic;
- use app\v1\logic\center\GameLogic;
- use app\v1\validate\advert\AgentSiteValidate;
- use plugin\saiadmin\app\logic\system\SystemUserLogic;
- use support\Request;
- use support\Response;
- /**
- * 广告位列表控制器
- */
- class AgentSiteController extends BaseController
- {
- protected $systemUserLogic;
- protected $agentListLogic;
- protected $mediaListLogic;
- protected $gameLogic;
- /**
- * 构造函数
- */
- public function __construct()
- {
- $this->logic = new AgentSiteLogic();
- $this->validate = new AgentSiteValidate;
- parent::__construct();
- $this->systemUserLogic = new SystemUserLogic();
- $this->agentListLogic = new AgentListLogic();
- $this->mediaListLogic = new MediaListLogic();
- $this->gameLogic = new GameLogic();
- }
- /**
- * 数据列表
- * @param Request $request
- * @return Response
- */
- public function index(Request $request): Response
- {
- $where = $request->more([
- ['media_id', ''],
- ['agent_id', ''],
- ['auth_id', ''],
- ['name', ''],
- ['id', ''],
- ['agent_name', ''],
- ]);
- if(!empty($where['agent_name'])){
- $agentIds = $this->agentListLogic->where([
- ['name', 'like', '%'.$where['agent_name'].'%']
- ])->column('id');
- if($agentIds){
- $where['agent_id'] = $agentIds;
- }
- unset($where['agent_name']);
- }
- $query = $this->logic->search($where);
- $data = $this->logic->getList($query);
- $data['data'] = $this->logic->trandformListColumn($data['data'],['agent','media','auth']);
- return $this->success($data);
- }
- /**
- * 获取头条账号
- */
- public function getTtAccountOptions(Request $request): Response
- {
- $data = $this->logic->getTtAccountList();
- return $this->success($data);
- }
- /**
- * 导出分包标识数据
- * @param Request $request
- * @return Response
- */
- public function exportGamePackageKs(Request $request): Response
- {
- $data = $request->post();
- return $this->logic->exportGamePackageKs($data);
-
- }
- /**
- * 头条推送新事件
- * @param Request $request
- * @return Response
- */
- public function ttPushNewEvent(Request $request): Response
- {
- $data = $request->post();
- $this->logic->ttPushNewEvent($data);
- return $this->success();
- }
- /**
- * 联调生成参数
- */
- public function linkDebugGenerateParams(Request $request): Response
- {
- $data = $request->more([
- ['game_id', ''],
- ['agent_id', ''],
- ['site_id', ''],
- ['media_id', ''],
- ]);
- // 请求平台游戏详情
- $game = $this->gameLogic->read($data['game_id']);
- $result = $this->logic->linkDebugGenerateParams($game,$data);
- return $this->success($result);
- }
- }
|