sdkGameListModel = new SdkGameList; $this->gameModel = new Game; } /** * IOS-热更新 */ public function checkClientUpdate() { $gameId = $this->input('gameid'); //游戏ID $channelId = $this->input('channel_id'); //渠道ID $channelVersion = $this->input('channel_version'); // 游戏版本构造号 $checkResult = $this->validate($this->input, [ ['gameid', 'require|integer', '游戏id不能为空|游戏ID必须为整型'], ['channel_id', 'require|integer', '渠道ID不能为空|渠道ID必须为整型'], ['channel_version', 'require|integer|egt:0', '游戏版本构造号不能为空|游戏版本构造号必须为整型|游戏版本构造号必须为大于等于0的整型'], ]); if (true !== $checkResult) { $this->jsonResult('', 0, $checkResult); } $where =[ 'gameid' => $gameId, 'channel_id' => $channelId, 'upload_status' => 1 ]; $sdkgameInfo = $this->sdkGameListModel->where($where)->field('filename, channel_version')->find(); $gameInfo = $this->gameModel->where(['id' => $gameId])->field('channel_version, pinyin')->find(); $short_link = ''; $update = false; if($channelVersion < $gameInfo['channel_version'] && $sdkgameInfo['channel_version'] >= $gameInfo['channel_version']){ $short_link = db('nw_promotion_short_link')->where(['game_id'=>$gameId,'channel_id'=>$channelId,'package_type'=>0, 'type' => 1])->value('short_link'); if (!empty($short_link)) { $short_link = T_DOMAIN.'/'.$short_link; $update = true; } } $data = [ 'status' => $update, 'url' => $short_link, ]; $this->jsonResult($data , 1, '请求成功!'); } /** * 安卓sdk版本(热更) */ public function version() { $sdkModel = model('common/AndroidSdk'); $sdkInfo = $sdkModel->getLastVersionInfo(); if (! empty($sdkInfo)) { $sdkInfo['status'] = true; // 默认需要强更 $sdkInfo['filename'] = STATIC_DOMAIN.$sdkInfo['filename']; $this->jsonResult($sdkInfo, 1); } else { $this->jsonResult([], 0, '版本不存在'); } } public function setting(){ $this->jsonResult([], 0, '获取成功'); } }