优化玩家列表数据显示规则

master
chenzhi 5 years ago
parent 6ffd20525d
commit 12966e83bd

@ -80,18 +80,17 @@ class MemberController extends ThinkController
if (isset($_REQUEST['viplevel'])) { if (isset($_REQUEST['viplevel'])) {
$havs = get_vip_level_limit('recharge_total', $_REQUEST['viplevel']); $havs = get_vip_level_limit('recharge_total', $_REQUEST['viplevel']);
} }
//1.2 与游戏相关 //1.2 与游戏相关 查询游戏玩家表
$game_map = false; $gameplay =false;
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) { if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
$gameplay = " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
$game_map = " and tab_user_play_info.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
} }
if (isset($_REQUEST['server_name'])) { //查询游戏角色表
if($game_map){ $game_map = false;
$game_map .= " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' "; if (isset($_REQUEST['server_id'])) { //有区服,一定有游戏
}else{ $gameplay =false;
$game_map = " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' "; $game_map = " and tab_user_play_info.server_id = '{$_REQUEST['server_id']}' ";
} $game_map .= " and tab_user_play_info.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
} }
$promoteRoot = getPowerPromoteIds(); $promoteRoot = getPowerPromoteIds();
@ -143,6 +142,11 @@ class MemberController extends ThinkController
if($havs){ if($havs){
$data->having($havs); $data->having($havs);
} }
if($gameplay){
$data->join("
(select user_id from tab_user_play where 1 $gameplay group by tab_user_play.user_id) a ON a.user_id = tab_user.id
");
}
if($game_map){ if($game_map){
$data->join(" $data->join("
(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id (select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id
@ -167,6 +171,11 @@ class MemberController extends ThinkController
(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id (select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id
"); ");
} }
if($gameplay){
$user_count->join("
(select user_id from tab_user_play where 1 $gameplay group by tab_user_play.user_id) a ON a.user_id = tab_user.id
");
}
if($promoterSelect){ if($promoterSelect){
$user_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left"); $user_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left");
}else{ }else{
@ -187,6 +196,11 @@ class MemberController extends ThinkController
(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id (select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id
"); ");
} }
if($gameplay){
$user_count->join("
(select user_id from tab_user_play where 1 $gameplay group by tab_user_play.user_id) a ON a.user_id = tab_user.id
");
}
$user_count = $user_count->find()['user_count']; $user_count = $user_count->find()['user_count'];
//计算累计充值总额 //计算累计充值总额
$now_count = M("user","tab_") $now_count = M("user","tab_")
@ -197,6 +211,11 @@ class MemberController extends ThinkController
(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id (select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id
"); ");
} }
if($gameplay){
$now_count->join("
(select user_id from tab_user_play where 1 $gameplay group by tab_user_play.user_id) a ON a.user_id = tab_user.id
");
}
if($promoterSelect){ if($promoterSelect){
$now_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left"); $now_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left");
}else{ }else{
@ -221,6 +240,11 @@ class MemberController extends ThinkController
if($game_map){ if($game_map){
$history_count->join("(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id"); $history_count->join("(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id");
} }
if($gameplay){
$history_count->join("
(select user_id from tab_user_play where 1 $gameplay group by tab_user_play.user_id) a ON a.user_id = tab_user.id
");
}
$history_count = $history_count->find()['recharge_total']; $history_count = $history_count->find()['recharge_total'];
$this->assign('history_count', $history_count?:0); $this->assign('history_count', $history_count?:0);
} }

@ -131,7 +131,7 @@
</select> </select>
</div> </div>
<div class="input-list input-list-server search_label_rehab"> <div class="input-list input-list-server search_label_rehab">
<select id="server_name" name="server_name" class="select_gallery" style="width:120px;"> <select id="server_id" name="server_id" class="select_gallery" style="width:120px;">
<option value="">区服名称</option> <option value="">区服名称</option>
</select> </select>
</div> </div>
@ -501,7 +501,7 @@
}); });
$("#promote_level").change(); $("#promote_level").change();
}) })
var game_server = "{:I('server_name')}"; var game_server = "{:I('server_id')}";
$("#game_type").change(function(){ $("#game_type").change(function(){
console.log({sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()}) console.log({sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()})
$.ajax({ $.ajax({
@ -513,11 +513,11 @@
console.log(data) console.log(data)
str = "<option value=''>请选择区服</option>"; str = "<option value=''>请选择区服</option>";
for (var i in data){ 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_name").empty(); $("#server_id").empty();
$("#server_name").append(str); $("#server_id").append(str);
$("#server_name").select2(); $("#server_id").select2();
} }
}) })
}); });

Loading…
Cancel
Save