优化区服预告的区服选择

master
chenzhi 5 years ago
parent fe06fded2a
commit 24c2ea0031

@ -252,6 +252,36 @@ class ServerNoticeController extends ThinkController {
$this->error($msg.'失败'); $this->error($msg.'失败');
} }
} }
/***
* 获取区服列表
*/
public function getGameServer()
{
$game_name = $_REQUEST['game_name'];
$sdk_version = $_REQUEST['sdk_version'];
$game_map = [];
if ($game_name) {
$game_map['relation_game_name'] = $game_name;
}else {
$this->AjaxReturn([]);
}
if ($sdk_version) {
$map['server_version'] = $game_map['sdk_version'] = $sdk_version;
}else {
$this->AjaxReturn([]);
}
$game = M("Game", 'tab_')->where($game_map)->getField('id', true);
// 获取版本信息
$map = [];
if ($game) {
$map['game_id'] = ['in', $game];
} else {
$map['game_id'] = ['in', [-1]];
}
$data = M('ServerNotice', 'tab_')->field('id, server_name, server_id')->where($map)->group('server_name')->select();
$this->AjaxReturn($data);
}

@ -334,7 +334,7 @@ $(function(){
var game_server = "{:I('server_name')}"; var game_server = "{:I('server_name')}";
$("#game_name").change(function(){ $("#game_name").change(function(){
$.ajax({ $.ajax({
url:"{:U('Ajax/getGmeServer')}", url:"{:U('getGameServer')}",
type:"post", type:"post",
data:{sdk_version:$("#server_version option:selected").val(), game_name:$("#game_name option:selected").val()}, data:{sdk_version:$("#server_version option:selected").val(), game_name:$("#game_name option:selected").val()},
dataType:'json', dataType:'json',

Loading…
Cancel
Save