diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index f49ea9d77..2a2e90f02 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -132,10 +132,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){ @@ -154,49 +153,15 @@ class MemberController extends ThinkController 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->join("tab_user_data AS ss ON ss.user_id = tab_user.id","left"); } - $data = $data->select(false); - - $data = M()->table('(' . $data . ') as a '); - 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(); + // echo($data);die(); if(isset($_REQUEST['export'])){ @@ -277,7 +242,7 @@ class MemberController extends ThinkController if($promoterSelect){ $user_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left"); }else{ - $user_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left"); + $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(); @@ -300,31 +265,39 @@ class MemberController extends ThinkController "); } $user_count = $user_count->find()['user_count']; - //计算累计充值总额 - $now_count = M("user","tab_") - ->field("IFNULL(sum(ss.pay_amount), 0) AS recharge_total") + + //累计充值统计 + $user_sql = M("user","tab_") + ->field('id') ->where($map); if($game_map){ - $now_count->join(" + $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){ - $now_count->join(" + $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 "); } if($promoterSelect){ - $now_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left"); + // dump($spendprom); + // dd($map); + $user_sql->field("IFNULL(sum(ss.pay_amount), 0) AS recharge_total"); + $user_sql->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left"); + $now_count = $user_sql->find()['recharge_total']; }else{ - $now_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left"); + $user_sql = $user_sql->select(false); + + $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']; } - // dump($now_count->select(false));die(); - $now_count = $now_count->find()['recharge_total']; } - //如果存在推广员只计算所属的推广员充值记录 + //如果存在推广员只计算所属的推广员历史充值记录 if($promoterSelect){ $maps = $map; unset($maps['tab_user.promote_id']); @@ -349,15 +322,11 @@ class MemberController extends ThinkController $this->assign('user_count',$user_count); $this->assign('now_count', $now_count?:0); - $page = set_pagination($userRepeat, $row); - - $this->assign('device_count',$user_count-$userRepeat); - + $page = set_pagination($user_count, $row); if ($page) { $this->assign('_page', $page); } $this->assign('list_data', $data); - //$this->assign("is_admin",is_administrator()); $show_data_power = (is_administrator()|| session('user_auth')['show_data']); $this->assign('show_data_power', $show_data_power); $this->display(); diff --git a/Application/Admin/View/Member/user_info.html b/Application/Admin/View/Member/user_info.html index 3929848e2..7a14d0fdb 100644 --- a/Application/Admin/View/Member/user_info.html +++ b/Application/Admin/View/Member/user_info.html @@ -349,17 +349,14 @@ 当前用户累计充值:{$now_count}    历史累计充值:{$history_count}   用户数:{$user_count}   - 去重用户数:{$device_count} 当前用户累计充值: 当前属于该推广员的用户的充值累计(不含用户换绑前记录)  /   历史累计充值: 历史中属于该推广员的用户的充值累计(含用户换绑前记录)   - 去重用户数:{$device_count} 当前用户累计充值:{$now_count}  用户数:{$user_count}   - 去重用户数:{$device_count}