input('gameid'); // 游戏ID $channel_id = $this->input('channel_id'); // 渠道ID $channel_version = $this->input('channel_version', ''); // 游戏的强更号 if ( empty($game_id) ) { $this->jsonResult('', 0, '游戏ID不能为空'); } elseif ( empty($channel_id) ) { $this->jsonResult('', 0, '渠道ID不能为空'); } elseif ( empty($channel_version) ) { $this->jsonResult('', 0, '游戏的强更号不能为空'); } // 返回内容 $result = [ 'notify' => [], // 公告详情 'status' => false, // // 状态:true=强更、false=弹框提醒 'url' => "", // 强更地址 ]; $sdkGameModel = new SdkGameList; $fbInfo = $sdkGameModel->where(['channel_id' => $channel_id, 'gameid' => $game_id])->field('id,filename,channel_version,upload_status')->find(); if(!$fbInfo){ $this->jsonResult('', 0, '分包数据不存在!'); } $gameModel = new Game; $gameInfo = $gameModel->where(['id' => $game_id])->field('id,type,pinyin,channel_version')->find(); if(!$gameInfo){ $this->jsonResult('', 0, '游戏不存在!'); } $newVersion = false; // 客户端已是最新版本 则只 显示公告 if($channel_version >= $gameInfo['channel_version']){ $newVersion = true; } // 查询最新的公告&强更 $ggInfo = Db::table('cy_game_notify')->field('id,title,content,notify_type') ->where(['status' => 1, 'game_id' => $game_id, 'notify_type' => 1]) ->where('(end_time>0 AND end_time>'.NOW_TIMESTAMP.') or (end_time=0)') ->where('(deny_type=0 AND denied_channel not like :channelid1 and denied_channel not like :channelid2) or (deny_type=1 AND (denied_channel like :channelid3 or denied_channel like :channelid4))',['channelid1'=>$channel_id.',%', 'channelid2'=>'%,'.$channel_id.',%','channelid3'=>$channel_id.',%', 'channelid4'=>'%,'.$channel_id.',%']) ->order('create_time desc') ->find(); $qgInfo = Db::table('cy_game_notify')->field('id,title,content,notify_type') ->where(['status' => 1, 'game_id' => $game_id, 'notify_type' => 3]) ->where('(end_time>0 AND end_time>'.NOW_TIMESTAMP.') or (end_time=0)') ->where('(deny_type=0 AND denied_channel not like :channelid1 and denied_channel not like :channelid2) or (deny_type=1 AND (denied_channel like :channelid3 or denied_channel like :channelid4))',['channelid1'=>$channel_id.',%', 'channelid2'=>'%,'.$channel_id.',%','channelid3'=>$channel_id.',%', 'channelid4'=>'%,'.$channel_id.',%']) ->order('create_time desc') ->find(); if(!$ggInfo && !$qgInfo){ $this->jsonResult($result, 1, "无"); } // 已是最新版本则只显示公告 if($newVersion || !$qgInfo){ // 没有公告则不显示 if(!$ggInfo){ $this->jsonResult($result, 1, "无"); } $ggInfo['content'] = '' . $ggInfo['content']; $result['notify'] = [$ggInfo]; // 加meta标签,使ios中的wkwebview字体正常 $this->jsonResult($result, 1, "已是最新版本"); } // 没有强更则无 if($fbInfo['upload_status'] != 1 || !$qgInfo){ $this->jsonResult($result, 1, "无"); } // 获取强更包数据 if($gameInfo['type'] == 2){ // 安卓 if($fbInfo && isset($fbInfo['filename'])){ $result['url'] = APK_DOWN_DOMAIN.'/sygame/'.$gameInfo['pinyin'].'/'.$fbInfo['filename']; } }elseif($gameInfo['type'] == 1){ // IOS $shortModel = new PromotionShortLink; $shortInfo = $shortModel->where(['channel_id' => $channel_id, 'game_id' => $game_id])->field('id,short_link')->find(); if($shortInfo){ $result['url'] = $shortInfo['short_link']?T_DOMAIN.'/'.$shortInfo['short_link']:''; } } if(!$result['url']){ $this->jsonResult($result, 1, "无"); } $result['status'] = true; $qgInfo['content'] = '' . $qgInfo['content']; $result['notify'] = [$qgInfo]; $this->jsonResult($result, 1, '获取成功!'); } private function getMergeDatas($gameid, $uid, $channel_id) { $now = time(); $result = Db::table('cy_game_notify')->alias('cn') ->join('cy_game_notify_relation r', 'cn.id = r.notify_id', 'INNER') // 核心合并:通过 OR 逻辑,一次性关联渠道或用户的黑白名单记录 ->join('cy_game_notify_deny d', "cn.id = d.notify_id AND d.deny_type = cn.deny_type AND ( (cn.data_type = 1 AND d.target_type = 1 AND d.target_id = {$channel_id}) OR (cn.data_type = 2 AND d.target_type = 2 AND d.target_id = {$uid}) )", 'LEFT') ->where('cn.status', 1) ->where('r.game_id', $gameid) ->where('cn.data_type', 'in', [1, 2]) // 同时查渠道和用户公告 // 1. 时间过滤 (保持不变) ->where(function ($query) use ($now) { $query->where('cn.notify_type', '<>', 4) ->whereOr(function ($q2) use ($now) { $q2->where('cn.notify_type', 4) ->where('cn.begin_time', '<=', $now) ->where('cn.end_time', '>=', $now); }); }) // 2. 黑白名单判定 (保持不变) ->where(function ($query) { $query->where(function ($q_black) { $q_black->where('cn.deny_type', 0)->where('d.id', 'NULL'); })->whereOr(function ($q_white) { $q_white->where('cn.deny_type', 1)->where('d.id', 'NOT NULL'); }); }) // 直接按 ID 倒序,取最新的一条即可 ->order('cn.id desc') ->find(); return $result ?: null; } /** * 获取合并后的强更&公告数据 * * @param $gameid * @param $uid * @param $channel_id * * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ private function getMergeData($gameid, $uid, $channel_id) { $now = time(); // --- 基础查询条件(复用) --- $baseQuery = Db::table('cy_game_notify')->alias('cn') ->join('cy_game_notify_relation r', 'cn.id = r.notify_id', 'INNER') ->join('cy_game_notify_deny d', "cn.id = d.notify_id AND d.deny_type = cn.deny_type AND ( (cn.data_type = 1 AND d.target_type = 1 AND d.target_id = {$channel_id}) OR (cn.data_type = 2 AND d.target_type = 2 AND d.target_id = {$uid}) )", 'LEFT') ->where('cn.status', 1) ->where('r.game_id', $gameid) // 黑白名单逻辑 ->where(function ($query) { $query->where(function ($q_black) { $q_black->where('cn.deny_type', 0)->where('d.id', 'NULL'); })->whereOr(function ($q_white) { $q_white->where('cn.deny_type', 1)->where('d.id', 'NOT NULL'); }); }); // --- 1. 获取最新的【强更公告】 (notify_type = 3) --- $forceUpdate = (clone $baseQuery) ->where('cn.notify_type', 3) ->order('cn.id desc') ->find(); // --- 2. 获取最新的【普通公告】 (notify_type = 1 或 4) --- $normalNotify = (clone $baseQuery) ->field('cn.*') ->where('cn.notify_type', 'in', [1, 4]) // 针对时效性公告(4)的额外时间判断 ->where(function ($query) use ($now) { $query->where('cn.notify_type', 1) // 类型1直接过 ->whereOr(function ($q2) use ($now) { $q2->where('cn.notify_type', 4) // 类型4查有效期 ->where('cn.begin_time', '<=', $now) ->where('cn.end_time', '>=', $now); }); }) ->order('cn.id desc') // 在1和4中取最新的那一条 ->find(); // --- 3. 合并返回 --- $finalList = []; if ($forceUpdate) { $forceUpdate['priority_weight'] = 1; // 强更优先级最高 $finalList['qg'] = $forceUpdate; } if ($normalNotify) { $normalNotify['priority_weight'] = 2; // 普通公告次之 $finalList['gg'] = $normalNotify; } return $finalList; } /** * 强更&公共&分包更新 - v2 * * 相关需求: * 1. 玩家当前版本不是最新版本时,以强更显示为主。 * 2. 有强更时候显示强更,有公告时候显示公告,无则不显示。 * 3. 客户端如果是强更,则每次打开游戏都要判断。 * 4. 检测客户端是否最新版本,返回相关展示状态。 * * 强更判断: * 1. 根据‘游戏版本’对比‘分包版本’确认是否强更; * 2. 根据客户端‘游戏版本’对比‘分包版本’,确认是否最新版本; * * 弹框优先级:强更》公告》时效公告; * * TODO: 想要强更,则游戏版本号大于当前客户端版本号 * * @return void * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function index_v2(){ $game_id = $this->input('gameid'); // 游戏ID $channel_id = $this->input('channel_id'); // 渠道ID $channel_version = $this->input('channel_version', ''); // 游戏的强更号 if ( empty($game_id) ) { $this->jsonResult('', -100, '游戏ID不能为空'); } elseif ( empty($channel_id) ) { $this->jsonResult('', -100, '渠道ID不能为空'); } elseif ($channel_version === '') { $this->jsonResult('', -100, '游戏的强更号不能为空'); } $gameModel = new Game; $gameInfo = $gameModel->where(['id' => $game_id])->field('id,type,pinyin,channel_version')->find(); if(!$gameInfo){ $this->jsonResult('', -102, '游戏不存在!'); } // 返回结构定义 // 弹框优先级:强更》公告》时效公告; $result = [ 'notify' => [], // 公告详情 'type' => 0, // 类型:0=无、1=公告、2=广告、3=强更、4=时效性公告; 'status' => 0, // 状态:0=无、1=已是最新版本(无用)、2=已是最新版本(可以强更)、3=获取最新分包(请求分包)、4=分包更新中(请求中)、5=分包失败(重新提交分包) 'url' => "", // 强更地址(强更时才返回) 'ext' => [ 'game_version' => $gameInfo['channel_version'], 'channel_version' => "", 'client_version' => $channel_version, ] ]; // TODO: 手动设置游戏版本,方便测试强更 // if($this->input('imeil', '') == '00000000-2204-e204-ffff-ffffef05ac4a'){ // $gameInfo['channel_version'] = 45; // } // 客户端已是最新版本 则只 显示公告 if($channel_version >= $gameInfo['channel_version']){ $result['status'] = 1; } // 查询最新的 公告&强更&部分玩家 $userid = $this->input('userid', ''); $getMergeList = $this->getMergeData($game_id, $userid, $channel_id); if (!$getMergeList) { $result['status'] = 0; $this->jsonResult($result, 1, "暂无公告!"); } // dump($getMergeList); // 强更 $getMergeData = $getMergeList['qg']??[]; if($result['status'] == 1 && !empty($getMergeList['gg'])){ // 公告 $getMergeData = $getMergeList['gg']; $notidyData['id'] = $getMergeData['id']; if($getMergeData['notify_type'] == 4){ $notidyData['id'] = time(); } $result['type'] = $getMergeData['notify_type']; $notidyData['title'] = $getMergeData['title']; // 加meta标签,使ios中的wkwebview字体正常 $notidyData['content'] = '' . $getMergeData['content']; $result['notify'] = [$notidyData]; $this->jsonResult($result, 1, "有新公告!"); } if(!$getMergeData || $result['status'] == 1){ $result['status'] = 0; $this->jsonResult($result, 1, "暂无公告!"); } // ## 强更逻辑处理开始 ## $sdkGameModel = new SdkGameList; $fbInfo = $sdkGameModel->where(['channel_id' => $channel_id, 'gameid' => $game_id])->field('id,filename,channel_version,upload_status')->find(); if(!$fbInfo){ $this->jsonResult($result, 1, '分包数据不存在!'); } $result['ext']['channel_version'] = $fbInfo['channel_version']; // 有强更则判断是否最新包,是否可以强更 // status = 状态:0=无、1=已是最新版本(无用)、2=已是最新版本(可以强更)、3=获取最新分包(请求分包)、4=分包更新中(请求中)、5=分包失败(重新提交分包) if($fbInfo['upload_status'] == 1 && $fbInfo['channel_version'] == $gameInfo['channel_version']){ // 可以强更 $result['status'] = 2; } elseif ($fbInfo['upload_status'] == 4){ // 分包中 $result['status'] = 4; } elseif ($fbInfo['upload_status'] == 5){ // 分包失败 $result['status'] = 5; } else { $result['status'] = 3; } if($fbInfo['upload_status'] == 1 && $gameInfo['channel_version'] > $fbInfo['channel_version']){ // 主动分包条件:分包>客户端、游戏>分包、游戏>客户端 $result['status'] = 4; $subChannel = new SubChannel; // $platform = $gameInfo['type']==1?1:0; // 设备类型:1=ios、2=安卓、3=h5 $subChannelRes = $subChannel->index($channel_id, $game_id, 'ydd_fb',$gameInfo['type'],0); if($subChannelRes['code'] === 0){ $sdkGameModel->save(['upload_status' => 4, 'update_time' => time()], ['channel_id' => $channel_id, 'gameid' => $game_id]); }else{ $result['status'] = 5; } } // 获取强更数据 if($result['status'] == 2){ // $result['game_type'] = $gameInfo['type']; if($gameInfo['type'] == 2){ // 安卓 if($fbInfo && isset($fbInfo['filename'])){ $result['url'] = APK_DOWN_DOMAIN_NEW.'/sygame/'.$gameInfo['pinyin'].'/'.$fbInfo['filename']; } }elseif($gameInfo['type'] == 1){ // IOS $shortModel = new PromotionShortLink; $shortInfo = $shortModel->where(['channel_id' => $channel_id, 'game_id' => $game_id])->field('id,short_link')->find(); if($shortInfo){ $result['url'] = $shortInfo['short_link']?T_DOMAIN.'/'.$shortInfo['short_link']:''; } } // TODO:H5分包地址(没有分包,不用处理) if(!$result['url']){ $result['status'] = 3; } } $result['type'] = 3; $notidyData['id'] = $getMergeData['id']; $notidyData['title'] = $getMergeData['title']; $notidyData['content'] = '' . $getMergeData['content']; $result['notify'] = [$notidyData]; // status = 状态:0=无、1=已是最新版本(无用)、2=已是最新版本(可以强更)、3=获取最新分包(请求分包)、4=分包更新中(请求中)、5=分包失败(重新提交分包) $msg = '可更新!'; switch ($result['status']){ case 1: $msg = '已是最新包'; break; case 2: $msg = '下载最新包'; break; case 3: $msg = '获取最新包'; break; case 4: $msg = '分包处理中,请稍后...'; break; case 5: $msg = isset($subChannelRes['msg'])?'分包失败:'.$subChannelRes['msg']:'分包失败'; break; } $this->jsonResult($result, 1, $msg); } // 强更公告&公共&分包更新 - v3 public function index_v3(){ $game_id = $this->input('gameid'); // 游戏ID $channel_id = $this->input('channel_id'); // 渠道ID(客户端传入) // $channel_id = $this->input('member_channel_id'); // 渠道ID(当前账户所属渠道) $channel_version = $this->input('channel_version', ''); // 游戏的强更号 $userId = $this->input('userid', ''); // 当前用户ID if ( empty($game_id) ) { $this->jsonResult('', -100, '游戏ID不能为空'); } elseif ( empty($channel_id) ) { $this->jsonResult('', -100, '渠道ID不能为空'); } elseif ($channel_version === '') { $this->jsonResult('', -100, '游戏的强更号不能为空'); } $gameModel = new Game; $gameInfo = $gameModel->where(['id' => $game_id])->field('id,type,pinyin,channel_version')->find(); if(!$gameInfo){ $this->jsonResult('', -102, '游戏不存在!'); } $channelId = $channel_id; // 当前渠道ID $now = time(); // ## 返回结构定义 // 弹框优先级:强更》公告》时效公告; $result = [ // 'type' => 0, // 类型:0=无、1=公告、2=广告、3=强更、4=时效性公告; // 强更公告详情 'notify_qg' => [ 'status' => 0, // 状态:0=无、1=已是最新版本(无用)、2=已是最新版本(可以强更)、3=获取最新分包(请求分包)、4=分包更新中(请求中)、5=分包失败(重新提交分包) 'url' => '', // 强更地址(强更时才返回) 'msg' => '', // 提示信息{当前状态的说明。例如:status = 状态:0=无、1=已是最新版本(正常)、2=已是最新版本(获取下载地址)、3=获取最新分包(客户端请求分包接口)、4=分包更新中(请求中)、5=分包失败(重新提交分包)} // 强更公告详情 'id' => '', 'title' => '', 'content' => '', ], // 单次公告详情 'notify_dc' => [ 'status' => 0, 'url' => '', 'msg' => '', // 强更公告详情 'id' => '', 'title' => '', 'content' => '', ], // 时效公告详情 'notify_sx' => [ 'status' => 0, 'url' => '', 'msg' => '', // 强更公告详情 'id' => '', 'title' => '', 'content' => '', ], // 扩展参数 'ext' => [ 'game_version' => $gameInfo['channel_version'], // 游戏最新版本号 'channel_version' => "", // 分包版本号 'client_channel_version' => $channel_version, // 客户端传入的版本号 ] ]; // ================= 2. 第一步:获取所有符合资格的 ID 列表 ================= // 这一步不做分组,只负责把“不能看的”全部剔除,剩下的按时间倒序 $candidates = Db::table('cy_game_notify')->alias('cn') ->join('cy_game_notify_relation r', 'cn.id = r.notify_id', 'INNER') // 关键点:动态 JOIN 黑白名单表 // 意思:如果公告是渠道类型(1),就匹配渠道ID;如果公告是用户类型(2),就匹配用户ID // 并且还要求 黑白名单记录的类型(deny_type) 必须和主表一致,防止脏数据 ->join('cy_game_notify_deny d', "cn.id = d.notify_id AND d.deny_type = cn.deny_type AND ( (cn.data_type = 1 AND d.target_type = 1 AND d.target_id = {$channelId}) OR (cn.data_type = 2 AND d.target_type = 2 AND d.target_id = {$userId}) )", 'LEFT') ->where('cn.status', 1) // 状态开启 ->where('r.game_id', $game_id) // 必须是当前游戏 // 1. 时间筛选逻辑 (保持不变) ->where(function ($query) use ($now) { $query->where('cn.notify_type', '<>', 4) // 非时效性 ->whereOr(function ($q2) use ($now) { $q2->where('cn.notify_type', 4) // 时效性 ->where('cn.begin_time', '<=', $now) ->where('cn.end_time', '>=', $now); }); }) // 2. 黑白名单筛选逻辑 (根据 JOIN 的结果判断) ->where(function ($query) { // 场景A:黑名单模式 (deny_type=0)。要求:关联表 d 必须没有记录 (IS NULL) $query->where(function ($q_black) { $q_black->where('cn.deny_type', 0)->where('d.id', 'NULL'); }) // 场景B:白名单模式 (deny_type=1)。要求:关联表 d 必须有记录 (IS NOT NULL) ->whereOr(function ($q_white) { $q_white->where('cn.deny_type', 1)->where('d.id', 'NOT NULL'); }); }) // 只取 ID 和 类型,按创建时间倒序(最新的排前面) ->field('cn.id, cn.notify_type') ->order('cn.create_time desc') ->select(); // ================= 3. PHP 内存分组 (替代 GROUP BY) ================= // 因为上面已经按时间倒序了,所以每个类型拿到的第一个,绝对是“最新且有效”的 $validIds = []; $seenTypes = []; foreach ($candidates as $item) { $type = $item['notify_type']; if (!in_array($type, $seenTypes)) { $validIds[] = $item['id']; // 只要第一个(最新的) $seenTypes[] = $type; // 标记该类型已存在 } } if (empty($validIds)) { $this->jsonResult($result, 1, "获取成功!"); } // ================= 4. 最后一步:查详情 ================= $notifyResult = Db::table('cy_game_notify')->alias('cn') ->field('cn.*') // 查出所有字段 // 自定义排序权重:强更(3)>单次(1)>时效(4)>广告(2) ->field("(CASE cn.notify_type WHEN 3 THEN 1 WHEN 1 THEN 2 WHEN 4 THEN 3 ELSE 4 END) AS sort_weight") ->whereIn('cn.id', $validIds) ->order('sort_weight ASC') ->select(); $newList = array_column($notifyResult, null, 'notify_type'); // ## 获取强更公告 $notieQg = isset($newList[3]) ? $newList[3] : []; if($notieQg){ // 状态:0=无、1=已是最新版本(无用)、2=已是最新版本(可以强更)、3=获取最新分包(请求分包)、4=分包更新中(请求中)、5=分包失败(重新提交分包) $fbStatus = 1; $sdkGameModel = new SdkGameList; $fbInfo = $sdkGameModel->where(['channel_id' => $channel_id, 'gameid' => $gameInfo['id']])->field('id,filename,channel_version,upload_status,status')->find(); if(!$fbInfo){ $this->jsonResult($result, -120, '分包数据不存在!'); } if($fbInfo['status'] === 0){ $this->jsonResult($result, -121, '当前渠道已禁用,无法分包,请联系商务!'); } $result['ext']['channel_version'] = $fbInfo['channel_version']; if($channel_version != $fbInfo['channel_version'] || $fbInfo['channel_version'] != $gameInfo['channel_version']){ // 主动分包条件:分包和游戏包版本号不一致 if($fbInfo['channel_version'] != $gameInfo['channel_version']){ $fbStatus = 4; $subChannel = new SubChannel; $subChannelRes = $subChannel->index($channel_id, $game_id, 'ydd_fb',$gameInfo['type'],0); if($subChannelRes['code'] === 0){ $sdkGameModel->save(['upload_status' => 4, 'update_time' => time()], ['channel_id' => $channel_id, 'gameid' => $game_id]); }else{ $fbStatus = 5; } }else{ // 获取分包数据条件:客户端包合分包版本号不一致 if($channel_version != $fbInfo['channel_version']){ $fbStatus = 2; if($gameInfo['type'] == 2){ // 安卓 if($fbInfo && isset($fbInfo['filename'])){ $result['notify_qg']['url'] = APK_DOWN_DOMAIN_NEW.'/sygame/'.$gameInfo['pinyin'].'/'.$fbInfo['filename']; } }elseif($gameInfo['type'] == 1){ // IOS $shortModel = new PromotionShortLink; $shortInfo = $shortModel->where(['channel_id' => $channel_id, 'game_id' => $game_id])->field('id,short_link')->find(); if($shortInfo){ $result['notify_qg']['url'] = $shortInfo['short_link']?T_DOMAIN.'/'.$shortInfo['short_link']:''; } } } } $msg = '可更新!'; switch ($fbStatus){ case 1: $msg = '已是最新包'; break; case 2: $msg = '下载最新包'; break; case 3: $msg = '获取最新包'; break; case 4: $msg = '分包处理中,请稍后...'; break; case 5: $msg = isset($subChannelRes['msg'])?'分包失败:'.$subChannelRes['msg']:'分包失败'; break; } $result['notify_qg']['status'] = $fbStatus; $result['notify_qg']['msg'] = $msg; $result['notify_qg']['id'] = $notieQg['id']??''; $result['notify_qg']['title'] = $notieQg['title']??''; $result['notify_qg']['content'] = '' . $notieQg['content']??''; } } // ## 获取单次公告 $notieDc = isset($newList[1]) ? $newList[1] : []; if($notieDc){ $result['notify_dc']['id'] = $notieDc['id']??''; $result['notify_dc']['title'] = $notieDc['title']??''; $result['notify_dc']['content'] = '' . $notieDc['content']??''; } // ## 获取时效公告 $notieSx = isset($newList[4]) ? $newList[4] : []; if($notieSx){ $result['notify_sx']['id'] = $notieSx['id']??''; $result['notify_sx']['title'] = $notieSx['title']??''; $result['notify_sx']['content'] = '' . $notieSx['content']??''; } $this->jsonResult($result, 1, "获取成功!"); } // 申请最新游戏包分包 public function getPackage(){ $game_id = $this->input('gameid'); // 游戏ID $channel_id = $this->input('channel_id'); // 渠道ID $channel_version = $this->input('channel_version', ''); // 游戏的强更号 $sdkGameModel = new SdkGameList; $fbInfo = $sdkGameModel->where(['channel_id' => $channel_id, 'gameid' => $game_id])->field('id,filename,channel_version,upload_status')->find(); if(!$fbInfo){ $this->jsonResult('', 0, '分包数据不存在!'); } if ($fbInfo['upload_status'] == 4){ $this->jsonResult('', 1, '分包中...'); } $gameModel = new Game; $gameInfo = $gameModel->where(['id' => $game_id])->field('id,type,pinyin,channel_version')->find(); if(!$gameInfo){ $this->jsonResult('', 0, '游戏不存在!'); } // 客户端已是最新版本 则只 显示公告 if($channel_version >= $gameInfo['channel_version']){ $this->jsonResult('', 1, '已是最新版本!'); } $subChannel = new SubChannel; // $platform = $gameInfo['type']==1?1:0; // 设备类型:1=ios、2=安卓、3=h5 $subChannelRes = $subChannel->index($channel_id, $game_id, 'ydd_fb',$gameInfo['type'],0); if($subChannelRes['code'] === 0){ $sdkGameModel->save(['upload_status' => 4, 'update_time' => time()], ['channel_id' => $channel_id, 'gameid' => $game_id]); $this->jsonResult('', 1, '提交成功!'); }else{ $this->jsonResult('', 0, '提交失败!'); } } }