|
|
|
@ -1760,26 +1760,59 @@ class DownloadController extends BaseController {
|
|
|
|
|
public function registerExcelInfo($id,$map) {
|
|
|
|
|
$xlsName = "注册明细";
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('account','玩家账号'),
|
|
|
|
|
array('promote_account','推广账号'),
|
|
|
|
|
array('device_number','设备IMIE/IDFA'),
|
|
|
|
|
array('register_time','注册时间'),
|
|
|
|
|
array('register_ip','注册ip'),
|
|
|
|
|
array('login_time','登陆时间'),
|
|
|
|
|
array('login_ip','登陆ip')
|
|
|
|
|
'玩家账号',
|
|
|
|
|
'推广账号',
|
|
|
|
|
'设备IMIE/IDFA',
|
|
|
|
|
'注册时间',
|
|
|
|
|
'注册ip',
|
|
|
|
|
'登陆时间',
|
|
|
|
|
'登陆ip'
|
|
|
|
|
);
|
|
|
|
|
$model = M('user','tab_');
|
|
|
|
|
|
|
|
|
|
$data = $model->field('account,device_number,promote_account,register_time,register_ip,login_time,login_ip')->where($map)->order('tab_user.id desc')->select();
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
foreach ($data as $key1 => $value1) {
|
|
|
|
|
$value1['register_time'] = date("Y-m-d H:i:s",$value1['register_time']);
|
|
|
|
|
$value1['login_time'] = date("Y-m-d H:i:s",$value1['login_time']);
|
|
|
|
|
$value1['account'] = $this->encryption($value1['account']);
|
|
|
|
|
$value1['device_number'] = $this->encryption($value1['device_number']);
|
|
|
|
|
$xlsData[] = $value1;
|
|
|
|
|
$data1 = $model->field('account')->where($map)->order('tab_user.id desc')->select();
|
|
|
|
|
$csvFileName = $xlsName.'.csv';
|
|
|
|
|
//设置好告诉浏览器要下载excel文件的headers
|
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|
|
header('Content-Type: application/vnd.ms-excel');
|
|
|
|
|
header('Content-Disposition: attachment; filename="'. $csvFileName .'"');
|
|
|
|
|
header('Expires: 0');
|
|
|
|
|
header('Cache-Control: must-revalidate');
|
|
|
|
|
header('Pragma: public');
|
|
|
|
|
$fp = fopen('php://output', 'a');//打开output流
|
|
|
|
|
mb_convert_variables('gb2312', 'UTF-8', $xlsCell);
|
|
|
|
|
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
|
|
|
|
|
$accessNum = '100000';//从数据库获取总量,假设是十万
|
|
|
|
|
$accessNum = count($data1)?:0 ;
|
|
|
|
|
|
|
|
|
|
$perSize = 5000;//每次查询的条数
|
|
|
|
|
$pages = ceil($accessNum / $perSize);
|
|
|
|
|
for($i = 1; $i <= $pages; $i++) {
|
|
|
|
|
$model = M('user','tab_');
|
|
|
|
|
|
|
|
|
|
$data = $model
|
|
|
|
|
->field('account,device_number,promote_account,register_time,register_ip,login_time,login_ip')
|
|
|
|
|
->where($map)
|
|
|
|
|
->limit(($i-1)*$perSize ,$perSize)
|
|
|
|
|
->order('tab_user.id desc')
|
|
|
|
|
->select();
|
|
|
|
|
foreach($data as $value1) {
|
|
|
|
|
$csvData['account'] = $this->encryption($value1['account']);
|
|
|
|
|
$csvData['promote_account'] = $value1['promote_account'];
|
|
|
|
|
$csvData['device_number'] = $this->encryption($value1['device_number']);
|
|
|
|
|
$csvData['register_time'] = date("Y-m-d H:i:s",$value1['register_time']);
|
|
|
|
|
$csvData['register_ip'] = $value1['register_ip'];
|
|
|
|
|
$csvData['login_time'] = date("Y-m-d H:i:s",$value1['login_time']);
|
|
|
|
|
$csvData['login_ip'] = $value1['login_ip'];
|
|
|
|
|
mb_convert_variables('GBK', 'UTF-8', $csvData);
|
|
|
|
|
fputcsv($fp, $csvData);
|
|
|
|
|
}
|
|
|
|
|
unset($csvData);
|
|
|
|
|
ob_flush();
|
|
|
|
|
flush();
|
|
|
|
|
}
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
|
|
|
|
|
fclose($fp);
|
|
|
|
|
$this->backSuccessExport($id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//玩家角色excel信息
|
|
|
|
@ -2892,18 +2925,18 @@ class DownloadController extends BaseController {
|
|
|
|
|
public function userRechargeExcelInfo($id,$map) {
|
|
|
|
|
$xlsName = "充值玩家";
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('user_account','玩家账号'),
|
|
|
|
|
array('game_name','游戏名称'),
|
|
|
|
|
array('server_name','游戏区服'),
|
|
|
|
|
array('sdk_version','平台'),
|
|
|
|
|
array('role_name','角色名'),
|
|
|
|
|
array('role_level','等级'),
|
|
|
|
|
array('recharge_cost','充值总额'),
|
|
|
|
|
array('recharge_count','充值次数'),
|
|
|
|
|
array('recharge_cost_today','昨日充值'),
|
|
|
|
|
array('unlogin_day','未登录天数'),
|
|
|
|
|
array('play_time','最后登录时间'),
|
|
|
|
|
array('promote_account','推广员账号'),
|
|
|
|
|
'玩家账号',
|
|
|
|
|
'游戏名称',
|
|
|
|
|
'游戏区服',
|
|
|
|
|
'平台',
|
|
|
|
|
'角色名',
|
|
|
|
|
'等级',
|
|
|
|
|
'充值总额',
|
|
|
|
|
'充值次数',
|
|
|
|
|
'昨日充值',
|
|
|
|
|
'未登录天数',
|
|
|
|
|
'最后登录时间',
|
|
|
|
|
'推广员账号',
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
$subMap = [];
|
|
|
|
@ -2957,6 +2990,7 @@ class DownloadController extends BaseController {
|
|
|
|
|
unset($map['begintime']);
|
|
|
|
|
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';
|
|
|
|
|
|
|
|
|
|
$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";
|
|
|
|
|
$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";
|
|
|
|
|
$field = $fieldUC . ',' . $fieldUI;
|
|
|
|
@ -2975,55 +3009,72 @@ class DownloadController extends BaseController {
|
|
|
|
|
->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')
|
|
|
|
|
->where($map)
|
|
|
|
|
->find();
|
|
|
|
|
foreach ($roles as $role) {
|
|
|
|
|
$records[] = [
|
|
|
|
|
'user_account' => empty($role['user_account']) ? '--' : encryption($role['user_account']),
|
|
|
|
|
'game_name' => empty($role['game_name']) ? '--' : $role['game_name'],
|
|
|
|
|
'role_name' => empty($role['role_name']) ? '--' : $role['role_name'],
|
|
|
|
|
'role_id' => empty($role['role_id']) ? '--' : $role['role_id'],
|
|
|
|
|
'role_level' => empty($role['role_level']) ? '--' : $role['role_level'],
|
|
|
|
|
'server_id' => empty($role['server_id']) ? '--' : $role['server_id'],
|
|
|
|
|
'server_name' => empty($role['server_name']) ? '--' : $role['server_name'],
|
|
|
|
|
'recharge_cost' => empty($role['recharge_cost']) ? 0 : $role['recharge_cost'],
|
|
|
|
|
'recharge_count' => empty($role['recharge_count']) ? 0 : $role['recharge_count'],
|
|
|
|
|
'recharge_cost_today' => empty($role['recharge_cost_today']) ? 0 : $role['recharge_cost_today'],
|
|
|
|
|
'play_time' => empty($role['play_time']) ? '--' : $role['play_time'],
|
|
|
|
|
'play_ip' => empty($role['play_ip']) ? '--' : $role['play_ip'],
|
|
|
|
|
'promote_id' => empty($role['promote_id']) ? '--' : $role['promote_id'],
|
|
|
|
|
'promote_account' => empty($role['promote_account']) ? '--' : $role['promote_account'],
|
|
|
|
|
'sdk_version' => empty($role['sdk_version']) ? '--' : $role['sdk_version'],
|
|
|
|
|
'unlogin_day' => empty($role['play_time']) ? '--' : intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $role['play_time']))) / (24 * 3600))
|
|
|
|
|
];
|
|
|
|
|
$csvFileName = $xlsName.'.csv';
|
|
|
|
|
//设置好告诉浏览器要下载excel文件的headers
|
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|
|
header('Content-Type: application/vnd.ms-excel');
|
|
|
|
|
header('Content-Disposition: attachment; filename="'. $csvFileName .'"');
|
|
|
|
|
header('Expires: 0');
|
|
|
|
|
header('Cache-Control: must-revalidate');
|
|
|
|
|
header('Pragma: public');
|
|
|
|
|
$fp = fopen('php://output', 'a');//打开output流
|
|
|
|
|
mb_convert_variables('gb2312', 'UTF-8', $xlsCell);
|
|
|
|
|
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
|
|
|
|
|
$accessNum = '100000';//从数据库获取总量,假设是十万
|
|
|
|
|
$accessNum = count($roles)?:0 ;
|
|
|
|
|
|
|
|
|
|
$perSize = 5000;//每次查询的条数
|
|
|
|
|
$pages = ceil($accessNum / $perSize);
|
|
|
|
|
for($i = 1; $i <= $pages; $i++) {
|
|
|
|
|
$data = M()->alias('record')
|
|
|
|
|
->table($subQuery)
|
|
|
|
|
->limit(($i-1)*$perSize ,$perSize)
|
|
|
|
|
->select();
|
|
|
|
|
foreach($data as $key => $value) {
|
|
|
|
|
$csvData['user_account'] = empty($value['user_account']) ? '--' : encryption($value['user_account']);
|
|
|
|
|
$csvData['game_name'] = empty($value['game_name']) ? '--' :$value['game_name'];
|
|
|
|
|
$csvData['server_name'] = empty($value['server_name']) ? '--' :$value['server_name'];
|
|
|
|
|
if($value['sdk_version'] == 1) {
|
|
|
|
|
$csvData['sdk_version'] = "Android";
|
|
|
|
|
}else if($value['sdk_version'] == 2) {
|
|
|
|
|
$csvData['sdk_version'] = "ios";
|
|
|
|
|
} else {
|
|
|
|
|
$csvData['sdk_version'] = "--";
|
|
|
|
|
}
|
|
|
|
|
$csvData['role_name'] = empty($value['role_name']) ? '--' :$value['role_name'];
|
|
|
|
|
$csvData['role_level'] = empty($value['role_level']) ? '--' :$value['role_level'];
|
|
|
|
|
$csvData['recharge_cost'] = empty($value['recharge_cost']) ? 0 : $value['recharge_cost'];
|
|
|
|
|
$csvData['recharge_count'] = empty($value['recharge_count']) ? 0 : $value['recharge_count'];
|
|
|
|
|
$csvData['recharge_cost_today'] = empty($value['recharge_cost_today']) ? 0 : $value['recharge_cost_today'];
|
|
|
|
|
$csvData['unlogin_day'] = empty($value['play_time']) ? '--' : intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $value['play_time']))) / (24 * 3600));
|
|
|
|
|
$csvData['play_time'] = empty($value['play_time']) ? '--' :date('Y-m-d H:i:s',$value['play_time']);
|
|
|
|
|
$csvData['promote_account'] = empty($value['promote_account']) ? '--' :$value['promote_account'];
|
|
|
|
|
|
|
|
|
|
mb_convert_variables('GBK', 'UTF-8', $csvData);
|
|
|
|
|
fputcsv($fp, $csvData);
|
|
|
|
|
$xlsData[] = $csvData;
|
|
|
|
|
}
|
|
|
|
|
unset($xlsData);
|
|
|
|
|
ob_flush();
|
|
|
|
|
flush();
|
|
|
|
|
}
|
|
|
|
|
$allData['user_account'] = '合计';
|
|
|
|
|
$allData['game_name'] = '--';
|
|
|
|
|
$allData['server_name'] = '--';
|
|
|
|
|
$allData['sdk_version'] = '--';
|
|
|
|
|
$allData['role_name'] = '--';
|
|
|
|
|
$allData['role_id'] = '--';
|
|
|
|
|
$allData['role_level'] = '--';
|
|
|
|
|
$allData['server_id'] = '--';
|
|
|
|
|
$allData['server_name'] = '--';
|
|
|
|
|
$allData['recharge_cost'] = $total['recharge_cost'];
|
|
|
|
|
$allData['recharge_count'] = $total['recharge_count'];
|
|
|
|
|
$allData['recharge_cost_today'] = $total['recharge_cost_today'];
|
|
|
|
|
$allData['unlogin_day'] = '--';
|
|
|
|
|
$allData['play_time'] = '--';
|
|
|
|
|
$allData['play_ip'] = '--';
|
|
|
|
|
$allData['promote_id'] = '--';
|
|
|
|
|
$allData['promote_account'] = '--';
|
|
|
|
|
$allData['sdk_version'] = '--';
|
|
|
|
|
$allData['unlogin_day'] = '--';
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
foreach ($records as $key1 => $value1) {
|
|
|
|
|
$value1['user_account'] = $this->encryption($value1['user_account']);
|
|
|
|
|
$value1['play_time'] = date('Y-m-d H:i:s',$value1['play_time']);
|
|
|
|
|
if($value1['sdk_version'] == 1) {
|
|
|
|
|
$value1['sdk_version'] = "Android";
|
|
|
|
|
}else {
|
|
|
|
|
$value1['sdk_version'] = "ios";
|
|
|
|
|
}
|
|
|
|
|
$xlsData[] = $value1;
|
|
|
|
|
}
|
|
|
|
|
mb_convert_variables('GBK', 'UTF-8', $allData);
|
|
|
|
|
fputcsv($fp, $allData);
|
|
|
|
|
$xlsData[] = $allData;
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
|
|
|
|
|
fclose($fp);
|
|
|
|
|
$this->backSuccessExport($id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function rechargeExcelInfo($id,$map) {
|
|
|
|
|