Merge branch 'release-1.0.0' into dev

master
zhengchanglong 5 years ago
commit ff1981ba59

@ -74,7 +74,7 @@
</select> </select>
</div> </div>
<div class="input-list"> <div class="input-list">
<label>扶持类型:</label> <label>资源类型:</label>
<select name="apply_type"> <select name="apply_type">
<option value="">全部</option> <option value="">全部</option>
<option value="0">新增资源</option> <option value="0">新增资源</option>

@ -3200,31 +3200,39 @@ class DownloadController extends BaseController {
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['_string'] = 'lr.user_id = uc.user_id and lr.game_id = uc.game_id'; $loginRecordMap['lr.create_time'] = $map['uc.create_time'];
$fieldLR = M('login_daily_record', 'tab_')->alias('lr') $loginRecordMap['_string'] = 'lr.user_id = uc.user_id and lr.game_id = uc.game_id';
->field("count(*) as count") $fieldLR = M('login_daily_record', 'tab_')->alias('lr')
->where($loginRecordMap) ->field("count(*) as count")
->buildSql(); ->where($loginRecordMap)
$field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count'; ->buildSql();
$subQuery = M('user_play_data_count', 'tab_')->alias('uc') $field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count';
->field($field) $subQuery = M('user_play_data_count', 'tab_')->alias('uc')
->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') ->field($field)
->where($map) ->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')
->group('uc.role_id,uc.server_id,uc.game_id') ->where($map)
->buildSql(); ->group('uc.role_id,uc.server_id,uc.game_id')
->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.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')
->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') ->group('uc.role_id,uc.game_id,uc.server_id,uc.user_id')
->where($map) ->where($map)
->find(); ->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();
$userIds = array_column($roles, 'user_id');
$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');
@ -3247,6 +3255,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'];

Loading…
Cancel
Save