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

master
chenzhi 5 years ago
parent 6ffd20525d
commit 12966e83bd

@ -80,18 +80,17 @@ class MemberController extends ThinkController
if (isset($_REQUEST['viplevel'])) {
$havs = get_vip_level_limit('recharge_total', $_REQUEST['viplevel']);
}
//1.2 与游戏相关
$game_map = false;
//1.2 与游戏相关 查询游戏玩家表
$gameplay =false;
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
$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 .= " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' ";
}else{
$game_map = " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' ";
$gameplay = " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
}
//查询游戏角色表
$game_map = false;
if (isset($_REQUEST['server_id'])) { //有区服,一定有游戏
$gameplay =false;
$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();
@ -143,6 +142,11 @@ class MemberController extends ThinkController
if($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){
$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
@ -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
");
}
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){
$user_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left");
}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
");
}
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'];
//计算累计充值总额
$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
");
}
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){
$now_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left");
}else{
@ -221,6 +240,11 @@ class MemberController extends ThinkController
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");
}
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'];
$this->assign('history_count', $history_count?:0);
}

@ -131,7 +131,7 @@
</select>
</div>
<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>
</select>
</div>
@ -501,7 +501,7 @@
});
$("#promote_level").change();
})
var game_server = "{:I('server_name')}";
var game_server = "{:I('server_id')}";
$("#game_type").change(function(){
console.log({sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()})
$.ajax({
@ -513,11 +513,11 @@
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_name").empty();
$("#server_name").append(str);
$("#server_name").select2();
$("#server_id").empty();
$("#server_id").append(str);
$("#server_id").select2();
}
})
});

Loading…
Cancel
Save