优化推广员统计区服选择

master
chenzhi 5 years ago
parent 6dbfd09e91
commit f580b44289

@ -640,7 +640,7 @@ class PlatformController extends ThinkController
if (isset($_REQUEST['game_name'])) {
$map['s.game_name'] = $_REQUEST['game_name'];
if (isset($_REQUEST['server_id'])) {
$map['s.server_name'] = $_REQUEST['server_id'];
$map['s.server_id'] = $_REQUEST['server_id'];
unset($_REQUEST['server_id']);
}
}
@ -1002,6 +1002,21 @@ class PlatformController extends ThinkController
$this->display();
}
public function getSpendServer(){
if(isset($_REQUEST['game_name'])){
$game = M('Game','tab_')->field('id')->where(['game_name'=>$_REQUEST['game_name']])->find();
$game_id = $game['id'];
}
if(isset($_REQUEST['game_id'])){
$game_id = $_REQUEST['game_id'];
}
$map['game_id'] = $game_id;
$map['server_name'] = array('neq','');
$data = M('server','tab_')->field('server_name,server_id')->where($map)->group('server_name')->select();
$this->AjaxReturn($data);
}
public function uc_deposit($p = 1)
{
if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) {

@ -353,15 +353,17 @@
// endDate:date
})
$("#game_id").change(function(){
console.log($("#game_id option:selected").attr('game-id'));
$.ajax({
url:"{:U('Ajax/getSpendServer')}",
url:"{:U('getSpendServer')}",
type:"post",
data:{game_id:$("#game_id option:selected").attr('game-id')},
dataType:'json',
success:function(data){
console.log(data)
str = "<option value=''>请选择区服</option>";
for (var i in data){
str += "<option value='"+data[i].server_name+"'>"+data[i].server_name+"</option>"
str += "<option value='"+data[i].server_id+"'>"+data[i].server_name+"</option>"
}
$("#server_id").empty();
$("#server_id").append(str);
@ -370,18 +372,20 @@
}
})
});
var game_id = "{:I('game_name')}";
var game_name = "{:I('game_name')}";
var game_server = "{:I('server_id')}";
if(game_id){
if(game_name){
console.log({game_name:game_name})
$.ajax({
url:"{:U('Ajax/getSpendServer')}",
url:"{:U('getSpendServer')}",
type:"post",
data:{game_id:game_id,type:2},
data:{game_name:game_name},
dataType:'json',
success:function(data){
console.log(data)
str = "<option value=''>请选择区服</option>";
for (var i in data){
str += "<option value='"+data[i].server_name+"' "+(game_server && data[i].server_name == game_server?'selected':'')+">"+data[i].server_name+"</option>"
str += "<option value='"+data[i].server_id+"' "+(game_server && data[i].server_id == game_server?'selected':'')+">"+data[i].server_name+"</option>"
}
$("#server_id").empty();
$("#server_id").append(str);

Loading…
Cancel
Save