AgentSiteController.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | saiadmin [ saiadmin快速开发框架 ]
  4. // +----------------------------------------------------------------------
  5. // | Author: your name
  6. // +----------------------------------------------------------------------
  7. namespace app\v1\controller\advert;
  8. use app\v1\logic\advert\AgentListLogic;
  9. use plugin\saiadmin\basic\BaseController;
  10. use app\v1\logic\advert\AgentSiteLogic;
  11. use app\v1\logic\advert\MediaListLogic;
  12. use app\v1\logic\center\GameLogic;
  13. use app\v1\validate\advert\AgentSiteValidate;
  14. use plugin\saiadmin\app\logic\system\SystemUserLogic;
  15. use support\Request;
  16. use support\Response;
  17. /**
  18. * 广告位列表控制器
  19. */
  20. class AgentSiteController extends BaseController
  21. {
  22. protected $systemUserLogic;
  23. protected $agentListLogic;
  24. protected $mediaListLogic;
  25. protected $gameLogic;
  26. /**
  27. * 构造函数
  28. */
  29. public function __construct()
  30. {
  31. $this->logic = new AgentSiteLogic();
  32. $this->validate = new AgentSiteValidate;
  33. parent::__construct();
  34. $this->systemUserLogic = new SystemUserLogic();
  35. $this->agentListLogic = new AgentListLogic();
  36. $this->mediaListLogic = new MediaListLogic();
  37. $this->gameLogic = new GameLogic();
  38. }
  39. /**
  40. * 数据列表
  41. * @param Request $request
  42. * @return Response
  43. */
  44. public function index(Request $request): Response
  45. {
  46. $where = $request->more([
  47. ['media_id', ''],
  48. ['agent_id', ''],
  49. ['auth_id', ''],
  50. ['name', ''],
  51. ['id', ''],
  52. ['agent_name', ''],
  53. ]);
  54. if(!empty($where['agent_name'])){
  55. $agentIds = $this->agentListLogic->where([
  56. ['name', 'like', '%'.$where['agent_name'].'%']
  57. ])->column('id');
  58. if($agentIds){
  59. $where['agent_id'] = $agentIds;
  60. }
  61. unset($where['agent_name']);
  62. }
  63. $query = $this->logic->search($where);
  64. $data = $this->logic->getList($query);
  65. $data['data'] = $this->logic->trandformListColumn($data['data'],['agent','media','auth']);
  66. return $this->success($data);
  67. }
  68. /**
  69. * 获取头条账号
  70. */
  71. public function getTtAccountOptions(Request $request): Response
  72. {
  73. $data = $this->logic->getTtAccountList();
  74. return $this->success($data);
  75. }
  76. /**
  77. * 导出分包标识数据
  78. * @param Request $request
  79. * @return Response
  80. */
  81. public function exportGamePackageKs(Request $request): Response
  82. {
  83. $data = $request->post();
  84. return $this->logic->exportGamePackageKs($data);
  85. }
  86. /**
  87. * 头条推送新事件
  88. * @param Request $request
  89. * @return Response
  90. */
  91. public function ttPushNewEvent(Request $request): Response
  92. {
  93. $data = $request->post();
  94. $this->logic->ttPushNewEvent($data);
  95. return $this->success();
  96. }
  97. /**
  98. * 联调生成参数
  99. */
  100. public function linkDebugGenerateParams(Request $request): Response
  101. {
  102. $data = $request->more([
  103. ['game_id', ''],
  104. ['agent_id', ''],
  105. ['site_id', ''],
  106. ['media_id', ''],
  107. ]);
  108. // 请求平台游戏详情
  109. $game = $this->gameLogic->read($data['game_id']);
  110. $result = $this->logic->linkDebugGenerateParams($game,$data);
  111. return $this->success($result);
  112. }
  113. }