diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index 1680e8213..4afd0f3c2 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -72,6 +72,12 @@ class MemberController extends ThinkController $map['tab_user.register_type'] = ['in', [0, 3, 4, 5, 6]]; } } + //判断重复 + $is_repeat = false; + if (isset($_REQUEST['is_repeat'])) { + $map['tab_user.is_repeat'] = $_REQUEST['is_repeat']; + $is_repeat = true; + } if (isset($_REQUEST['status'])) { @@ -126,10 +132,10 @@ class MemberController extends ThinkController } //判断是否有列表和统计的权限 $this->checkListOrCountAuthRestMap($map,["tab_user.id","tab_user.account","tab_user.device_number"]); - //计算用户列表 $data = M("user","tab_") - ->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") + ->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,tab_user.is_repeat") ->where($map) ->group("tab_user.id") ->order($order); @@ -193,12 +199,13 @@ class MemberController extends ThinkController $v['login_time'] = date('Y-m-d H:i:s',$v['login_time']); $v['lock_status'] = get_info_status($v['lock_status'],4); $v['check_status'] = $v['check_status']==1 ? "正常" :"拉黑"; + $v['is_repeat'] = $v['is_repeat']==1 ? "是" :"否"; } $field = array( "id"=>"账号ID","account"=>"玩家账号","promote_account"=>"所属推广员","balance"=>"账户平台币","recharge_total"=>"累计充值","gold_coin"=>"金币", "small_count"=>"小号","vip_level"=>"VIP等级","register_type"=>"注册方式","register_time"=>"注册时间","register_ip"=>"注册IP","login_time"=>"最后登录时间", - "device_number"=>"设备号","lock_remark"=>"锁定备注","lock_status"=>"账号状态","check_status"=>"拉黑状态" + "device_number"=>"设备号","is_repeat"=>"去重数据","lock_remark"=>"锁定备注","lock_status"=>"账号状态","check_status"=>"拉黑状态" ); //操作日志 unset($_GET['export']); @@ -211,71 +218,51 @@ class MemberController extends ThinkController data2csv($data,"玩家_玩家列表",$field); } - if($havs){ - //判断是否需要vip等级分类 - $user_count = M("user","tab_") - ->field("tab_user.id,IFNULL(sum(ss.pay_amount), 0) AS recharge_total") - ->where($map) - ->group("tab_user.id") - ->having($havs); - if($game_map){ - $user_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){ - $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->join("tab_user_data AS ss ON ss.user_id = tab_user.id","left"); - - $user_count = $user_count->select(false); - $count = M()->table('(' . $user_count . ') as a ')->field("count(*) user_count,sum(a.recharge_total) recharge_total")->find(); - $user_count = $count['user_count']; - $now_count = $count['recharge_total']; - + //计算总人数 + if($is_repeat){ + $field ="count(*) user_count,IFNULL(sum(ss.pay_amount), 0) recharge_total"; }else{ - //计算总人数 - $user_count = M("user","tab_") - ->field("count(*) user_count") - ->where($map); - if($game_map){ - $user_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){ - $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_sql = M("user","tab_") - ->field('id') - ->where($map); - if($game_map){ - $user_sql->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){ - $user_sql->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_sql = $user_sql->select(false); + $field = "IFNULL(SUM(CASE WHEN is_repeat > 0 THEN 1 ELSE 0 END),0) as repeat_count,IFNULL(SUM(CASE WHEN is_repeat = 0 THEN 1 ELSE 0 END),0) as no_repeat_count,IFNULL(sum(ss.pay_amount), 0) recharge_total"; + } + if($havs){ + $map["_string"] = get_vip_level_limit('ss.pay_amount', $_REQUEST['viplevel']); + } - $now_count = M("UserData","tab_") - ->alias('ss') - ->field("IFNULL(sum(ss.pay_amount), 0) AS recharge_total") - ->where("user_id in (".$user_sql.")")->find()['recharge_total']; + $user_count = M("user","tab_") + ->field($field) + ->where($map); + if($game_map){ + $user_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){ + $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->join("tab_user_data AS ss ON ss.user_id = tab_user.id","left"); + $userDbRes = $user_count->find(); + if($is_repeat){ + $user_count =$userDbRes['user_count']; + if($_REQUEST['is_repeat'] == 0){ + $repeat_count = 0; + $no_repeat_count = $user_count; + }else{ + $repeat_count = $user_count; + $no_repeat_count = 0; + } + }else{ + $user_count = $userDbRes['no_repeat_count']-0+$userDbRes['repeat_count']; + $repeat_count = $userDbRes['repeat_count']; + $no_repeat_count = $userDbRes['no_repeat_count']; } - $this->assign('user_count',$user_count); - $this->assign('now_count', $now_count?:0); + $this->assign('repeat_count',$repeat_count); + $this->assign('no_repeat_count',$no_repeat_count); + + $this->assign('user_count',$user_count); + $this->assign('now_count', $userDbRes['recharge_total']); $page = set_pagination($user_count, $row); if ($page) { $this->assign('_page', $page); diff --git a/Application/Admin/View/Member/user_info.html b/Application/Admin/View/Member/user_info.html index 663496c7a..96313eaab 100644 --- a/Application/Admin/View/Member/user_info.html +++ b/Application/Admin/View/Member/user_info.html @@ -136,6 +136,13 @@
+
+ +