|
|
|
@ -922,28 +922,76 @@ class ExportController extends Controller
|
|
|
|
|
} else {
|
|
|
|
|
$total = sprintf("%.2f", $total);
|
|
|
|
|
}
|
|
|
|
|
$xlsData = D('Spend')
|
|
|
|
|
->field('pay_order_number,pay_time,user_account,game_name,promote_account,spend_ip,pay_amount,pay_amount,pay_status,pay_game_status,pay_way,server_name,game_player_name,cost')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
"订单号", "充值时间", "玩家账号", "游戏名称", L('Subordinate_channel'), "充值ip", "游戏区服",
|
|
|
|
|
"角色名称", "订单金额", "实付金额", "充值方式", L('Order_status'), "游戏通知状态", "消费"."{$total}"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$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 = D('Spend')
|
|
|
|
|
->field('pay_order_number,pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status')
|
|
|
|
|
->where($map)
|
|
|
|
|
->join($tab_promote_join)
|
|
|
|
|
->order('pay_time DESC')
|
|
|
|
|
->select();
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('pay_order_number', "订单号"),
|
|
|
|
|
array('pay_time', "充值时间", 'time_format', '*'),
|
|
|
|
|
array('user_account', "玩家账号"),
|
|
|
|
|
array('game_name', "游戏名称"),
|
|
|
|
|
array('promote_account', L('Subordinate_channel')),
|
|
|
|
|
array('spend_ip', "充值ip"),
|
|
|
|
|
array('server_name', "游戏区服"),
|
|
|
|
|
array('game_player_name', "角色名称"),
|
|
|
|
|
array('cost', "订单金额"),
|
|
|
|
|
array('pay_amount', "实付金额"),
|
|
|
|
|
array('pay_way', "充值方式", 'get_pay_way', '*'),
|
|
|
|
|
array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
|
|
|
|
|
array('pay_game_status', "游戏通知状态", 'get_info_status', '*', '14'),
|
|
|
|
|
array('', "消费"."{$total}")
|
|
|
|
|
);
|
|
|
|
|
->count();
|
|
|
|
|
|
|
|
|
|
$perSize = 10000;//每次查询的条数
|
|
|
|
|
$pages = ceil($accessNum / $perSize);
|
|
|
|
|
|
|
|
|
|
// var_dump($count);die();
|
|
|
|
|
for($i = 1; $i <= $pages; $i++) {
|
|
|
|
|
$xlsData = D('Spend')
|
|
|
|
|
->field('pay_order_number,pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status')
|
|
|
|
|
->where($map)
|
|
|
|
|
->limit(($i-1)*$perSize ,$perSize)
|
|
|
|
|
->join($tab_promote_join)
|
|
|
|
|
->order('pay_time DESC')
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
foreach($xlsData as $value) {
|
|
|
|
|
$value['pay_time'] = date('Y-m-d H:i:s',$value['pay_time']);
|
|
|
|
|
$value['pay_way'] = get_pay_way($value['pay_way']);
|
|
|
|
|
$value['pay_status'] = get_info_status($value['pay_status'],9);
|
|
|
|
|
$value['pay_game_status'] = get_info_status($value['pay_game_status'],14);
|
|
|
|
|
mb_convert_variables('GBK', 'UTF-8', $value);
|
|
|
|
|
fputcsv($fp, $value);
|
|
|
|
|
}
|
|
|
|
|
unset($xlsData);//释放变量的内存
|
|
|
|
|
//刷新输出缓冲到浏览器
|
|
|
|
|
ob_flush();
|
|
|
|
|
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
|
|
|
|
|
}
|
|
|
|
|
fclose($fp);
|
|
|
|
|
exit();
|
|
|
|
|
// $xlsCell = array(
|
|
|
|
|
// array('pay_order_number', "订单号"),
|
|
|
|
|
// array('pay_time', "充值时间", 'time_format', '*'),
|
|
|
|
|
// array('user_account', "玩家账号"),
|
|
|
|
|
// array('game_name', "游戏名称"),
|
|
|
|
|
// array('promote_account', L('Subordinate_channel')),
|
|
|
|
|
// array('spend_ip', "充值ip"),
|
|
|
|
|
// array('server_name', "游戏区服"),
|
|
|
|
|
// array('game_player_name', "角色名称"),
|
|
|
|
|
// array('cost', "订单金额"),
|
|
|
|
|
// array('pay_amount', "实付金额"),
|
|
|
|
|
// array('pay_way', "充值方式", 'get_pay_way', '*'),
|
|
|
|
|
// array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
|
|
|
|
|
// array('pay_game_status', "游戏通知状态", 'get_info_status', '*', '14'),
|
|
|
|
|
// array('', "消费"."{$total}")
|
|
|
|
|
// );
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
$xlsName = $xlsName?$xlsName:L('Platform_currency_recharge');
|
|
|
|
|