推广平台>数据管理>充值玩家--更新

master
chenxiaojun 5 years ago
commit 42065e2ec2

@ -1761,8 +1761,8 @@ class QueryController extends BaseController
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$sortNameData = ['recharge_cost', 'recharge_count', 'recharge_cost_today', 'unlogin_day', 'create_time', 'user_game_login_count'];
$nowTime = date('Y-m-d', time() - 3600 * 24);
$sortNameData = ['recharge_cost', 'recharge_count', 'recharge_cost_today', 'unlogin_day', 'register_time', 'user_game_login_count'];
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
$initEndTime = $nowTime;
@ -1771,6 +1771,7 @@ class QueryController extends BaseController
$endTime = strtotime($initEndTime);
$endTime += 3600 * 24;
$nowTime = strtotime($nowTime);
$nowTimeEnd = $nowTime + 3600 * 24 - 1;
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
@ -1785,28 +1786,24 @@ class QueryController extends BaseController
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
$ids[] = $queryPromote['id'];
$map = ['uc.promote_id' => ['in', $ids]];
$subMap = ['promote_id' => ['in', $ids]];
$map = ['s.promote_id' => ['in', $ids]];
$map['s.pay_status'] = 1;
if ($relationGameId != 0 || $sdkVersion != 0) {
$gameIds = gameSearch($relationGameId, $sdkVersion);
$map['uc.game_id'] = ['in', $gameIds];
$subMap['game_id'] = ['in', $gameIds];
$map['s.game_id'] = ['in', $gameIds];
}
if ($serverId != 0) {
$map['uc.server_id'] = $serverId;
$subMap['server_id'] = $serverId;
$map['s.server_id'] = $serverId;
}
if ($roleName != '') {
$map['ui.role_name'] = ['like', $roleName . '%'];
$map['s.game_player_name'] = ['like', $roleName . '%'];
}
if ($userAccount != '') {
$userId = M('user', 'tab_')->where(array('account' => ['like', $userAccount . '%']))->getField('id');
$userId = $userId ?? 0;
$map['uc.user_id'] = $userId;
$map['s.user_account'] = ['like', $userAccount . '%'];
}
if ($isSelf) {
$map['uc.promote_id'] = $queryPromote['id'];
$map['s.promote_id'] = $queryPromote['id'];
}
$subMap['create_time'] = ['between', [$begTime, $endTime - 1]];
@ -1821,24 +1818,24 @@ class QueryController extends BaseController
}
$subQuery = M('user_play_data_count', 'tab_')->field('role_id')
->where($subMap)
->group('game_id,server_id,role_id')
->group('game_id, server_id, role_id')
->having($having)
->buildSql();
$map['_string'] = 'ui.role_id in(' . $subQuery . ')';
$map['_string'] = 's.game_player_id in(' . $subQuery . ')';
}
$orderBy = 'play_time desc';
$orderBy = 'login_time desc';
if (!empty($sortName)) {
if (in_array($sortName, $sortNameData)) {
$desc = ' desc';
$asc = ' asc';
if ($sortName == 'unlogin_day') {
$sortName = 'play_time';
$sortName = 'login_time';
$desc = ' asc';
$asc = ' desc';
}
if ($lastSortName == 'unlogin_day') {
$lastSortName = 'play_time';
$lastSortName = 'login_time';
}
if ($lastSortName != $sortName) {
$sortString = $desc;
@ -1850,22 +1847,30 @@ class QueryController extends BaseController
}
}
$map['uc.create_time'] = ['between', [$begTime, $endTime - 1]];
$fieldUC = "sum(uc.recharge_cost) recharge_cost,sum(uc.recharge_count) recharge_count,sum(if(uc.create_time = {$nowTime},uc.recharge_cost,0)) as recharge_cost_today,uc.user_id";
$fieldUI = "ui.user_account,ui.game_name,ui.role_name,ui.role_level,ui.server_name,ui.play_time,ui.play_ip,ui.promote_account,ui.sdk_version,ui.create_time";
$map['s.pay_time'] = ['between', [$begTime, $endTime - 1]];
$fieldS = "sum(s.pay_amount) recharge_cost, count(*) recharge_count, s.user_id, s.user_account, s.promote_account, s.game_name, s.sdk_version, s.server_name, s.game_player_name";
$fieldUser = 'u.register_time, u.login_time';
$loginRecordMap['lr.create_time'] = $map['uc.create_time'];
$loginRecordMap['_string'] = 'lr.user_id = uc.user_id and lr.game_id = uc.game_id';
$spendMap['_string'] = 'today.user_id = s.user_id and today.game_id = s.game_id and today.server_id = s.server_id and today.game_player_id = s.game_player_id and today.promote_id = s.promote_id';
$spendMap['today.pay_status'] = 1;
$spendMap['today.pay_time'] = ['between', [$nowTime, $nowTimeEnd]];
$fieldToday = M('spend', 'tab_')->alias('today')
->field('sum(pay_amount) as recharge_cost_today')
->where($spendMap)
->buildSql();
$loginRecordMap['lr.create_time'] = $map['s.pay_time'];
$loginRecordMap['_string'] = 'lr.user_id = s.user_id and lr.game_id = s.game_id';
$fieldLR = M('login_daily_record', 'tab_')->alias('lr')
->field("count(*) as count")
->where($loginRecordMap)
->buildSql();
$field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count';
$subQuery = M('user_play_data_count', 'tab_')->alias('uc')
$field = "$fieldS, $fieldUser, $fieldToday as recharge_cost_today, $fieldLR as user_game_login_count";
$subQuery = M('spend', 'tab_')->alias('s')
->field($field)
->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->join('join tab_user as u on u.id = s.user_id')
->where($map)
->group('uc.role_id,uc.server_id,uc.game_id')
->group('s.game_player_id, s.server_id, s.game_id')
->buildSql();
$query = M()->alias('record')
->table($subQuery)
@ -1873,31 +1878,24 @@ class QueryController extends BaseController
list($records, $pagination, $count) = $this->paginate($query);
$totalQuery = M('user_play_data_count', 'tab_')->alias('uc')
->field($fieldUC)
->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and uc.server_id = ui.server_id and ui.role_id = uc.role_id')
->group('uc.role_id,uc.game_id,uc.server_id,uc.user_id')
$total = M('spend', 'tab_')->alias('s')
->field($fieldS)
->where($map)
->buildSql();
$total = M()->alias('totals')
->table($totalQuery)
->field('sum(recharge_cost) recharge_cost,sum(recharge_count) recharge_count,sum(recharge_cost_today) as recharge_cost_today')
->find();
foreach ($records as &$list) {
if (empty($list['user_account']) ) {
$list['user_account'] = M('user', 'tab_')->where("id = {$list['user_id']}")->getField('account');
if (!empty($records)) {
foreach ($records as &$list) {
$list['user_account'] = empty($list['user_account']) ? '--' : encryption($list['user_account']);
$list['game_name'] = empty($list['game_name']) ? '--' : $list['game_name'];
$list['sdk_version'] = empty($list['sdk_version']) ? '--' : getSDKTypeName($list['sdk_version']);
$list['server_name'] = empty($list['server_name']) ? '--' : $list['server_name'];
$list['game_player_name'] = empty($list['game_player_name']) ? '--' : $list['game_player_name'];
$list['unlogin_day'] = empty($list['login_time']) ? '--' : intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $list['login_time']))) / (24 * 3600));
$list['login_time'] = empty($list['login_time']) ? '--' : date('Y-m-d H:i:s', $list['login_time']);
$list['register_time'] = empty($list['register_time']) ? '--' : date('Y-m-d H:i:s', $list['register_time']);
$list['promote_account'] = empty($list['promote_account']) ? '--' : $list['promote_account'];
$list['recharge_cost_today'] = empty($list['recharge_cost_today']) ? '0.00' : $list['promote_account'];
}
$list['user_account'] = empty($list['user_account']) ? '--' : $list['user_account'];
$list['game_name'] = empty($list['game_name']) ? '--' : $list['game_name'];
$list['sdk_version'] = empty($list['sdk_version']) ? '--' : getSDKTypeName($list['sdk_version']);
$list['server_name'] = empty($list['server_name']) ? '--' : $list['server_name'];
$list['role_name'] = empty($list['role_name']) ? '--' : $list['role_name'];
$list['role_level'] = empty($list['role_level']) ? '--' : $list['role_level'];
$list['unlogin_day'] = empty($list['play_time']) ? '--' : intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $list['play_time']))) / (24 * 3600));
$list['play_time'] = empty($list['play_time']) ? '--' : date('Y-m-d H:i:s', $list['play_time']);
$list['create_time'] = empty($list['create_time']) ? '--' : date('Y-m-d H:i:s', $list['create_time']);
$list['promote_account'] = empty($list['promote_account']) ? '--' : $list['promote_account'];
}
}
$games = get_promote_serach_game();

@ -34,7 +34,7 @@
</div>
<img src="__IMG__/20180207/icon_normal_game.png">
<span class="title_main">玩家充值</span>
<span class="details">说明:充值数据不包含当日</span>
<span class="details">说明:玩家角色充值统计</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
@ -104,8 +104,7 @@
<th class="title-cursor-pointer" title="设备类型安卓或者ios">平台</th>
<th class="title-cursor-pointer" title="游戏内区服">游戏区服</th>
<th class="title-cursor-pointer" title="游戏角色">角色名</th>
<th class="title-cursor-pointer" title="游戏区服内等级">等级</th>
<th class="sort" sort-name="recharge_cost" class="title-cursor-pointer" title="该游戏区服 内的充值总额">充值总额
<th class="sort" sort-name="recharge_cost" class="title-cursor-pointer" title="该角色的充值总额">充值总额
<if condition="'recharge_cost' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -116,7 +115,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="recharge_count" class="title-cursor-pointer" title="在游戏区服内的充值次数">充值次数
<th class="sort" sort-name="recharge_count" class="title-cursor-pointer" title="该角色的充值次数">充值次数
<if condition="'recharge_count' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -127,7 +126,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="recharge_cost_today" class="title-cursor-pointer" title="玩家昨日游戏区服的充值总额">日充值
<th class="sort" sort-name="recharge_cost_today" class="title-cursor-pointer" title="该角色的今日充值总额">日充值
<if condition="'recharge_cost_today' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -138,7 +137,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="unlogin_day" class="title-cursor-pointer" title="玩家该角色未登录天数">未登录天数
<th class="sort" sort-name="unlogin_day" class="title-cursor-pointer" title="玩家未登录天数">未登录天数
<if condition="'unlogin_day' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -149,7 +148,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="user_game_login_count" class="title-cursor-pointer" title="游戏累计登陆天数:玩家在该游戏累计登陆的天数(不分区服)">游戏累计登录天数
<th class="sort" sort-name="user_game_login_count" class="title-cursor-pointer" title="玩家在该游戏累计登陆的天数(不分区服)">游戏累计登录天数
<if condition="'user_game_login_count' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -160,7 +159,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="create_time" class="title-cursor-pointer" title="角色创建的时间">注册时间
<th class="sort" sort-name="create_time" class="title-cursor-pointer" title="玩家账号注册的时间">注册时间
<if condition="'create_time' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -171,7 +170,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="title-cursor-pointer" title="玩家角色上次登录的时间">最后登录时间</th>
<th class="title-cursor-pointer" title="玩家上次登录的时间">最后登录时间</th>
<th class="title-cursor-pointer" title="对应推广员的账号">推广员账号</th>
</tr>
<empty name="records">
@ -183,15 +182,14 @@
<td>{$record.game_name}</td>
<td>{$record.sdk_version}</td>
<td>{$record.server_name}</td>
<td>{$record.role_name}</td>
<td>{$record.role_level}</td>
<td>{$record.game_player_name}</td>
<td>{$record.recharge_cost}</td>
<td>{$record.recharge_count}</td>
<td>{$record.recharge_cost_today}</td>
<td>{$record.unlogin_day}</td>
<td>{$record.user_game_login_count}</td>
<td>{$record.create_time}</td>
<td>{$record.play_time}</td>
<td>{$record.register_time}</td>
<td>{$record.login_time}</td>
<td>{$record.promote_account}</td>
</tr>
</volist>
@ -201,7 +199,6 @@
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>{$total.recharge_cost}</td>
<td>{$total.recharge_count}</td>
<td>{$total.recharge_cost_today}</td>

Loading…
Cancel
Save