'加速版', '2' => '跳过版', ]; /** * 初始化操作 */ protected function _initialize() { parent::_initialize(); } /** * 加速游戏 */ public function index(){ $where = [ 'b.is_show' => 1, 'b.cooperation_status' => ['in',[1,2]] ]; $list = Db::connect(config('database_slave'))->table('cy_gameaid')->cache(Config::get('QUERY_RESULT_CACHE_TIME'))->alias('a') ->join('cy_game b','b.id = a.gameid') ->join('cy_gameinfo info', 'b.id=info.game_id', 'left') ->field('a.*,b.nickname,info.mobileicon,b.pinyin') ->where($where) ->order('a.create_time desc') ->paginate(10, false, array('query' => input('get.'))) ->each(function ($item, $key){ $item['filename'] = Db::connect(config('database_slave'))->table('cy_sdkgamelist')->where(['package_type'=>1,'gameid'=>$item['gameid'],'channel_id'=>MEMBER_DEFAULT_CHANNEL_ID])->value('filename'); $item['mobileicon'] = getGameIcon($item['mobileicon']); return $item; }); $adInfo = model('Ad')->getPageAd(); $this->assign('list',$list); $this->assign('type',$this->_type); $this->assign('adInfo',$adInfo); $this->assign('page',$list->render()); return $this->fetch(); } /** * 光环包下载 */ public function download() { $gameModel = new GameModel; $gameid = intval(input('id')); if(!$gameid) { $this->_abort404(); } $detail = $gameModel->cache(Config::get('QUERY_RESULT_CACHE_TIME')) ->alias('game') ->join('cy_gameinfo info', 'game.id = info.game_id','left') ->join('cy_gametype t', 'game.type = t.id','left') ->join('cy_gamesubject s', 'game.subject = s.id','left') ->join('cy_sdkgamelist sdk', 'game.id=sdk.gameid and sdk.package_type=1 and sdk.upload_status=1 and sdk.channel_id='.MEMBER_DEFAULT_CHANNEL_ID,'left') ->field('game.id,game.nickname,game.power,info.androidurl,game.pinyin,info.mobileicon,game.type,game.subject,info.developer,info.bigimage,t.name as typename,s.name as subjectname,info.description,sdk.filename') ->where(['game.id'=>$gameid,'game.cooperation_status' => ['in','0,1,2'],'game.is_show' => 1]) ->find(); if ( empty($detail)) { // throw new Exception("游戏不存在或无效"); $this->_abort404(); } else{ /*$detail['icon'] = getGameIcon($detail['mobileicon']); $detail['size'] = getSize($detail); $detail['version'] = getVersion($detail); $detail['updatetime'] = getUpdateTime($detail);*/ $detail['download'] = getDownload($detail); /* $detail['screenShot'] = getScreenShot($detail['bigimage']); $detail['typename'] = getTypename($detail['typename']); $detail['subjectname'] = getSubjectname($detail['subjectname']); $detail['developer'] = getDeveloper($detail['developer']);*/ } $this->assign('detail',$detail); return $this->fetch(); } }