@ -118,8 +117,6 @@ class MemberController extends ThinkController
if ($promoteRoot!='all') {
$promoteRoot = '';
}
$promoter_ids = D("Promote")->where("(chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']})".$promoteRoot)->field('id')->select();
@ -132,10 +129,9 @@ class MemberController extends ThinkController
//计算用户列表
$data = M("user","tab_")
->field("tab_user.id,`device_number`,count(`device_number`) as device_count,`age_status`,`account`,`balance`,`gold_coin`,`alipay`,tab_user.promote_id,`register_type`,tab_user.promote_account,`register_time`,`lock_status`,lock_remark,`register_way`,`register_ip`,`login_time`,`check_status`,IFNULL(sum(ss.pay_amount),0) AS recharge_total")
->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`,lock_remark,`register_way`,`register_ip`,`login_time`,`check_status`,IFNULL(ss.pay_amount,0) AS recharge_total")
->where($map)
->group("device_number,tab_user.register_ip")
// ->page($page, $row)
->group("tab_user.id")
->order($order);
if($havs){
@ -151,54 +147,13 @@ 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($promoterSelect){
$data->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left");
}else{
$data->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left");
}
$data = $data->select(false);
$data = M()->table('(' . $data . ') as a ');
$data->join("tab_user_data AS ss ON ss.user_id = tab_user.id","left");
if(!isset($_REQUEST['export'])){
$data ->page($page, $row);
}
$data = $data->select();
// var_dump($data);die();
//计算用户列表重复数量
$userRepeat = M("user","tab_")
->field("count(`device_number`) as device_count")
->where($map)
->group("device_number,tab_user.register_ip")
// ->page($page, $row)
->order($order);
if($havs){
$userRepeat->having($havs);
}
if($gameplay){
$userRepeat->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){
$userRepeat->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($promoterSelect){
$userRepeat->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left");
}else{
$userRepeat->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left");
}
$userRepeat = $userRepeat->select(false);
$userRepeat = M()->table('(' . $userRepeat . ') as a ')->count();
if(isset($_REQUEST['export'])){
$isadmin = is_administrator();
//获取等级
@ -238,7 +193,6 @@ class MemberController extends ThinkController
$sql1 = $usermodel->field("{$userField},IFNULL(sum(b.pay_amount),0) as deposit_total")
->join('left join tab_deposit AS b ON tab_user.id = b.user_id AND b.pay_status = 1')
->where($map)
->group('tab_user.id')
->where($hav)
// ->order($order)
->select(false);
// $data = $usermodel->table('(' . $sql1 . ') as a ')->field('a.id,a.device_number,a.age_status,a.account,a.balance,a.gold_coin,a.alipay,a.promote_id,a.register_type,a.promote_account,a.register_time,a.lock_status,a.register_way,a.register_type,a.register_ip,a.login_time,IFNULL(sum(ss.pay_amount),0) as recharge_total,check_status')
// ->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1')
$data = $usermodel->table('(' . $sql1 . ') as a ')->field('a.id,a.device_number,a.age_status,a.account,a.balance,a.gold_coin,a.alipay,a.promote_id,a.register_type,a.promote_account,a.register_time,a.lock_status,a.register_way,a.register_type,a.register_ip,a.login_time,IFNULL(sum(ss.pay_amount),0) as recharge_total,check_status')
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1'.$spendprom)
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
->page($page, $row)
->having($havs)
->group('a.id')
->order($order)
->select();
// echo $data;die();
}else{
$data = $usermodel->table('(' . $sql1 . ') as a ')->field('a.id,a.device_number,a.age_status,a.account,a.balance,a.gold_coin,a.alipay,a.promote_id,a.register_type,a.promote_account,a.register_time,a.lock_status,a.register_way,a.register_type,a.register_ip,a.login_time,IFNULL(sum(ss.pay_amount),0) as recharge_total,check_status')
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
->page($page, $row)
->having($havs)
->group('a.id')
->order($order)
->select();
}
//计数
$sql = M('user', 'tab_')->field('tab_user.id,IFNULL(sum(ss.pay_amount),0) AS recharge_total')
->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false)