123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- namespace api\wapapp\controller\v8;
- use api\common\controller\V2ApiBaseController;
- use huo\controller\game\Game;
- use huo\controller\game\GameList;
- use huo\controller\game\GameServer;
- use huolib\constant\CommonConst;
- use huolib\constant\GameConst;
- class GameController extends V2ApiBaseController {
- public function __construct() {
- parent::__construct();
- }
-
- public function index() {
- $_channel_rq = $this->setChannelData();
- $_device_rq = $this->setDeviceData();
- $_agent_id = $_channel_rq->getAgentId();
- $_page = get_val($this->rq_data, 'page', 1);
- $_offset = get_val($this->rq_data, 'offset', 10);
- $_hot = get_val($this->rq_data, 'hot', 0);
- $_is_single = get_val($this->rq_data, 'is_single', 0);
- $_is_new = get_val($this->rq_data, 'is_new', 0);
- $_remd = get_val($this->rq_data, 'remd', 0);
- $_type = get_val($this->rq_data, 'type', '');
- $_hasgift = get_val($this->rq_data, 'hasgift', 0);
- $_rank_type = get_val($this->rq_data, 'rank_type', 0);
- $_keywords = get_val($this->rq_data, 'keywords', '');
- $_is_fine = get_val($this->rq_data, 'is_fine', 0);
- $_is_rate = get_val($this->rq_data, 'is_rate', 0);
- $_is_bt = get_val($this->rq_data, 'is_bt ', 0);
- $_classify = $_device_rq->getFrom();
- $_page = $_page.','.$_offset;
- if (!empty($_hasgift)) {
- $_datas = (new GameList())->getHasGiftList($_page);
- } elseif (!empty($_rank_type)) {
- $_datas = (new GameList())->getRankList($_rank_type, $_page);
- } else {
- $_param = [];
- !empty($_hot) && $_param['hot'] = $_hot;
- !empty($_is_single) && $_param['is_single'] = $_is_single;
- !empty($_is_new) && $_param['is_new'] = $_is_new;
- !empty($_remd) && $_param['remd'] = $_remd;
- !empty($_type) && $_param['type'] = $_type;
- !empty($_keywords) && $_param['keywords'] = $_keywords;
- !empty($_is_fine) && $_param['is_fine'] = $_is_fine;
- !empty($_classify) && $_param['classify'] = $_classify;
- !empty($_is_rate) && $_param['is_rate'] = $_is_rate;
- !empty($_is_bt) && $_param['is_bt'] = $_is_bt;
- $_rs = (new GameList())->getList($_param, $_page);
- $_datas = isset($_rs['data']) ? $_rs['data'] : [];
- }
- $this->success(lang('SUCCESS'), $_datas);
- }
-
- public function read() {
- $_device_rq = $this->setDeviceData();
- $_app_id = get_val($this->rq_data, 'game_id');
- if (empty($_app_id)) {
- $this->error(lang('app_id is null'));
- }
- $_rs = (new Game())->getDetail($_app_id, $this->mem_id, $_device_rq->getFrom());
- $_data = isset($_rs['data']) ? $_rs['data'] : [];
- $this->success(lang('SUCCESS'), $_data);
- }
-
- public function getServerList() {
- $_page = get_val($this->rq_data, 'page', 1);
- $_offset = get_val($this->rq_data, 'offset', 10);
- $_server_type = get_val($this->rq_data, 'server_type', GameConst::GAME_SERVER_ALL);
- $_app_id = get_val($this->rq_data, 'game_id');
- $_page = $_page.','.$_offset;
- $_device_rq = $this->setDeviceData();
- $_server_list = (new GameList())->getServerList($_server_type, $_device_rq->getFrom(), $_page, $_app_id);
- $this->returnData($_server_list);
- }
-
- public function down() {
- $_channel_rq = $this->setChannelData();
- $_agent_id = $_channel_rq->getAgentId();
- $_app_id = get_val($this->rq_data, 'game_id');
- if (empty($_app_id)) {
- $this->error(lang('app_id is null'));
- }
- $_data = (new Game())->getDownUrl($_app_id, $_agent_id);
- $this->returnData($_data);
- }
- }
|