用户列表去除重复行

master
zhengyongxing 5 years ago
parent 25954045e9
commit 0443871173

@ -132,14 +132,12 @@ class MemberController extends ThinkController
//计算用户列表 //计算用户列表
$data = M("user","tab_") $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(sum(ss.pay_amount), 0) AS recharge_total") ->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")
->where($map) ->where($map)
->group("tab_user.id") ->group("tab_user.id,device_number,tab_user.promote_id")
// ->page($page, $row) // ->page($page, $row)
->order($order); ->order($order);
if(!isset($_REQUEST['export'])){
$data ->page($page, $row);
}
if($havs){ if($havs){
$data->having($havs); $data->having($havs);
} }
@ -158,7 +156,50 @@ class MemberController extends ThinkController
}else{ }else{
$data->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left"); $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 ')->where(['device_count'=>['elt',1]]);
if(!isset($_REQUEST['export'])){
$data ->page($page, $row);
}
$data = $data->select(); $data = $data->select();
// var_dump($data);die();
//计算用户列表重复数量
$userRepeat = M("user","tab_")
->field("count(`device_number`) as device_count")
->where($map)
->group("tab_user.id,device_number,tab_user.promote_id")
// ->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 ')->where(['device_count'=>['gt',1]])->count();
$this->assign('device_count',$userRepeat);
if(isset($_REQUEST['export'])){ if(isset($_REQUEST['export'])){
$isadmin = is_administrator(); $isadmin = is_administrator();
//获取等级 //获取等级
@ -309,7 +350,7 @@ class MemberController extends ThinkController
$this->assign('user_count',$user_count); $this->assign('user_count',$user_count);
$this->assign('now_count', $now_count?:0); $this->assign('now_count', $now_count?:0);
$page = set_pagination($user_count, $row); $page = set_pagination($user_count-$userRepeat, $row);
if ($page) { if ($page) {
$this->assign('_page', $page); $this->assign('_page', $page);
} }

@ -348,15 +348,18 @@
<td colspan="8"> <td colspan="8">
当前用户累计充值:{$now_count} &#12288;&#12288; 当前用户累计充值:{$now_count} &#12288;&#12288;
历史累计充值:{$history_count}&#12288;&#12288; 历史累计充值:{$history_count}&#12288;&#12288;
用户数:{$user_count} 用户数:{$user_count}&#12288;&#12288;
去充用户数:{$device_count}
</td> </td>
<td colspan="8" style="font-style: 12px;color: #a9a9a9;text-align: center;"> <td colspan="8" style="font-style: 12px;color: #a9a9a9;text-align: center;">
当前用户累计充值:&#12288;当前属于该推广员的用户的充值累计(不含用户换绑前记录)&#12288;&#12288;/&#12288;&#12288; 当前用户累计充值:&#12288;当前属于该推广员的用户的充值累计(不含用户换绑前记录)&#12288;&#12288;/&#12288;&#12288;
历史累计充值:&#12288;历史中属于该推广员的用户的充值累计(含用户换绑前记录) 历史累计充值:&#12288;历史中属于该推广员的用户的充值累计(含用户换绑前记录)&#12288;&#12288;
去充用户数:{$device_count}
</td> </td>
<else /> <else />
<td colspan="99"> <td colspan="99">
当前用户累计充值:{$now_count}&#12288;&#12288;用户数:{$user_count} 当前用户累计充值:{$now_count}&#12288;&#12288;用户数:{$user_count}&#12288;&#12288;
去充用户数:{$device_count}
</td> </td>
</if> </if>

Loading…
Cancel
Save