新增管理后台测试订单导出功能

master
sunke 5 years ago
parent 0344471659
commit 3edb0640ed

@ -2371,6 +2371,88 @@ class ExportController extends Controller
// dd($xlsData);
break;
case 27:
$xlsCell = array(
array('server_type', '服务器类型'),
array('order_type', '订单类型'),
array('order_no', '支付订单号'),
array('cp_order_no', 'cp订单号'),
array('user_account', '测试账号'),
array('pay_time', '充值时间'),
array('game_name', '游戏名称'),
array('order_amount', '订单金额'),
array('pay_amount', '实付金额'),
array('pay_way', '充值方式'),
array('add_time', '录入时间'),
);
$params = I('get.');
// if(isset($params['timestart']) && isset($params['timeend'])) {
// $startTime = strtotime($params['timestart']);
// $endTime = strtotime($params['timeend']) + 86399;
// $map['tab_test_order.pay_time'] = array('BETWEEN', [$startTime, $endTime]);
// }
if(isset($params['server_type'])) {
$map['tab_test_order.server_type'] = $params['server_type'];
}
if(isset($params['order_type'])) {
$map['tab_test_order.order_type'] = $params['order_type'];
}
if(isset($params['order_no'])) {
$map['tab_test_order.order_no'] = $params['order_no'];
}
if(isset($params['user_account'])) {
$map['tab_test_order.user_account'] = $params['user_account'];
}
if(isset($params['pay_way'])) {
$map['tab_test_order.pay_way'] = $params['pay_way'];
}
if(!empty($params['timestart']) && !empty($params['timeend'])){
$timestart = strtotime($params['timestart']);
$timeend = strtotime($params['timeend'])+86399;
$map['tab_test_order.pay_time'] = array("between",array($timestart,$timeend));
}else if(!empty($params['timestart']) && empty($params['timeend'])) {
$timestart = strtotime($params['timestart']);
$map['tab_test_order.pay_time'] = array("EGT",$timestart);
}else if (!empty($params['timeend']) && empty($params['timestart'])) {
$timeend = strtotime($params['timeend'])+86399;
$map['tab_test_order.pay_time'] = array("ELT",$timeend);
}
$orderData = M('test_order', 'tab_')->where($map)->page($page,$row)->order('add_time desc')->select();
$sum_order_amount = M('test_order', 'tab_')->where($map)->field('sum(order_amount) as sum_order_amount,count(1) as count')->find();
$sum_pay_amount = M('test_order', 'tab_')->where($map)->field('sum(pay_amount) as sum_order_amount')->find();
$xlsData = [];
foreach($orderData as $k => $v) {
if ($v['server_type'] == 1) {
$order_list['server_type'] = '测试内网';
}else {
$order_list['server_type'] = '测试外网';
}
$order_list['order_type'] = get_order_type($v['order_type']);
$order_list['order_no'] = $v['order_no'];
$order_list['cp_order_no'] = $v['cp_order_no'];
$order_list['user_account'] = $v['user_account'];
$order_list['pay_time'] = date('Y-m-d H:i:s', $v['pay_time']);
$order_list['game_name'] = $v['game_name'];
$order_list['order_amount'] = $v['order_amount'];
$order_list['pay_amount'] = $v['pay_amount'];
$order_list['pay_way'] = get_pay_way($v['pay_way']);
$order_list['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
$xlsData[] = $order_list;
}
$sumData = [['server_type'=>'总计',
'order_amount'=>$sum_order_amount['sum_order_amount'],
'pay_amount'=>$sum_pay_amount['sum_order_amount']]];
$xlsData = array_merge($xlsData,$sumData);
break;
default:
$xlsName = $xlsCell = $xlsData = [];

@ -185,6 +185,9 @@
</div>
</div>
<div class="page">
<if condition="$is_admin eq true ">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>27,'xlsname'=>'测试服订单','timestart'=>$startDate,'timeend'=>$endDate),I('get.')))}">导出</a>
</if>
{$_page|default=''}
</div>
</block>

@ -3283,7 +3283,7 @@ class DownloadController extends BaseController {
$promoteGroup = isset($promotes[$list['promote_id']]) ? $promoteService->getGroupNameByChain($promotes[$list['promote_id']]['chain'], $list['promote_id']) : '';
$csvData["pay_order_number"] = $list["pay_order_number"];
$csvData["game_name"] = $list["game_name"];
$csvData["game_name"] = substr($list["game_name"],0,strrpos($list["game_name"],'('));
$csvData["user_account"] = $list["user_account"];
$csvData["promote_account"] = $list["promote_account"] . ($promoteGroup == '' ? '' : '(' . $promoteGroup . ')');
$csvData["pay_amount"] = $list["pay_amount"];

Loading…
Cancel
Save