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

master
chenxiaojun 5 years ago
parent 8fd8ae006a
commit bc166771e4

@ -1188,6 +1188,9 @@ class DownloadController extends BaseController {
$gameMap['sdk_version'] = $sdkVersion; $gameMap['sdk_version'] = $sdkVersion;
} }
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
if(empty($gameId1)) {
$gameId1 = [-100];
}
$map['game_id'] = ['in', $gameId1]; $map['game_id'] = ['in', $gameId1];
} }
empty(I('server_id')) || $map['tab_pay_info.server_id'] = I('server_id'); empty(I('server_id')) || $map['tab_pay_info.server_id'] = I('server_id');
@ -1382,6 +1385,9 @@ class DownloadController extends BaseController {
$gameMap['sdk_version'] = $sdkVersion; $gameMap['sdk_version'] = $sdkVersion;
} }
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
if(empty($gameId1)) {
$gameId1 = [-100];
}
$map['game_id'] = ['in', $gameId1]; $map['game_id'] = ['in', $gameId1];
$subMap['game_id'] = ['in', $gameId1]; $subMap['game_id'] = ['in', $gameId1];
} }
@ -1504,6 +1510,9 @@ class DownloadController extends BaseController {
$gameMap['sdk_version'] = $sdkVersion; $gameMap['sdk_version'] = $sdkVersion;
} }
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
if(empty($gameId1)) {
$gameId1 = [-100];
}
$map['game_id'] = ['in', $gameId1]; $map['game_id'] = ['in', $gameId1];
} }
if ($serverId > 0) { if ($serverId > 0) {
@ -1603,6 +1612,9 @@ class DownloadController extends BaseController {
$gameMap['sdk_version'] = $sdkVersion; $gameMap['sdk_version'] = $sdkVersion;
} }
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
if(empty($gameId1)) {
$gameId1 = [-100];
}
$map['game_id'] = ['in', $gameId1]; $map['game_id'] = ['in', $gameId1];
} }
if ($serverId != 0) { if ($serverId != 0) {
@ -1896,14 +1908,17 @@ class DownloadController extends BaseController {
->limit(($i-1)*$perSize ,$perSize)->select(); ->limit(($i-1)*$perSize ,$perSize)->select();
foreach($data as $key => $v) { foreach($data as $key => $v) {
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
$promoteInfo = M('promote','tab_')->field("nickname")->where(['id' => intval($v['promote_id'])])->find(); $promoteInfo = M('promote','tab_')->field("account")->where(['id' => intval($v['promote_id'])])->find();
$v['promote_id']= $promoteInfo['nickname']; $serverId = $v['server_id'];
$gameId = $v['game_id'];
$serverInfo = M('server','tab_')->field('server_name')->where(['server_num'=>$serverId,'game_id'=>$gameId])->find();
$v['promote_id']= $promoteInfo['account'];
$csvData['extend'] = $this->encryption($v['extend']); $csvData['extend'] = $this->encryption($v['extend']);
$csvData['create_time'] = $v['create_time']; $csvData['create_time'] = $v['create_time'];
$csvData['user_account'] = $v['user_account']; $csvData['user_account'] = $v['user_account'];
$csvData['game_name'] = $v['game_name']; $csvData['game_name'] = $v['game_name'];
$csvData['promote_id'] = $v['promote_id']; $csvData['promote_id'] = $v['promote_id'];
$csvData['server_name'] = $v['server_name']; $csvData['server_name'] = $serverInfo['server_name'];
$csvData['user_id'] = $v['game_player_id']; $csvData['user_id'] = $v['game_player_id'];
$csvData['game_player_name'] = $v['game_player_name']; $csvData['game_player_name'] = $v['game_player_name'];
$csvData['price'] = $v['price']; $csvData['price'] = $v['price'];
@ -3151,7 +3166,9 @@ class DownloadController extends BaseController {
} }
if(!empty($map['user_account'])) { if(!empty($map['user_account'])) {
$map['ui.user_account'] = $map['user_account']; $userId = M('user', 'tab_')->where(array('account' => $map['user_account']))->getField('id');
$userId = $userId ?? 0;
$map['uc.user_id'] = $userId;
unset($map['user_account']); unset($map['user_account']);
} }
if(!empty($map['promote_id'])) { if(!empty($map['promote_id'])) {
@ -3181,13 +3198,14 @@ class DownloadController extends BaseController {
$map['_string'] = 'ui.role_id in (' . $subQuery . ')'; $map['_string'] = 'ui.role_id in (' . $subQuery . ')';
} }
$secondDay = 24*3600 + 1; $secondDay = 24*3600 + 1;
$map['uc.create_time'] = ['between', [$map['begintime'], $map['endtime'] - $secondDay]]; $map['uc.create_time'] = ['between', [$map['begintime'], $map['endtime']-1]];
unset($map['begintime']); unset($map['begintime']);
unset($map['endtime']); unset($map['endtime']);
//$spendMap['_string'] = 'uc.game_id = tab_user_play_info.game_id and uc.server_id = tab_user_play_info.server_id and uc.role_id = tab_user_play_info.role_id'; //$spendMap['_string'] = 'uc.game_id = tab_user_play_info.game_id and uc.server_id = tab_user_play_info.server_id and uc.role_id = tab_user_play_info.role_id';
$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"; $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"; $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";
$loginRecordMap['lr.create_time'] = $map['uc.create_time']; $loginRecordMap['lr.create_time'] = $map['uc.create_time'];
$loginRecordMap['_string'] = 'lr.user_id = uc.user_id and lr.game_id = uc.game_id'; $loginRecordMap['_string'] = 'lr.user_id = uc.user_id and lr.game_id = uc.game_id';
$fieldLR = M('login_daily_record', 'tab_')->alias('lr') $fieldLR = M('login_daily_record', 'tab_')->alias('lr')
@ -3197,19 +3215,26 @@ class DownloadController extends BaseController {
$field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count'; $field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count';
$subQuery = M('user_play_data_count', 'tab_')->alias('uc') $subQuery = M('user_play_data_count', 'tab_')->alias('uc')
->field($field) ->field($field)
->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') ->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')
->where($map) ->where($map)
->group('uc.role_id,uc.server_id,uc.game_id') ->group('uc.role_id,uc.server_id,uc.game_id')
->buildSql(); ->buildSql();
$roles = M()->alias('record') $roles = M()->alias('record')
->table($subQuery) ->table($subQuery)
->select(); ->select();
$total = []; $totalQuery = M('user_play_data_count', 'tab_')->alias('uc')
$total = M('user_play_data_count', 'tab_')->alias('uc')
->field($fieldUC) ->field($fieldUC)
->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') ->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')
->where($map) ->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(); ->find();
$userIds = array_column($roles, 'user_id');
$userIds = $userIds ? $userIds : [-1];
$users = M('user', 'tab_')->where(array('id' => ['in', $userIds]))->getField('id, account', true);
$csvFileName = $xlsName.'.csv'; $csvFileName = $xlsName.'.csv';
//设置好告诉浏览器要下载excel文件的headers //设置好告诉浏览器要下载excel文件的headers
header('Content-Description: File Transfer'); header('Content-Description: File Transfer');
@ -3232,6 +3257,9 @@ class DownloadController extends BaseController {
->limit(($i-1)*$perSize ,$perSize) ->limit(($i-1)*$perSize ,$perSize)
->select(); ->select();
foreach($data as $key => $value) { foreach($data as $key => $value) {
if (empty($value['user_account']) ) {
$value['user_account'] = $users[$value['user_id']] ?? '';
}
$csvData['user_account'] = empty($value['user_account']) ? '--' : encryption($value['user_account']); $csvData['user_account'] = empty($value['user_account']) ? '--' : encryption($value['user_account']);
$csvData['game_name'] = empty($value['game_name']) ? '--' :$value['game_name']; $csvData['game_name'] = empty($value['game_name']) ? '--' :$value['game_name'];
$csvData['server_name'] = empty($value['server_name']) ? '--' :$value['server_name']; $csvData['server_name'] = empty($value['server_name']) ? '--' :$value['server_name'];

@ -1114,6 +1114,7 @@ class QueryController extends BaseController
$summaryData = []; $summaryData = [];
$dayList = $this->getDayList($begTime, $endTime); $dayList = $this->getDayList($begTime, $endTime);
$dayListReverse = $dayList;
$dayList = array_reverse($dayList); $dayList = array_reverse($dayList);
$params['dayList'] = $dayList; $params['dayList'] = $dayList;
@ -1185,7 +1186,9 @@ class QueryController extends BaseController
$allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$day], 2); $allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$day], 2);
$allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2); $allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2);
$allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2); $allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2);
}
foreach ($dayListReverse as $day) {
$date = date('Ymd', strtotime($day));
$summaryData['date'][] = $date; $summaryData['date'][] = $date;
$summaryData['role_num'][] = $roleNumList[$day]; $summaryData['role_num'][] = $roleNumList[$day];
$summaryData['user_num'][] = $userNumList[$day]; $summaryData['user_num'][] = $userNumList[$day];
@ -1795,7 +1798,9 @@ class QueryController extends BaseController
$map['ui.role_name'] = ['like', $roleName . '%']; $map['ui.role_name'] = ['like', $roleName . '%'];
} }
if ($userAccount != '') { if ($userAccount != '') {
$map['ui.user_account'] = ['like', $userAccount . '%']; $userId = M('user', 'tab_')->where(array('account' => ['like', $userAccount . '%']))->getField('id');
$userId = $userId ?? 0;
$map['uc.user_id'] = $userId;
} }
if ($isSelf) { if ($isSelf) {
$map['uc.promote_id'] = $queryPromote['id']; $map['uc.promote_id'] = $queryPromote['id'];
@ -1865,10 +1870,15 @@ class QueryController extends BaseController
list($records, $pagination, $count) = $this->paginate($query); list($records, $pagination, $count) = $this->paginate($query);
$total = M('user_play_data_count', 'tab_')->alias('uc') $totalQuery = M('user_play_data_count', 'tab_')->alias('uc')
->field($fieldUC) ->field($fieldUC)
->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') ->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')
->where($map) ->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(); ->find();
foreach ($records as &$list) { foreach ($records as &$list) {

Loading…
Cancel
Save