@ -379,17 +379,17 @@ class PayChannelController extends ThinkController
if (!empty($_REQUEST['timestart']) & & !empty($_REQUEST['timeend'])) {
$map['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$coinMap['tab_pay_info .create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$coinMap['tab_deposit .create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$spreadMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$offcialmap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
} elseif (!empty($_REQUEST['timestart']) & & empty($_REQUEST['timeend'])) {
$map['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$coinMap['tab_pay_info .create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$coinMap['tab_deposit .create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$spreadMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$offcialmap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
} elseif (empty($_REQUEST['timestart']) & & !empty($_REQUEST['timeend'])) {
$map['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$coinMap['tab_pay_info .create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$coinMap['tab_deposit .create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$spreadMap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$offcialmap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
}
@ -529,7 +529,7 @@ class PayChannelController extends ThinkController
}
}
$this->meta_title = "测试统计 ";
$this->meta_title = "游戏订单查看 ";
$sumAllData['sum'] = $sumAllData['bind_amount']+$sumAllData['platform_amount']+$sumAllData['pay_amount'];
// var_dump($sumAllData);die();
$this->assign('sumAllData',$sumAllData);
@ -794,13 +794,17 @@ class PayChannelController extends ThinkController
$map['tab_deposit.user_account'] = $map['user_account'];
}
$coinMap = $map;
$coinMap['tab_deposit.create_time'] = $map['pay_time'];
unset($coinMap['pay_time']);
$coinData = M('pay_info','tab_')
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->join("inner join tab_test_white_list on tab_test_white_list.user_id=tab_pay_info.user_id")
->field("pay_order_number,tab_deposit.order_number,tab_deposit.user_account,tab_deposit.create_time as pay_time,
tab_pay_info.game_name,tab_pay_info.server_name,tab_pay_info.game_player_name,tab_deposit.pay_amount as cost,
tab_deposit.pay_amount,tab_deposit.pay_way as pay_type,tab_deposit.pay_way,'' as pay_game_status")
->where($m ap)
->where($coinM ap)
->select(false);
$page = ($page-1) * $row;
$count = "select count(*) as count from ({$data} UNION ALL {$coinData})t;";
@ -851,14 +855,14 @@ class PayChannelController extends ThinkController
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->join("inner join tab_test_white_list on tab_test_white_list.user_id=tab_pay_info.user_id")
->field("sum(tab_deposit.pay_amount) as cost,sum(tab_deposit.pay_amount) as pay_amount,tab_deposit.pay_way")
->where($m ap)
->where($coinM ap)
->find();
$coinDataSumSql = M('pay_info','tab_')
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->join("inner join tab_test_white_list on tab_test_white_list.user_id=tab_pay_info.user_id")
->field("sum(tab_deposit.pay_amount) as cost,sum(tab_deposit.pay_amount) as pay_amount,tab_deposit.pay_way")
->where($m ap)
->where($coinM ap)
->group('pay_way')
->select(false);
@ -1064,12 +1068,17 @@ class PayChannelController extends ThinkController
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流中
$perSize = 50000;//每次查询的条数
if ($model == 'spend') {
$xlsCell = array('支付订单号', 'cp订单号', '测试账号', '充值时间', '游戏名称', '游戏区服',
'角色名称', '订单金额', ' 实付金额 ', '充值方式', '支付渠道', '游戏通知状态',);
mb_convert_variables('GBK', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
if ($_REQUEST['game_id']) {
$map['game_id'] = $_REQUEST['game_id'];
}
@ -1085,13 +1094,17 @@ class PayChannelController extends ThinkController
$map['tab_deposit.user_account'] = $map['user_account'];
}
$coinMap = $map;
$coinMap['tab_deposit.create_time'] = $map['pay_time'];
unset($coinMap['pay_time']);
$coinData = M('pay_info','tab_')
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->join("inner join tab_test_white_list on tab_test_white_list.user_id=tab_pay_info.user_id")
->field("pay_order_number,tab_deposit.order_number,tab_deposit.user_account,tab_deposit.create_time as pay_time,
tab_pay_info.game_name,tab_pay_info.server_name,tab_pay_info.game_player_name,tab_deposit.pay_amount as cost,
tab_deposit.pay_amount,tab_deposit.pay_way as pay_type,tab_deposit.pay_way,'' as pay_game_status")
->where($m ap)
->where($coinM ap)
->select(false);
$count = "select count(*) as count from ({$data} UNION ALL {$coinData})t;";
@ -1110,13 +1123,16 @@ class PayChannelController extends ThinkController
foreach ($data as $key => $value) {
$value['pay_order_number'] = "'".$value['pay_order_number'];
$value['order_number'] = "'".$value['order_number'];
if (!$value['order_number']) {
$data[$key]['order_number'] = '无';
}
$data[$key] ['pay_time'] = Date('Y-m-d H:i:s', $value['pay_time']);
$value ['pay_time'] = Date('Y-m-d H:i:s', $value['pay_time']);
$data[$key] ['pay_type'] = get_pay_way($value['pay_type']);
$value ['pay_type'] = get_pay_way($value['pay_type']);
if ($value['pay_way'] == 1 || $value['pay_way'] == 9) {
$value['pay_way'] = '支付宝';
@ -1142,12 +1158,11 @@ class PayChannelController extends ThinkController
fputcsv($fp, $value);
}
unset($xlsD ata);//释放变量的内存
unset($d ata);//释放变量的内存
//刷新输出缓冲到浏览器
ob_flush();
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
}
die();
$field = "sum(cost) as cost,sum(pay_amount) as pay_amount,pay_way";
@ -1155,18 +1170,25 @@ class PayChannelController extends ThinkController
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->join("inner join tab_test_white_list on tab_test_white_list.user_id=tab_pay_info.user_id")
->field("sum(tab_deposit.pay_amount) as cost,sum(tab_deposit.pay_amount) as pay_amount,tab_deposit.pay_way")
->where($m ap)
->where($coinM ap)
->find();
$coinDataSumSql = M('pay_info','tab_')
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->join("inner join tab_test_white_list on tab_test_white_list.user_id=tab_pay_info.user_id")
->field("sum(tab_deposit.pay_amount) as cost,sum(tab_deposit.pay_amount) as pay_amount,tab_deposit.pay_way")
->where($m ap)
->where($coinM ap)
->group('pay_way')
->select(false);
} elseif($model == 'game_supersign') {
$xlsCell = array('支付订单号', '测试账号', '充值时间', '游戏名称',
'订单金额', ' 实付金额 ', '充值方式', '支付渠道',);
mb_convert_variables('GBK', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
if ($map['pay_order_number']) {
$map['order_id'] = $map['pay_order_number'];
unset($map['pay_order_number']);
@ -1196,7 +1218,7 @@ class PayChannelController extends ThinkController
$page = ($i - 1) * $perSize;
$data = M('game_supersign', 'tab_')
->field("order_id as pay_order_number,trade_id as order_number, account as user_account,pay_time,game_name,pay_price as cost,pay_price as pay_amount,pay_way as pay_type,pay_way")
->field("order_id as pay_order_number,account as user_account,pay_time,game_name,pay_price as cost,pay_price as pay_amount,pay_way as pay_type,pay_way")
->join('inner join tab_test_white_list on tab_game_supersign.user_id=tab_test_white_list.user_id')
->join('left join tab_game on tab_game_supersign.game_id= tab_game.id')
->where($map)
@ -1206,42 +1228,94 @@ class PayChannelController extends ThinkController
foreach ($data as $key => $value) {
$value['pay_order_number'] = "'".$value['pay_order_number'];
$value['pay_time'] = Date('Y-m-d H:i:s', $value['pay_time']);
$value['pay_type'] = get_pay_way($value['pay_type']);
if ($value['pay_way'] == 1 || $value['pay_way'] == 9) {
$value['pay_way'] = '支付宝';
} else if ($value['pay_way'] == 2 || $value['pay_way'] == 3) {
$value['pay_way'] = '微信支付';
} else if ($value['pay_way'] == 15) {
$value['pay_way'] = '快捷支付';
} else if ($value['pay_way']) {
$value['pay_way'] = '其他支付';
}
mb_convert_variables('GBK', 'UTF-8', $value);
fputcsv($fp, $value);
}
unset($xlsData);//释放变量的内存
unset($d ata);//释放变量的内存
//刷新输出缓冲到浏览器
ob_flush();
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
}
$field = "pay_price as cost,sum(pay_price) as pay_amount,pay_way";
} elseif($model == 'deposit') {
$xlsCell = array('支付订单号', 'cp订单号', '测试账号', '充值时间', '订单金额', ' 实付金额 ', '充值方式', '支付渠道');
mb_convert_variables('GBK', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$map['pay_source'] = 0;
if ($map['pay_time']) {
$map['create_time'] = $map['pay_time'];
unset($map['pay_time']);
}
$data = M('deposit','tab_')
->field("pay_order_number,order_number,user_account,create_time as pay_time,pay_amount as cost,pay_amount,pay_way as pay_type,pay_way")
->join('inner join tab_test_white_list on tab_deposit.user_id=tab_test_white_list.user_id')
->where($map)
->page($page, $row)
->order('tab_deposit.id DESC')
->select();
$count = M('deposit','tab_')
$accessNum = M('deposit','tab_')
->field("pay_order_number,order_number,user_account,create_time as pay_time,pay_amount as cost,pay_amount,pay_way as pay_type,pay_way")
->join('inner join tab_test_white_list on tab_deposit.user_id=tab_test_white_list.user_id')
->where($map)
->page($page, $row)
->order('tab_deposit.id DESC')
->count();
$pages = ceil($accessNum / $perSize);
for($i = 1; $i < = $pages; $i++) {
$page = ($i - 1) * $perSize;
$data = M('deposit', 'tab_')
->field("pay_order_number,order_number,user_account,create_time as pay_time,pay_amount as cost,pay_amount,pay_way as pay_type,pay_way")
->join('inner join tab_test_white_list on tab_deposit.user_id=tab_test_white_list.user_id')
->where($map)
->limit($page ,$perSize)
->order('tab_deposit.id DESC')
->select();
foreach ($data as $key => $value) {
$value['pay_order_number'] = "'".$value['pay_order_number'];
$value['order_number'] = "'".$value['order_number'];
$value['pay_time'] = Date('Y-m-d H:i:s', $value['pay_time']);
$value['pay_type'] = get_pay_way($value['pay_type']);
if ($value['pay_way'] == 1 || $value['pay_way'] == 9) {
$value['pay_way'] = '支付宝';
} else if ($value['pay_way'] == 2 || $value['pay_way'] == 3) {
$value['pay_way'] = '微信支付';
} else if ($value['pay_way'] == 15) {
$value['pay_way'] = '快捷支付';
} else if ($value['pay_way']) {
$value['pay_way'] = '其他支付';
}
mb_convert_variables('GBK', 'UTF-8', $value);
fputcsv($fp, $value);
}
unset($data);//释放变量的内存
//刷新输出缓冲到浏览器
ob_flush();
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
}
$field = "pay_amount as cost,sum(pay_amount) as pay_amount,pay_way";
}
@ -1265,8 +1339,6 @@ class PayChannelController extends ThinkController
$sumAllData['cost'] += $coinDataSum['cost'];
}
$this->assign('sumAllData',$sumAllData);
$sumData = "select cost,sum(pay_amount) as pay_amount,pay_way from ({$sumData})t group by pay_way";
@ -1291,8 +1363,6 @@ class PayChannelController extends ThinkController
}
$this->assign('payTypeData',$payTypeData);
foreach($sumData as $key=>$value) {
$sumData[$key]['pay_amount'] = number_format($value['pay_amount'],2,'.','');
$sumData[$key]['pay_way'] = get_pay_way($value['pay_way']);
@ -1301,7 +1371,63 @@ class PayChannelController extends ThinkController
unset($sumData[$key]);
}
}
//总计
if ($model == 'spend') {
$sumAllDataother['pay_order_number'] = '总计';
$sumAllDataother['order_number'] = '------';
$sumAllDataother['user_account'] = '------';
$sumAllDataother['pay_time'] = '------';
$sumAllDataother['game_name'] = '------';
$sumAllDataother['server_name'] = '------';
$sumAllDataother['game_player_name'] = '------';
$sumAllDataother['cost'] = $sumAllData['cost'];
$sumAllDataother['pay_amount'] = $sumAllData['pay_amount'];
$sumAllDataother['pay_type'] = '------';
$sumAllDataother['pay_way'] = '------';
$sumAllDataother['pay_game_status'] = '------';
} elseif($model == 'game_supersign') {
$sumAllDataother['pay_order_number'] = '总计';
$sumAllDataother['user_account'] = '------';
$sumAllDataother['pay_time'] = '------';
$sumAllDataother['game_name'] = '------';
$sumAllDataother['cost'] = $sumAllData['cost'];
$sumAllDataother['pay_amount'] = $sumAllData['pay_amount'];
$sumAllDataother['pay_type'] = '------';
$sumAllDataother['pay_way'] = '------';
} elseif($model == 'deposit') {
$sumAllDataother['pay_order_number'] = '总计';
$sumAllDataother['order_number'] = '------';
$sumAllDataother['user_account'] = '------';
$sumAllDataother['pay_time'] = '------';
$sumAllDataother['cost'] = $sumAllData['cost'];
$sumAllDataother['pay_amount'] = $sumAllData['pay_amount'];
$sumAllDataother['pay_type'] = '------';
$sumAllDataother['pay_way'] = '------';
}
mb_convert_variables('GBK', 'UTF-8',$sumAllDataother);
fputcsv($fp, $sumAllDataother);
$sumAllDataPay['pay_order_number'] = '充值方式合计';
$sumAllDataPay['order_number'] = '';
//支付渠道合计
foreach ($payTypeData as $key => $value) {
$sumAllDataPay['order_number'] .= $key.': '.$value.' ';
}
mb_convert_variables('GBK', 'UTF-8',$sumAllDataPay);
fputcsv($fp, $sumAllDataPay);
//支付渠道
$sumDataPay['pay_order_number'] = '支付渠道';
$sumDataPay['order_number'] = '';
foreach ($sumData as $key => $value) {
$sumDataPay['order_number'] .= $value['pay_way'].': '.$value['pay_amount'].' ';
}
mb_convert_variables('GBK', 'UTF-8',$sumDataPay);
fputcsv($fp, $sumDataPay);
}