Merge branch 'fix/member_user_info' of wmtx/platform into release

玩家列表新增去重数据栏
master
廖金灵 5 years ago committed by Gogs
commit e2a32b11dc

@ -625,7 +625,7 @@ class SiteStatAddon extends Addon
{
$user = M("User", "tab_");
$game = M("Game", "tab_");
$spend = M('Spend', "tab_");
$spend = M('Spend s use index(game_stayus)', "tab_");
$deposit = M('Deposit', "tab_");
$apply = M('Apply', "tab_");
$applyapp = M('app_apply', "tab_");

@ -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,34 +218,18 @@ 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($is_repeat){
$field ="count(*) user_count,IFNULL(sum(ss.pay_amount), 0) recharge_total";
}else{
$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($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
");
if($havs){
$map["_string"] = get_vip_level_limit('ss.pay_amount', $_REQUEST['viplevel']);
}
$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'];
}else{
//计算总人数
$user_count = M("user","tab_")
->field("count(*) user_count")
->field($field)
->where($map);
if($game_map){
$user_count->join("
@ -250,32 +241,28 @@ class MemberController extends ThinkController
(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
");
$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;
}
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
");
}else{
$user_count = $userDbRes['no_repeat_count']-0+$userDbRes['repeat_count'];
$repeat_count = $userDbRes['repeat_count'];
$no_repeat_count = $userDbRes['no_repeat_count'];
}
$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'];
}
$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);

@ -233,10 +233,16 @@ class PromoteController extends ThinkController
if ($this->accountExist($account)) {
$this->error('该账号已存在');
}
if(!empty($mobile_phone)){
//判断手机格式
if (!preg_match("/^1[3456789]{1}\d{9}$/", $mobile_phone)) {
$this->error('手机格式错误');
}
$res = M('promote', 'tab_')->where(['mobile_phone' => $mobile_phone])->field('id')->find();
if ($res) {
$this->error('该手机号已存在');
}
}
$company_belong = $_REQUEST['company_belong'] ?? 0;
$company_relation = $_REQUEST['company_relation'] ?? 0;
$data = array(
@ -694,6 +700,9 @@ class PromoteController extends ThinkController
*/
public function spend_list()
{
if(!array_key_exists("timeStart",$_REQUEST)){
$this->redirect(ACTION_NAME, array('timeStart' => date('Y-m-d',strtotime('-30 day')),"timeEnd"=>date('Y-m-d')));
}
if (isset($_REQUEST['game_name'])) {
if ($_REQUEST['game_name']=='全部') {
unset($_REQUEST['game_name']);
@ -799,7 +808,7 @@ class PromoteController extends ThinkController
setPowerPromoteIds($map);
// dd($map);
$model = array(
'm_name' => 'Spend',
'm_name' => 'spend use index(promote_time)',
'map' => $map,
'order' => 'id desc',
'title' => '渠道充值',
@ -814,9 +823,9 @@ class PromoteController extends ThinkController
];
//为数据权限添加
setPowerPromoteIds($map2);
$total = null_to_0(D('Spend')->where($map1)->sum('pay_amount'));//累计充值
$ttotal = null_to_0(D('Spend')->where(['pay_time' => total(1, false)])->where($map2)->sum('pay_amount'));//昨日充值
$ytotal = null_to_0(D('Spend')->where(['pay_time' => total(5, false)])->where($map2)->sum('pay_amount'));//今日充值
$total = null_to_0(M('Spend use index(promote_time)',"tab_")->where($map1)->sum('pay_amount'));//累计充值
$ttotal = null_to_0(M('Spend use index(promote_time)',"tab_")->where(['pay_time' => total(1, false)])->where($map2)->sum('pay_amount'));//昨日充值
$ytotal = null_to_0(M('Spend use index(promote_time)',"tab_")->where(['pay_time' => total(5, false)])->where($map2)->sum('pay_amount'));//今日充值
// dd($total,$ttotal,$ytotal);
$this->assign('total', $total);
$this->assign('ttotal', $ttotal);

@ -31,8 +31,8 @@ class SpendEvent extends ThinkEvent {
$model['order'] = $data_order_type.' '.$sort;
}
$new_model = D($name);
$data = D($name)
$new_model = M($name,"tab_");
$data = $new_model
// 查询条件
->where($map)
/* 默认通过id逆序排列 */
@ -44,7 +44,7 @@ class SpendEvent extends ThinkEvent {
/* 执行查询 */
->select();
/* 查询记录总数 */
$count = D($name)
$count = $new_model
// 查询条件
->where($map)
/* 默认通过id逆序排列 */

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