玩家列表新增去重数据栏

master
chenzhi 5 years ago
parent c61f750549
commit bfee0578d0

@ -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);

@ -136,6 +136,13 @@
</select>
</div>
<br>
<div class="input-list input-list-game search_label_rehab">
<select id="is_repeat" name="is_repeat" class="select_gallery" style="width:140px;">
<option value="">请选择是否为去重数据</option>
<option value="0" <?php echo I('is_repeat') && I('is_repeat') == 0 ? "selected" : ''?>>否</option>
<option value="1" <?php echo I('is_repeat') && I('is_repeat') == 1 ? "selected" : ''?>>是</option>
</select>
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="promote_level" style="color:#444" class="select_gallery" id="promote_level">
<option value="">请选择推广员等级</option>
@ -227,6 +234,7 @@
<th >注册IP</th>
<th >最后登录时间</th>
<th >设备号</th>
<th >去重数据</th>
<th >锁定备注</th>
<th >账号状态</th>
<th >拉黑状态</th>
@ -306,6 +314,7 @@
<span class="login_old">{$data['login_time']|date='Y-m-d H:i:s',###}</span>
</if>
</td>
<td >
<if condition="$show_data_power eq true ">
{$data.device_number}
@ -314,6 +323,11 @@
</if>
<!--{$data.device_number}-->
</td>
<eq name="data.is_repeat" value="1">
<td></td>
<else/>
<td></td>
</eq>
<td >
<if condition="get_info_status($data['lock_status'],4) eq '锁定'">
{$data.lock_remark}
@ -347,6 +361,8 @@
<td colspan="8">
用户累计充值:{$now_count} &#12288;&#12288;
用户数:{$user_count}&#12288;&#12288;
去重用户数:{$repeat_count}&#12288;&#12288;
非去重用户数:{$no_repeat_count}&#12288;&#12288;
</td>
<td colspan="8" style="font-style: 12px;color: #a9a9a9;text-align: center;">
用户累计充值:仅表示符合筛选条件下的所有用户的充值总额,因为存在换绑等原因,所以不作为推广员充值总额的依据。

Loading…
Cancel
Save