|
|
|
@ -2491,18 +2491,18 @@ class DownloadController extends BaseController {
|
|
|
|
|
public function settlementExcelInfo($id,$map) {
|
|
|
|
|
$xlsName = "结算明细";
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('pay_order_number','游戏订单号'),
|
|
|
|
|
array('game_name','游戏'),
|
|
|
|
|
array('user_account','玩家账号'),
|
|
|
|
|
array('promote_account','推广员账号'),
|
|
|
|
|
array('pay_amount','订单总额'),
|
|
|
|
|
array('pay_amount_zhi','直充'),
|
|
|
|
|
array('pay_amount_nei','内充'),
|
|
|
|
|
array('selle_ratio','分成比例(直充)'),
|
|
|
|
|
array('selle_ratio','分成比例(内充)'),
|
|
|
|
|
array('income','收益'),
|
|
|
|
|
array('pay_time','充值时间'),
|
|
|
|
|
array('selle_status','订单状态'),
|
|
|
|
|
'游戏订单号',
|
|
|
|
|
'游戏',
|
|
|
|
|
'玩家账号',
|
|
|
|
|
'推广员账号',
|
|
|
|
|
'订单总额',
|
|
|
|
|
'直充',
|
|
|
|
|
'内充',
|
|
|
|
|
'分成比例(直充)',
|
|
|
|
|
'分成比例(内充)',
|
|
|
|
|
'收益',
|
|
|
|
|
'充值时间',
|
|
|
|
|
'订单状态',
|
|
|
|
|
);
|
|
|
|
|
$model = M('spend', 'tab_');
|
|
|
|
|
$data = $model->field('pay_order_number,game_name,user_account,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_time,selle_status,pay_status,withdraw_id')
|
|
|
|
@ -2518,6 +2518,28 @@ class DownloadController extends BaseController {
|
|
|
|
|
$total['income'] = empty($total['income']) ? 0 : $total['income'];
|
|
|
|
|
$total['income'] = bcdiv($total['income'], 100, 2);
|
|
|
|
|
//提现状态
|
|
|
|
|
$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 = count($data)?:0 ;
|
|
|
|
|
|
|
|
|
|
$perSize = 5000;//每次查询的条数
|
|
|
|
|
$pages = ceil($accessNum / $perSize);
|
|
|
|
|
for($i = 1; $i <= $pages; $i++) {
|
|
|
|
|
|
|
|
|
|
$data = $model->field('pay_order_number,game_name,user_account,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_time,selle_status,pay_status,withdraw_id')
|
|
|
|
|
->where($map)
|
|
|
|
|
->order('id desc')
|
|
|
|
|
->limit(($i-1)*$perSize ,$perSize)
|
|
|
|
|
->select();
|
|
|
|
|
$withdrawIds = [];
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
if ($value['withdraw_id'] > 0 && !in_array($value['withdraw_id'], $withdrawIds)) {
|
|
|
|
@ -2561,8 +2583,28 @@ class DownloadController extends BaseController {
|
|
|
|
|
$list['pay_amount_zhi'] = $list['pay_amount'];
|
|
|
|
|
$list['pay_amount_nei'] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$csvData["pay_order_number"] = $list["pay_order_number"];
|
|
|
|
|
$csvData["game_name"] = $list["game_name"];
|
|
|
|
|
$csvData["user_account"] = $list["user_account"];
|
|
|
|
|
$csvData["promote_account"] = $list["promote_account"];
|
|
|
|
|
$csvData["pay_amount"] = $list["pay_amount"];
|
|
|
|
|
$csvData["pay_amount_zhi"] = $list["pay_amount_zhi"];
|
|
|
|
|
$csvData["pay_amount_nei"] = $list["pay_amount_nei"];
|
|
|
|
|
$csvData["selle_ratio"] = $list["selle_ratio"];
|
|
|
|
|
$csvData["selle_ratio"] = $list["selle_ratio"];
|
|
|
|
|
$csvData["income"] = $list["income"];
|
|
|
|
|
$csvData["pay_time"] = $list["pay_time"];
|
|
|
|
|
$csvData["selle_status"] = $list["selle_status"];
|
|
|
|
|
mb_convert_variables('GBK', 'UTF-8', $csvData);
|
|
|
|
|
fputcsv($fp, $csvData);
|
|
|
|
|
$xlsData[] = $csvData;
|
|
|
|
|
}
|
|
|
|
|
unset($xlsData);
|
|
|
|
|
ob_flush();
|
|
|
|
|
flush();
|
|
|
|
|
}
|
|
|
|
|
$allData['pay_order_number'] = '合计';
|
|
|
|
|
$allData['game_name'] = '--';
|
|
|
|
|
$allData['user_account'] = '--';
|
|
|
|
@ -2575,9 +2617,15 @@ class DownloadController extends BaseController {
|
|
|
|
|
$allData['income'] = $total['income'];
|
|
|
|
|
$allData['pay_time'] = '--';
|
|
|
|
|
$allData['selle_status'] = '--';
|
|
|
|
|
$data[] = $allData;
|
|
|
|
|
$xlsData = $data;
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
|
|
|
|
|
mb_convert_variables('GBK', 'UTF-8', $allData);
|
|
|
|
|
fputcsv($fp, $allData);
|
|
|
|
|
$xlsData[] = $allData;
|
|
|
|
|
fclose($fp);
|
|
|
|
|
|
|
|
|
|
$this->backSuccessExport($id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2932,21 +2980,21 @@ class DownloadController extends BaseController {
|
|
|
|
|
->find();
|
|
|
|
|
foreach ($roles as $role) {
|
|
|
|
|
$records[] = [
|
|
|
|
|
'user_account' => encryption($role['user_account']),
|
|
|
|
|
'game_name' => $role['game_name'],
|
|
|
|
|
'role_name' => $role['role_name'],
|
|
|
|
|
'role_id' => $role['role_id'],
|
|
|
|
|
'role_level' => $role['role_level'],
|
|
|
|
|
'server_id' => $role['server_id'],
|
|
|
|
|
'server_name' => $role['server_name'],
|
|
|
|
|
'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' => $role['play_time'],
|
|
|
|
|
'play_ip' => $role['play_ip'],
|
|
|
|
|
'promote_id' => $role['promote_id'],
|
|
|
|
|
'promote_account' => $role['promote_account'],
|
|
|
|
|
'sdk_version' => $role['sdk_version'],
|
|
|
|
|
'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' => intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $role['play_time']))) / (24 * 3600))
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|