|
|
@ -52,14 +52,18 @@ class ExportController extends Controller
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
switch ($id) {
|
|
|
|
switch ($id) {
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
// $xlsCell = array(
|
|
|
|
|
|
|
|
// array('user_account', "玩家账号"),
|
|
|
|
|
|
|
|
// array('game_name', "游戏名称"),
|
|
|
|
|
|
|
|
// array('server_name', L('Game_area_clothing')),
|
|
|
|
|
|
|
|
// array('role_name', "角色名"),
|
|
|
|
|
|
|
|
// array('role_level', "游戏等级"),
|
|
|
|
|
|
|
|
// array('play_time', "最后登录时间", 'time_format', '*'),
|
|
|
|
|
|
|
|
// array('play_ip', "最后登录ip"),
|
|
|
|
|
|
|
|
// );
|
|
|
|
$xlsCell = array(
|
|
|
|
$xlsCell = array(
|
|
|
|
array('user_account', "玩家账号"),
|
|
|
|
"创建时间","玩家账号", "游戏名称","游戏区服", L('Game_area_clothing'), "角色ID", "角色名", "游戏等级","所属推广员",
|
|
|
|
array('game_name', "游戏名称"),
|
|
|
|
"最后登录时间", '最后登录ip',
|
|
|
|
array('server_name', L('Game_area_clothing')),
|
|
|
|
|
|
|
|
array('role_name', "角色名"),
|
|
|
|
|
|
|
|
array('role_level', "游戏等级"),
|
|
|
|
|
|
|
|
array('play_time', "最后登录时间", 'time_format', '*'),
|
|
|
|
|
|
|
|
array('play_ip', "最后登录ip"),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
|
$map['game_name'] = ['like', trim($_REQUEST['game_name'])."%"];
|
|
|
|
$map['game_name'] = ['like', trim($_REQUEST['game_name'])."%"];
|
|
|
@ -95,10 +99,53 @@ class ExportController extends Controller
|
|
|
|
$promoter_ids ? $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))] : null;
|
|
|
|
$promoter_ids ? $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))] : null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$xlsData = M('user_play_info', 'tab_')
|
|
|
|
|
|
|
|
|
|
|
|
$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('GBK', 'UTF-8', $xlsCell);
|
|
|
|
|
|
|
|
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$accessNum = M('user_play_info', 'tab_')
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->order('play_time desc')
|
|
|
|
->order('play_time desc')
|
|
|
|
->select();
|
|
|
|
->count();
|
|
|
|
|
|
|
|
// $accessNum =$accessNum['count'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$perSize = 5000;//每次查询的条数
|
|
|
|
|
|
|
|
$pages = ceil($accessNum / $perSize);
|
|
|
|
|
|
|
|
$lastId = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for($i = 1; $i <= $pages; $i++) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$xlsData = M('user_play_info', 'tab_')
|
|
|
|
|
|
|
|
->field("create_time,user_account,game_name,server_id,server_name,role_id,role_name,role_level,promote_account,play_time,play_ip")
|
|
|
|
|
|
|
|
->where($map)
|
|
|
|
|
|
|
|
->limit(($i-1)*$perSize ,$perSize)
|
|
|
|
|
|
|
|
->order('play_time desc')
|
|
|
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach($xlsData as $value) {
|
|
|
|
|
|
|
|
$value['create_time'] = date("Y-m-d H:i:s",$value['create_time']);
|
|
|
|
|
|
|
|
$value['play_time'] = date("Y-m-d H:i:s",$value['play_time']);
|
|
|
|
|
|
|
|
mb_convert_variables('GBK', 'UTF-8', $value);
|
|
|
|
|
|
|
|
fputcsv($fp, $value);
|
|
|
|
|
|
|
|
$lastId = $value['id'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
unset($xlsData);//释放变量的内存
|
|
|
|
|
|
|
|
//刷新输出缓冲到浏览器
|
|
|
|
|
|
|
|
ob_flush();
|
|
|
|
|
|
|
|
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose($fp);
|
|
|
|
|
|
|
|
exit();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 2:
|
|
|
|
$xlsName = $xlsName?$xlsName:"渠道注册";
|
|
|
|
$xlsName = $xlsName?$xlsName:"渠道注册";
|
|
|
@ -339,10 +386,10 @@ class ExportController extends Controller
|
|
|
|
$field = 'a.id,a.account,a.promote_account,a.balance,
|
|
|
|
$field = 'a.id,a.account,a.promote_account,a.balance,
|
|
|
|
IFNULL(sum(ss.pay_amount),0) AS recharge_total,a.gold_coin,a.alipay
|
|
|
|
IFNULL(sum(ss.pay_amount),0) AS recharge_total,a.gold_coin,a.alipay
|
|
|
|
,a.id as small_count,a.id as vip_level,a.register_type,register_time,a.login_time
|
|
|
|
,a.id as small_count,a.id as vip_level,a.register_type,register_time,a.login_time
|
|
|
|
,a.register_ip,a.lock_status,a.age_status,a.register_way';
|
|
|
|
,a.register_ip,a.device_number,a.lock_status,check_status,a.age_status,a.register_way';
|
|
|
|
$xlsCell = [L('Account_number_ID'),"玩家账号",L('Subordinate_channel'), "账户平台币"
|
|
|
|
$xlsCell = [L('Account_number_ID'),"玩家账号",L('Subordinate_channel'), "账户平台币"
|
|
|
|
, "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", "注册方式", L('Registration_time'),
|
|
|
|
, "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", "注册方式", L('Registration_time'),
|
|
|
|
"最后登录时间", L('Register_iP'), L('Account_status')];
|
|
|
|
"最后登录时间", L('Register_iP'), "设备号" ,L('Account_status'), "拉黑状态"];
|
|
|
|
$map['tab_user.register_type']=['in','1,2'];
|
|
|
|
$map['tab_user.register_type']=['in','1,2'];
|
|
|
|
$map['tab_user.register_type']=['in','0,1,2,7'];
|
|
|
|
$map['tab_user.register_type']=['in','0,1,2,7'];
|
|
|
|
|
|
|
|
|
|
|
@ -645,7 +692,9 @@ class ExportController extends Controller
|
|
|
|
|
|
|
|
|
|
|
|
$xlsData[$k]['register_time'] = date('Y-m-d H:i:s',$xlsData[$k]['register_time']);
|
|
|
|
$xlsData[$k]['register_time'] = date('Y-m-d H:i:s',$xlsData[$k]['register_time']);
|
|
|
|
$xlsData[$k]['login_time'] = date('Y-m-d H:i:s',$xlsData[$k]['login_time']);
|
|
|
|
$xlsData[$k]['login_time'] = date('Y-m-d H:i:s',$xlsData[$k]['login_time']);
|
|
|
|
|
|
|
|
$xlsData[$k]['device_number'] = encryption($xlsData[$k]['device_number']);
|
|
|
|
$xlsData[$k]['lock_status'] = $xlsData[$k]['lock_status']==1?'正常':'锁定';
|
|
|
|
$xlsData[$k]['lock_status'] = $xlsData[$k]['lock_status']==1?'正常':'锁定';
|
|
|
|
|
|
|
|
$xlsData[$k]['check_status'] = $xlsData[$k]['check_status']==1?'正常':'已拉黑';
|
|
|
|
|
|
|
|
|
|
|
|
$xlsData[$k]['register_type'] = $v['register_type'] == 2?'手机号':($v['register_type']==7?'邮箱':'账号');
|
|
|
|
$xlsData[$k]['register_type'] = $v['register_type'] == 2?'手机号':($v['register_type']==7?'邮箱':'账号');
|
|
|
|
|
|
|
|
|
|
|
@ -1753,6 +1802,62 @@ class ExportController extends Controller
|
|
|
|
$xlsData[$key]['developers'] = get_developers_account($value['developers'],'account');
|
|
|
|
$xlsData[$key]['developers'] = get_developers_account($value['developers'],'account');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 21:
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
|
|
|
array('extend', 'CP订单号'),
|
|
|
|
|
|
|
|
array('create_time', '充值时间'),
|
|
|
|
|
|
|
|
array('user_account', '玩家账号'),
|
|
|
|
|
|
|
|
array('game_name', '游戏名称'),
|
|
|
|
|
|
|
|
array('server_name', '游戏区服'),
|
|
|
|
|
|
|
|
array('promote_account', '所属推广员'),
|
|
|
|
|
|
|
|
array('game_player_id', '角色ID'),
|
|
|
|
|
|
|
|
array('game_player_name', '角色名称'),
|
|
|
|
|
|
|
|
array('price', '订单金额'),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
$params = I('get.');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
|
|
|
|
if (isset($params['user_account'])) {
|
|
|
|
|
|
|
|
$map['user_account'] = $params['user_account'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($params['extend'])) {
|
|
|
|
|
|
|
|
$map['extend'] = $params['extend'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($params['game_name'])) {
|
|
|
|
|
|
|
|
$game_id = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')];
|
|
|
|
|
|
|
|
$map['game_id'] = $game_id;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($params['server_name'])) {
|
|
|
|
|
|
|
|
$map['server_name'] = $params['server_name'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($params['user_nickname'])) {
|
|
|
|
|
|
|
|
$map['user_nickname'] = $params['user_nickname'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($params['game_player_id'])) {
|
|
|
|
|
|
|
|
$map['game_player_id'] = $params['game_player_id'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$startDate = empty($params['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $params['timestart'];
|
|
|
|
|
|
|
|
$endDate = empty($params['timeend']) ? date('Y-m-d') : $params['timeend'];
|
|
|
|
|
|
|
|
$startTime = strtotime($startDate);
|
|
|
|
|
|
|
|
$endTime = strtotime($endDate) + 86399;
|
|
|
|
|
|
|
|
$map['create_time'] = array('BETWEEN', [$startTime, $endTime]);
|
|
|
|
|
|
|
|
if ($promoteId = I('promote_id')) {
|
|
|
|
|
|
|
|
if ($promoteId == 0) {
|
|
|
|
|
|
|
|
$map['promote_id'] = 0;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$promoteMap['chain'] = ['like', "%/$promoteId/%"];
|
|
|
|
|
|
|
|
$promoteIds = M('Promote', 'tab_')->where($promoteMap)->getField('id', true);
|
|
|
|
|
|
|
|
$promoteIds[] = $promoteId;
|
|
|
|
|
|
|
|
$map['promote_id'] = ['in', $promoteIds];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$xlsData = M('pay_info', 'tab_')->where($map)->order('id DESC')->select();
|
|
|
|
|
|
|
|
foreach($xlsData as $k => $v) {
|
|
|
|
|
|
|
|
$xlsData[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
$xlsName = $xlsCell = $xlsData = [];
|
|
|
|
$xlsName = $xlsCell = $xlsData = [];
|
|
|
|
|
|
|
|
|
|
|
@ -5517,7 +5622,7 @@ if ($key == 'model'){
|
|
|
|
$map['tab_user.account']=array('like','%'.$_REQUEST['account'].'%');
|
|
|
|
$map['tab_user.account']=array('like','%'.$_REQUEST['account'].'%');
|
|
|
|
unset($_REQUEST['account']);
|
|
|
|
unset($_REQUEST['account']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$map['register_type'] = array('in','(0,1,2,3,4,5,6,7)');
|
|
|
|
$csvFileName = $xlsName.'.csv';
|
|
|
|
$csvFileName = $xlsName.'.csv';
|
|
|
|
//设置好告诉浏览器要下载excel文件的headers
|
|
|
|
//设置好告诉浏览器要下载excel文件的headers
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|