| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace app\v1\controller\advert;
- use app\v1\logic\advert\AgentListLogic;
- use app\v1\logic\advert\AgentSiteLogic;
- use plugin\saiadmin\basic\BaseController;
- use app\v1\logic\advert\MediaCostLogic;
- use app\v1\logic\center\GameLogic;
- use app\v1\validate\advert\MediaCostValidate;
- use plugin\saiadmin\app\logic\system\SystemUserLogic;
- use support\Request;
- use support\Response;
- /**
- * 媒体消耗控制器
- */
- class MediaCostController extends BaseController
- {
- protected $agentSiteLogic;
- protected $agentListLogic;
- protected $gameLogic;
- protected $systemUserLogic;
- /**
- * 构造函数
- */
- public function __construct()
- {
- $this->logic = new MediaCostLogic();
- $this->validate = new MediaCostValidate;
- parent::__construct();
- $this->agentSiteLogic = new AgentSiteLogic();
- $this->agentListLogic = new AgentListLogic();
- $this->gameLogic = new GameLogic();
- $this->systemUserLogic = new SystemUserLogic();
- }
- /**
- * 数据列表
- * @param Request $request
- * @return Response
- */
- public function index(Request $request): Response
- {
- $where = $request->more([
- ['tdate', ''],
- ['game_id', ''],
- ['media_id', ''],
- ['advertiser_id', ''],
- ['agent_id', ''],
- ['site_id', ''],
- ['auth_id', ''],
- ['add_type', ''],
- ['remark', ''],
- ['create_time', ''],
- ]);
- $query = $this->logic->search($where);
-
-
- // 游戏权限过滤
- if($request->get('auth_game_list')){
- $gameIds = explode(',', $request->get('auth_game_list'));
- $query->whereIn('game_id', $gameIds);
- }
- $data = $this->logic->getList($query)['data'];
- $data = $this->logic->trandformListColumn($data, ['site', 'agent', 'game', 'auth','media']);
-
- return $this->success($data);
- }
- /**
- * 保存媒体消耗
- */
- public function save(Request $request): Response
- {
- $data = $request->post();
- $this->logic->save($data);
- return $this->success();
- }
- }
|