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')) . ")";
$gameplay = " and tab_user_play.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']}' ";
}
//查询游戏角色表
$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();
@ -138,11 +137,19 @@ class MemberController extends ThinkController
->field("tab_user.id,`device_number`,`age_status`,`account`,`balance`,`gold_coin`,`alipay`,tab_user.promote_id,`register_type`,tab_user.promote_account,`register_time`,`lock_status`,`register_way`,`register_ip`,`login_time`,`check_status`,IFNULL(sum(ss.pay_amount), 0) AS recharge_total")
->where($map)
->group("tab_user.id")
->page($page, $row)
// ->page($page, $row)
->order($order);
if(!isset($_REQUEST['export'])){
$data ->page($page, $row);
}
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
@ -154,6 +161,55 @@ class MemberController extends ThinkController
$data->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left");