|
|
<?php
|
|
|
|
|
|
namespace Admin\Controller;
|
|
|
|
|
|
use Org\Util\Date;
|
|
|
use Sdk\Controller\AgeController;
|
|
|
use User\Api\MemberApi as MemberApi;
|
|
|
use Org\WeixinSDK\Weixin;
|
|
|
|
|
|
class PayChannelController extends ThinkController
|
|
|
{
|
|
|
public function index($p = 0) {
|
|
|
if(!array_key_exists("timestart",$_REQUEST)){
|
|
|
$this->redirect(ACTION_NAME, array('timestart' => date('Y-m-d',strtotime('-30 day')),"timeend"=>date('Y-m-d')));
|
|
|
}
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
$arraypage = $page;
|
|
|
|
|
|
if (isset($_REQUEST['row'])) {
|
|
|
$row = $_REQUEST['row'];
|
|
|
} else {
|
|
|
$row = 10;
|
|
|
}
|
|
|
|
|
|
$map = [];
|
|
|
if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$map['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
|
|
|
$coinMap['tab_deposit.create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
|
|
|
$bindMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
|
|
|
$offcialmap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
|
|
|
$spreadMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
|
|
|
$maptestorder['pay_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_deposit.create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
|
|
|
$bindMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
|
|
|
$offcialmap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
|
|
|
$spreadMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
|
|
|
$maptestorder['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
|
|
|
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$map['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
|
|
|
$coinMap['tab_deposit.create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
|
|
|
$bindMap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
|
|
|
$offcialmap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
|
|
|
$spreadMap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
|
|
|
$maptestorder['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['game_id'])) {
|
|
|
$map['game_id'] = $_REQUEST['game_id'];
|
|
|
$bindMap['game_id'] = $_REQUEST['game_id'];
|
|
|
$coinMap['game_id'] = $_REQUEST['game_id'];
|
|
|
$maptestorder['game_id'] = $_REQUEST['game_id'];
|
|
|
}
|
|
|
|
|
|
$map['pay_status'] = $coinMap['pay_status'] = 1;
|
|
|
$map['pay_way'] = array('egt',1);
|
|
|
|
|
|
// setPowerPromoteIds($map,'promote_id');
|
|
|
|
|
|
//游戏币计算
|
|
|
$data = M('spend use index(pay_channel)','tab_')
|
|
|
->field("game_name,sum(pay_amount) as pay_amount,game_id,sdk_version")
|
|
|
->where($map)
|
|
|
->group('game_id')
|
|
|
->order('pay_amount desc')
|
|
|
->select();
|
|
|
|
|
|
//平台币充值金额计算
|
|
|
$coinMap['pay_source'] = 2;
|
|
|
$coinMap['extend'] = array('eq','');
|
|
|
$coinMap['tab_deposit.pay_way'] = array('egt',1);
|
|
|
// setPowerPromoteIds($coinMap,'tab_deposit.promote_id');
|
|
|
|
|
|
$coinData = M('pay_info','tab_')
|
|
|
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
|
|
|
->field("tab_pay_info.game_name,0 as pay_amount,sum(tab_deposit.pay_amount) as platform_coin,0 as test_coin,tab_pay_info.game_id,tab_pay_info.sdk_version")
|
|
|
->where($coinMap)
|
|
|
->group("game_id")
|
|
|
->select();
|
|
|
|
|
|
// unset($coinMap['game_id']);
|
|
|
//平台币充值
|
|
|
$coinSum = M('deposit','tab_')
|
|
|
->where($coinMap)
|
|
|
->sum('tab_deposit.pay_amount');
|
|
|
|
|
|
$data = array_merge($data,$coinData);
|
|
|
$data = $this->unique_multi_array($data,'game_id');
|
|
|
|
|
|
//将平台币导入游戏数据中
|
|
|
$handleCoinData = [];
|
|
|
foreach($coinData as $key => $value) {
|
|
|
$handleCoinData[$value['game_id']] = $value['platform_coin'];
|
|
|
}
|
|
|
|
|
|
//测试数据汇总计算
|
|
|
$testData = M('spend','tab_')
|
|
|
->field("sum(pay_amount) as test_coin,game_name,game_id")
|
|
|
->join("inner join tab_test_white_list on tab_spend.user_id=tab_test_white_list.user_id")
|
|
|
->where($map)
|
|
|
->group('game_id')
|
|
|
->select();
|
|
|
|
|
|
//测试平台币充值金额计算
|
|
|
$testCoinData = 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 test_coin,tab_pay_info.game_name,tab_pay_info.game_id")
|
|
|
->where($coinMap)
|
|
|
->group("game_id")
|
|
|
->select();
|
|
|
// var_dump($testCoinData);die();
|
|
|
|
|
|
$handleTestData = [];
|
|
|
foreach($testData as $key => $value) {
|
|
|
$handleTestData[$value['game_id']] = $value['test_coin'];
|
|
|
}
|
|
|
|
|
|
$handleTestCoinData = [];
|
|
|
foreach($testCoinData as $key => $value) {
|
|
|
$handleTestCoinData[$value['game_id']] = $value['test_coin'];
|
|
|
}
|
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
$data[$key]['platform_coin'] = $handleCoinData[$value['game_id']]?$handleCoinData[$value['game_id']]:0;
|
|
|
$data[$key]['test_coin'] = $handleTestData[$value['game_id']]?$handleTestData[$value['game_id']]:0;
|
|
|
$data[$key]['test_platform_coin'] = $handleTestCoinData[$value['game_id']]?$handleTestCoinData[$value['game_id']]:0;
|
|
|
$data[$key]['game_name'] =clearGameNameType($data[$key]['game_name']);
|
|
|
$data[$key]['sdk_version'] =getGameTypeName($data[$key]['sdk_version']);
|
|
|
}
|
|
|
$superMap = $map;
|
|
|
// unset($superMap['promote_id']);
|
|
|
//超级签数据
|
|
|
$superSignData = M('game_supersign','tab_')
|
|
|
->field("0 as game_name,sum(pay_price) as pay_amount,0 as platform_coin,0 as test_coin")
|
|
|
->where($superMap)
|
|
|
->find();
|
|
|
$testSuperSignCost = M('game_supersign','tab_')
|
|
|
->join("inner join tab_test_white_list on tab_game_supersign.user_id=tab_test_white_list.user_id")
|
|
|
->where($superMap)
|
|
|
->sum('pay_price');
|
|
|
|
|
|
$superSignData['test_coin'] = $testSuperSignCost?$testSuperSignCost:0;
|
|
|
$superSignData['sum'] = $superSignData['pay_amount']?$superSignData['pay_amount']:0;
|
|
|
$superSignData['pay_amount'] = $superSignData['pay_amount'] - $superSignData['test_coin'];
|
|
|
// var_dump($testSuperSignCost);die();
|
|
|
$this->assign('superSignData',$superSignData);
|
|
|
//官网数据
|
|
|
$offcialmap['pay_status'] = 1;
|
|
|
$offcialmap['pay_way'] = array('egt',1);
|
|
|
$offcialmap['pay_source'] = 0;
|
|
|
// setPowerPromoteIds($offcialmap,'promote_id');
|
|
|
|
|
|
$offcialData = M('deposit','tab_')
|
|
|
->field("id as game_name,sum(pay_amount) as pay_amount,0 as platform_coin,0 as test_coin")
|
|
|
->where($offcialmap)
|
|
|
->find();
|
|
|
|
|
|
$offcialTestCost = M('deposit','tab_')
|
|
|
->join("inner join tab_test_white_list on tab_deposit.user_id=tab_test_white_list.user_id")
|
|
|
->where($offcialmap)
|
|
|
->sum('pay_amount');
|
|
|
$offcialData['test_coin'] = $offcialTestCost?$offcialTestCost:0;
|
|
|
|
|
|
$bindMap['pay_status'] = 1;
|
|
|
$bindMap['pay_way'] = array('egt',1);
|
|
|
// setPowerPromoteIds($bindMap,'promote_id');
|
|
|
|
|
|
$bindRechargeData = M('bind_recharge','tab_')
|
|
|
->field('sum(real_amount) as pay_amount')
|
|
|
->where(array($bindMap))
|
|
|
->find();
|
|
|
$bindRechargeData['pay_amount'] = $bindRechargeData['pay_amount']?$bindRechargeData['pay_amount']:0;
|
|
|
|
|
|
$offcialData['sum'] = $offcialData['pay_amount']+$bindRechargeData['pay_amount'];
|
|
|
$offcialData['pay_amount'] = number_format($offcialData['pay_amount']+$bindRechargeData['pay_amount']-$offcialData['test_coin'],2,'.','');
|
|
|
|
|
|
$this->assign('offcialData',$offcialData);
|
|
|
|
|
|
$spreadMap['order_status'] = array('egt',1);
|
|
|
$spreadMap['pay_way'] = array('egt',1);
|
|
|
// setPowerPromoteIds($spreadMap,'promote_id');
|
|
|
//推广后台
|
|
|
$spreadData = M("coin_pay_order","tab_")
|
|
|
->field("0 as game_name,sum(pay_amount) as pay_amount,0 as platform_coin,id as test_coin")
|
|
|
->where($spreadMap)
|
|
|
->find();
|
|
|
$spreadData['pay_amount'] = $spreadData['pay_amount']?number_format($spreadData['pay_amount'],2,'.',''):'0.00';
|
|
|
$spreadData['sum'] = number_format($spreadData['pay_amount'],2,'.','');
|
|
|
|
|
|
$this->assign('spreadData',$spreadData);
|
|
|
|
|
|
$channelData = $this->getPayChannel($map);
|
|
|
|
|
|
$testOrderChannelDatas = $this->getTestOrderPayChannel($maptestorder);
|
|
|
$payTypeData['支付宝支付金额'] = 0;
|
|
|
$payTypeData['微信支付金额'] = 0;
|
|
|
$payTypeData['快捷支付金额'] = 0;
|
|
|
$payTypeData['苹果支付金额'] = 0;
|
|
|
$payTypeData['易宝支付金额'] = 0;
|
|
|
$payTypeData['其他支付金额'] = 0;
|
|
|
|
|
|
foreach($channelData as $key => $value) {
|
|
|
|
|
|
if ($value['pay_way']==1 || $value['pay_way']==9 ) {
|
|
|
$payTypeData['支付宝支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if ($value['pay_way']==2 || $value['pay_way']==3 ) {
|
|
|
$payTypeData['微信支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if ($value['pay_way']==15) {
|
|
|
$payTypeData['快捷支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if($value['pay_way'] ==7){
|
|
|
$payTypeData['苹果支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if($value['pay_way'] ==17){
|
|
|
$payTypeData['易宝支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if($value['pay_way']){
|
|
|
$payTypeData['其他支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->assign('payTypeData',$payTypeData);
|
|
|
$pay_way_arr = [];
|
|
|
foreach($channelData as $pay_way_key => $channelData_payway) {
|
|
|
$pay_way_arr[$pay_way_key] = $channelData_payway['pay_way'];
|
|
|
}
|
|
|
$testorderChannelArr = [];
|
|
|
foreach($channelData as $key=>$value) {
|
|
|
$channelData[$key]['pay_amount'] = number_format($value['pay_amount'],2,'.','');
|
|
|
$channelData[$key]['pay_way'] = get_pay_way($value['pay_way']);
|
|
|
|
|
|
if (!$value['pay_way']) {
|
|
|
unset($channelData[$key]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$count = count($data);
|
|
|
|
|
|
$page = set_pagination($count, $row);
|
|
|
if ($page) {
|
|
|
$this->assign('_page', $page);
|
|
|
}
|
|
|
|
|
|
$sumData['game_name'] = '汇总';
|
|
|
$sumData['pay_amount'] = 0;
|
|
|
$sumData['platform_coin'] = 0;
|
|
|
$sumData['test_coin'] = 0;
|
|
|
$sumData['test_platform_coin'] = 0;
|
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
|
$data[$key]['pay_amount'] = number_format($value['pay_amount'] - $value['test_coin'],2,'.','');
|
|
|
$data[$key]['platform_coin'] = number_format($value['platform_coin'] - $value['test_platform_coin'],2,'.','');
|
|
|
$data[$key]['test_coin'] = number_format($value['test_coin'] + $value['test_platform_coin'],2,'.','');
|
|
|
$data[$key]['sum'] = number_format($value['pay_amount'] + $value['platform_coin'],2,'.','');
|
|
|
|
|
|
if($_REQUEST['export'] == 1) {
|
|
|
unset($data[$key]['game_id'] );
|
|
|
unset($data[$key]['test_platform_coin']);
|
|
|
}
|
|
|
|
|
|
//汇总计算
|
|
|
$sumData['pay_amount'] += number_format($value['pay_amount'] - $value['test_coin'],2,'.','');
|
|
|
$sumData['platform_coin'] += $handleCoinData[$value['game_id']]?number_format($handleCoinData[$value['game_id']],2,'.',''):0;
|
|
|
$sumData['test_coin'] += $handleTestData[$value['game_id']]?number_format($handleTestData[$value['game_id']],2,'.',''):0;
|
|
|
$sumData['test_platform_coin'] +=$handleTestCoinData[$value['game_id']]?number_format($handleTestCoinData[$value['game_id']],2,'.',''):0;
|
|
|
}
|
|
|
|
|
|
// 汇总数据
|
|
|
if ($_REQUEST['game_id']) {
|
|
|
$sumData['platform_coin'] = number_format($sumData['platform_coin'] - $sumData['test_platform_coin'],2,'.','');
|
|
|
$sumData['test_coin'] = number_format($sumData['test_coin']+$sumData['test_platform_coin'],2,'.','');
|
|
|
$sumData['sum'] = number_format($sumData['pay_amount'] +$sumData['test_coin'] + $sumData['platform_coin'],2,'.','');
|
|
|
} else {
|
|
|
$sumData['pay_amount'] = number_format($sumData['pay_amount'] + $superSignData['pay_amount'] + $bindRechargeData['pay_amount'],2,'.','');
|
|
|
$sumData['platform_coin'] = number_format($sumData['platform_coin'] - $sumData['test_platform_coin'] + $offcialData['pay_amount'] + $spreadData['pay_amount'],2,'.','');
|
|
|
$sumData['test_coin'] = number_format($sumData['test_coin']+$offcialTestCost+$testSuperSignCost+$sumData['test_platform_coin'],2,'.','');
|
|
|
$sumData['sum'] = number_format($sumData['pay_amount'] +$sumData['test_coin'] + $sumData['platform_coin'],2,'.','');
|
|
|
$coinSum = number_format($coinSum + $offcialData['pay_amount'] + $spreadData['pay_amount']+$offcialTestCost,2,'.','');
|
|
|
}
|
|
|
$sum_pay_amount = M('test_order', 'tab_')->where($maptestorder)->field('sum(pay_amount) as sum_order_amount')->find();
|
|
|
$moneyAllCount = array_sum(array_column($channelData, 'pay_amount'));
|
|
|
$sumData['pay_amount'] += $sum_pay_amount["sum_order_amount"];
|
|
|
$sumData['sum'] += $sum_pay_amount["sum_order_amount"];
|
|
|
if($_REQUEST['export'] == 1) {
|
|
|
|
|
|
$title = array('产品名称','游戏现金金额','平台币直冲金额','测试金额','支付渠道内合计');
|
|
|
|
|
|
$superSignData['game_name'] = '超级签';
|
|
|
$superSignData['platform_coin'] = '0';
|
|
|
$superSignData['sdk_version'] = '';
|
|
|
|
|
|
$offcialData['game_name'] = '官网';
|
|
|
$offcialData['platform_coin'] = $offcialData['pay_amount'];
|
|
|
$offcialData['pay_amount'] = "0";
|
|
|
$offcialData['sdk_version'] = "";
|
|
|
|
|
|
|
|
|
$spreadData['game_name'] = '推广后台';
|
|
|
$spreadData['platform_coin'] = $spreadData['pay_amount'];
|
|
|
$spreadData['pay_amount'] = '0';
|
|
|
$spreadData['test_coin'] = '0';
|
|
|
$spreadData['sdk_version'] = '';
|
|
|
|
|
|
$sumData['sdk_version'] = '';
|
|
|
|
|
|
$testOrder["game_name"] = "测试环境内外网平台";
|
|
|
$testOrder["sdk_version"] = "";
|
|
|
$testOrder["pay_amount"] =$sum_pay_amount['sum_order_amount'] ?: "0";
|
|
|
$testOrder["platform_coin"] ="0";
|
|
|
$testOrder['test_coin'] = '0';
|
|
|
$testOrder['sum'] = $sum_pay_amount['sum_order_amount'] ?: "0";
|
|
|
|
|
|
|
|
|
//充值方式统计
|
|
|
$payTypeDataExport['game_name'] = '充值方式统计';
|
|
|
foreach($payTypeData as $key => $value) {
|
|
|
if ($value) {
|
|
|
$payTypeDataExport['sdk_version'] .= $key.':'.$value." ";
|
|
|
}
|
|
|
}
|
|
|
$payTypeDataExport['sdk_version'] .= "平台币直充总金额(2019.12.18号以前的不显示在列表中,此项也不计入充值方式统计):".
|
|
|
($coinSum);
|
|
|
if ($sum_platform_pay_amount['sum_order_amount'] != 0) {
|
|
|
$testOrderDataExport['pay_amount'] = $sum_noplatform_pay_amount['sum_order_amount'];
|
|
|
}else {
|
|
|
$testOrderDataExport['pay_amount'] = '0.00';
|
|
|
}
|
|
|
if ($sum_noplatform_pay_amount['sum_order_amount'] != 0) {
|
|
|
$testOrderDataExport['platform_coin'] = $sum_platform_pay_amount['sum_order_amount'];
|
|
|
}else {
|
|
|
$testOrderDataExport['platform_coin'] = '0.00';
|
|
|
}
|
|
|
$testOrderDataExport['test_coin'] = '0.00';
|
|
|
$testOrderDataExport['sum'] = '0.00';
|
|
|
$channelDataExport['game_name'] = '支付渠道';
|
|
|
$channelDataExport2['game_name'] = '支付渠道占比';
|
|
|
foreach(array_merge($channelData,$testorderChannelArr) as $key => $value) {
|
|
|
if ($value) {
|
|
|
$channelDataExport['sdk_version'] .= $value['pay_way'].':'.$value['pay_amount']." ";
|
|
|
$channelDataExport2['sdk_version'] .= $value['pay_way'].':'.round($value['pay_amount']*100/ $moneyAllCount,2)."% ";
|
|
|
}
|
|
|
}
|
|
|
unset($sumData['test_platform_coin']);
|
|
|
|
|
|
if ($_REQUEST['game_id']) {
|
|
|
unset($superSignData);
|
|
|
unset($offcialData);
|
|
|
unset($spreadData);
|
|
|
}
|
|
|
//操作日志
|
|
|
$GetData = $_GET;
|
|
|
unset($GetData['export']);
|
|
|
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData),'menu'=>"充值-财务管理-支付渠道查看-导出"]);
|
|
|
//处理导出数据
|
|
|
data2csv(array_merge($data,[$superSignData],[$offcialData],[$spreadData],[$testOrder],[$sumData],[$payTypeDataExport],[$channelDataExport],[$channelDataExport2]),"支付渠道统计导出",array(
|
|
|
"game_name"=>"产品名称","sdk_version"=>"设备名称","pay_amount"=>"游戏现金金额","platform_coin"=>"平台币直冲金额","test_coin"=>"测试金额","sum"=>"支付渠道内合计"));
|
|
|
}
|
|
|
|
|
|
|
|
|
$sumData['pay_amount'] = number_format($sumData['pay_amount'],2,'.','');
|
|
|
$sumData['platform_coin'] = number_format($sumData['platform_coin'],2,'.','');
|
|
|
$sumData['test_coin'] = number_format($sumData['test_coin'],2,'.','');
|
|
|
$sumData['test_platform_coin'] = number_format($sumData['test_platform_coin'],2,'.','');
|
|
|
|
|
|
$this->meta_title = "支付渠道统计";
|
|
|
$size = $row;//每页显示的记录数
|
|
|
$data = array_slice($data, ($arraypage - 1) * $size, $size);
|
|
|
|
|
|
//平台币直充金额,下面列表
|
|
|
$this->assign('coinSum',$coinSum);
|
|
|
$channelData2 = $channelData;
|
|
|
$arr_merge = array_merge($channelData2,$testorderChannelArr);
|
|
|
|
|
|
$this->assign('sumData',$sumData);
|
|
|
$this->assign('channelData',$arr_merge);
|
|
|
$this->assign('listdata',$data);
|
|
|
//统计总额和比例
|
|
|
$this->assign('channelData2',$channelData);
|
|
|
$this->assign('sum_platform_pay_amount',$sum_platform_pay_amount);
|
|
|
$this->assign('sum_noplatform_pay_amount',$sum_noplatform_pay_amount);
|
|
|
$this->assign('sum_pay_amount',$sum_pay_amount);
|
|
|
$moneyAllCount = array_sum(array_column($channelData, 'pay_amount'));
|
|
|
$this->assign('moneyAllCount',$moneyAllCount);
|
|
|
$this->display();
|
|
|
|
|
|
}
|
|
|
|
|
|
protected function unique_multi_array($array, $key)
|
|
|
|
|
|
{
|
|
|
|
|
|
$temp_array = [];
|
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
$key_array = [];
|
|
|
|
|
|
foreach ($array as $val) {
|
|
|
|
|
|
if (!in_array($val[$key], $key_array)) {
|
|
|
|
|
|
$key_array[$i] = $val[$key];
|
|
|
|
|
|
$temp_array[$i] = $val;
|
|
|
|
|
|
}
|
|
|
|
|
|
$i++;
|
|
|
|
|
|
}
|
|
|
|
|
|
return $temp_array;
|
|
|
|
|
|
}
|
|
|
|
|
|
public function add_array($array_1, $array_2) {
|
|
|
$array_merge = array_merge_recursive($array_1, $array_2);
|
|
|
foreach($array_merge as $key => $value) {
|
|
|
if(is_array($value))
|
|
|
$array_merge[$key] = array_sum($value);
|
|
|
}
|
|
|
return $array_merge;
|
|
|
}
|
|
|
|
|
|
|
|
|
public function getTestOrderPayChannel($map) {
|
|
|
$testOrderChannelData = M('test_order','tab_')
|
|
|
->field('sum(pay_amount) as pay_amount,pay_way')
|
|
|
->where($map)
|
|
|
->group('pay_way')
|
|
|
->select();
|
|
|
return $testOrderChannelData;
|
|
|
|
|
|
}
|
|
|
|
|
|
public function getPayChannel($map) {
|
|
|
//支付
|
|
|
//游戏订单渠道
|
|
|
$channelData = M('spend use index(pay_channel_type)','tab_')
|
|
|
->field('sum(pay_amount) as pay_amount,pay_way')
|
|
|
->where($map)
|
|
|
->group('pay_way')
|
|
|
->select(false);
|
|
|
|
|
|
|
|
|
//超级签数据
|
|
|
$superSignDataPay = M('game_supersign','tab_')
|
|
|
->field("sum(pay_price) as pay_amount,pay_way")
|
|
|
->where($map)
|
|
|
->group('pay_way')
|
|
|
->select(false);
|
|
|
|
|
|
//推广后台充值数据
|
|
|
$spreadMap['order_status'] = array('egt',1);
|
|
|
$spreadMap['pay_way'] = array('egt',1);
|
|
|
if($map['pay_time']) {
|
|
|
$spreadMap['create_time'] = $map['pay_time'];
|
|
|
}
|
|
|
// $spreadMap['promote_id'] = $map['promote_id'];
|
|
|
//推广后台
|
|
|
$spreadDataPay = M("coin_pay_order","tab_")
|
|
|
->field("sum(pay_amount) as pay_amount,pay_way")
|
|
|
->where($spreadMap)
|
|
|
->select(false);
|
|
|
|
|
|
if ($map['pay_time']) {
|
|
|
$map['create_time'] = $map['pay_time'];
|
|
|
$testMap['pay_time'] = $map['pay_time'];
|
|
|
unset($map['pay_time']);
|
|
|
}
|
|
|
//充值平台币数据
|
|
|
$depositData = M('deposit','tab_')
|
|
|
->field('sum(pay_amount) as pay_amount,pay_way')
|
|
|
->where($map)
|
|
|
->group('pay_way')
|
|
|
->select(false);
|
|
|
if ($_REQUEST['game_id']) {
|
|
|
if ($map['pay_way']) {
|
|
|
$map['tab_deposit.pay_way'] = $map['pay_way'];
|
|
|
unset($map['pay_way']);
|
|
|
}
|
|
|
if ($map['create_time']) {
|
|
|
$map['tab_deposit.create_time'] = $map['create_time'];
|
|
|
unset($map['create_time']);
|
|
|
}
|
|
|
$map['tab_deposit.pay_source'] = 2;
|
|
|
$map['tab_pay_info.extend'] = '';
|
|
|
|
|
|
$depositData = M('pay_info','tab_')
|
|
|
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
|
|
|
->field('sum(pay_amount) as pay_amount,tab_deposit.pay_way as pay_way')
|
|
|
->where($map)
|
|
|
->group('tab_deposit.pay_way')
|
|
|
->select(false);
|
|
|
// var_dump($depositData);die();
|
|
|
}
|
|
|
|
|
|
$bindMap['pay_status'] = 1;
|
|
|
$bindMap['pay_way'] = array('egt',1);
|
|
|
if($_REQUEST['game_id']) {
|
|
|
$bindMap['game_id'] =$_REQUEST['game_id'];
|
|
|
$testMap['game_id'] =$_REQUEST['game_id'];
|
|
|
}
|
|
|
if ($map['pay_time']) {
|
|
|
$bindMap['create_time'] = $map['pay_time'];
|
|
|
}
|
|
|
// $bindMap['promote_id'] = $map['promote_id'];
|
|
|
|
|
|
$bindRechargeData = M('bind_recharge','tab_')
|
|
|
->field('sum(real_amount) as pay_amount,pay_way')
|
|
|
->where($bindMap)
|
|
|
->select(false);
|
|
|
$testMap['pay_status'] = 1;
|
|
|
$testMap['pay_way'] = array('egt',1);
|
|
|
|
|
|
$testorderData = M('test_order', 'tab_')->field('sum(pay_amount) as pay_amount,pay_way')->where($testMap)->group('pay_way')->select(false);
|
|
|
if(!$_REQUEST['game_id']) {
|
|
|
$sql = "{$channelData} UNION ALL {$depositData} UNION ALL {$superSignDataPay} UNION ALL {$spreadDataPay} UNION ALL {$bindRechargeData} UNION ALL {$testorderData}";
|
|
|
} else {
|
|
|
$sql = "{$channelData} UNION ALL {$depositData} UNION ALL {$testorderData}";
|
|
|
}
|
|
|
|
|
|
//将语句整合起来查询
|
|
|
$channelData = "select sum(pay_amount) as pay_amount,pay_way from ({$sql})t group by pay_way;";
|
|
|
// var_dump($channelData);die();
|
|
|
$channelData = M()->query($channelData);
|
|
|
|
|
|
return $channelData;
|
|
|
}
|
|
|
|
|
|
public function gameDetail($p=1) {
|
|
|
|
|
|
if (isset($_REQUEST['row'])) {
|
|
|
$row = $_REQUEST['row'];
|
|
|
} else {
|
|
|
$row = 10;
|
|
|
}
|
|
|
$map = [];
|
|
|
$coinMap = [];
|
|
|
|
|
|
$model = 'spend';
|
|
|
|
|
|
if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$map['pay_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_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_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]);
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['pay_order_number'])) {
|
|
|
$map['pay_order_number'] = array('like',"{$_REQUEST['pay_order_number']}%");
|
|
|
$coinMap['pay_order_number'] = array('like',"{$_REQUEST['pay_order_number']}%");
|
|
|
$spreadMap['pay_order_number'] = array('like',"{$_REQUEST['pay_order_number']}%");
|
|
|
$offcialmap['pay_order_number'] = array('like',"{$_REQUEST['pay_order_number']}%");
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like',"{$_REQUEST['user_account']}%");
|
|
|
$coinMap['tab_deposit.user_account'] = array('like',"{$_REQUEST['user_account']}%");
|
|
|
}
|
|
|
$coinMap['tab_deposit.pay_way'] =$spreadMap['pay_way']=$map['pay_way'] = array('egt',1);
|
|
|
$offcialmap['pay_way'] = array('egt',1);
|
|
|
if (!empty($_REQUEST['pay_way']) || $_REQUEST['pay_way']=='0') {
|
|
|
if ($_REQUEST['pay_way']=="2") {
|
|
|
$_REQUEST['pay_way'] = ['in', '2,3,4'];
|
|
|
}
|
|
|
$map['pay_way'] = $_REQUEST['pay_way'];
|
|
|
$coinMap['tab_deposit.pay_way'] = $_REQUEST['pay_way'];
|
|
|
$spreadMap['pay_way'] = $_REQUEST['pay_way'];
|
|
|
$offcialmap['pay_way'] = $_REQUEST['pay_way'];
|
|
|
}
|
|
|
$_REQUEST['game_id']?$map['game_id'] = $_REQUEST['game_id']:false;
|
|
|
$_REQUEST['game_id']?$coinMap['game_id'] = $_REQUEST['game_id']:false;
|
|
|
|
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
|
$_REQUEST['model']?$model= $_REQUEST['model']:false;
|
|
|
|
|
|
$page = $p ? $p : 1; //默认显示第一页数据
|
|
|
|
|
|
// setPowerPromoteIds($map,'promote_id');
|
|
|
// setPowerPromoteIds($coinMap,'tab_deposit.promote_id');
|
|
|
|
|
|
$spendData = M('spend','tab_')
|
|
|
->field("pay_order_number,pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,cost,pay_amount,pay_way,sdk_version")
|
|
|
->where($map)
|
|
|
->select(false);
|
|
|
// var_dump($spendData);die();
|
|
|
$coinMap['pay_status'] = 1;
|
|
|
$coinMap['pay_source'] = 2;
|
|
|
$coinMap['extend'] = '';
|
|
|
$coinData = M('pay_info','tab_')
|
|
|
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
|
|
|
->field("pay_order_number,tab_deposit.create_time as pay_time,tab_deposit.user_account,tab_pay_info.game_name,tab_deposit.promote_account,
|
|
|
tab_deposit.pay_ip as spend_ip,tab_pay_info.server_name,tab_pay_info.game_player_name,tab_pay_info.sdk_version,
|
|
|
tab_deposit.pay_amount as cost,tab_deposit.pay_amount,tab_deposit.pay_way")
|
|
|
->where($coinMap)
|
|
|
->select(false);
|
|
|
|
|
|
$spreadMap['order_status'] = array('egt',1);
|
|
|
// setPowerPromoteIds($spreadMap,'promote_id');
|
|
|
// $spreadMap['pay_way'] = array('egt',1);
|
|
|
$coin_pay_order = M('coin_pay_order','tab_')
|
|
|
->field("pay_order_number,create_time as pay_time,promote_account,pay_amount,real_amount as cost,pay_way")
|
|
|
->where($spreadMap)
|
|
|
->select(false);
|
|
|
|
|
|
//官网数据
|
|
|
$offcialmap['pay_status'] = 1;
|
|
|
$offcialmap['pay_source'] = 0;
|
|
|
// setPowerPromoteIds($offcialmap,'promote_id');
|
|
|
|
|
|
$offcialData = M('deposit','tab_')
|
|
|
->field("pay_order_number,create_time as pay_time,user_account,promote_account,pay_ip as spend_ip,pay_amount as cost,pay_amount,pay_way")
|
|
|
->where($offcialmap)
|
|
|
->select(false);
|
|
|
|
|
|
if ($map['user_account']) {
|
|
|
$map['account'] = $map['user_account'];
|
|
|
unset($map['user_account']);
|
|
|
}
|
|
|
if ($map['pay_order_number']){
|
|
|
$map['order_id'] = $map['pay_order_number'];
|
|
|
unset($map['pay_order_number']);
|
|
|
}
|
|
|
|
|
|
// unset($map['promote_id']);
|
|
|
//超级签数据
|
|
|
$superSignData = M('game_supersign','tab_')
|
|
|
->field("order_id as pay_order_number,pay_time,tab_user.account as user_account,tab_user.promote_account,pay_price as cost,pay_price as pay_amount,pay_way")
|
|
|
->join('inner join tab_user on tab_user.id=tab_game_supersign.user_id')
|
|
|
->where($map)
|
|
|
->select(false);
|
|
|
|
|
|
if ($model == 'spend') {
|
|
|
$unionSql = "{$spendData} UNION ALL {$coinData}";
|
|
|
} elseif($model == 'coin_pay_order') {
|
|
|
$unionSql = "{$coin_pay_order}";
|
|
|
} elseif($model == 'deposit') {
|
|
|
$unionSql = "{$offcialData}";
|
|
|
} elseif($model == 'game_supersign') {
|
|
|
$unionSql = "{$superSignData}";
|
|
|
}
|
|
|
|
|
|
$page = ($page-1) * $row;
|
|
|
$sql = "select * from ({$unionSql})t order by pay_time DESC limit {$page},{$row};";
|
|
|
|
|
|
$data = M()->query($sql);
|
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
$data[$key]['pay_time'] = date('Y-m-d H:i:s',$value['pay_time']);
|
|
|
|
|
|
if ($model == 'spend') {
|
|
|
$data[$key]['game_name'] =clearGameNameType($data[$key]['game_name']);
|
|
|
$data[$key]['sdk_version'] =getGameTypeName($data[$key]['sdk_version']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$sql = "select count(1) as count from ({$unionSql})t;";
|
|
|
$count = M()->query($sql);
|
|
|
$count = $count[0]['count'];
|
|
|
|
|
|
$page = set_pagination($count, $row);
|
|
|
if ($page) {
|
|
|
$this->assign('_page', $page);
|
|
|
}
|
|
|
|
|
|
//总计金额逻辑
|
|
|
if ($model == 'spend') {
|
|
|
$unionSql = "{$spendData}";
|
|
|
} elseif($model == 'coin_pay_order') {
|
|
|
$unionSql = "{$coin_pay_order}";
|
|
|
} elseif($model == 'deposit') {
|
|
|
$unionSql = "{$offcialData}";
|
|
|
} elseif($model == 'game_supersign') {
|
|
|
$unionSql = "{$superSignData}";
|
|
|
}
|
|
|
|
|
|
$sql = "select sum(pay_amount) as pay_amount,pay_way from ({$unionSql})t group by pay_way;";
|
|
|
$sumData = M()->query($sql);
|
|
|
|
|
|
$sumAllData['pay_amount'] = 0;
|
|
|
$sumAllData['platform_amount'] = 0;
|
|
|
|
|
|
if ($model == 'spend') {
|
|
|
$sumAllData['platform_amount'] = M('pay_info','tab_')
|
|
|
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
|
|
|
->where($coinMap)
|
|
|
->sum('tab_deposit.pay_amount');
|
|
|
}
|
|
|
|
|
|
$sumAllData['platform_amount'] = $sumAllData['platform_amount']?$sumAllData['platform_amount']:0;
|
|
|
|
|
|
foreach ($sumData as $key => $value) {
|
|
|
if ($value['pay_way']>=1) {
|
|
|
if($model == 'deposit'||$model == 'coin_pay_order') {
|
|
|
$sumAllData['platform_amount'] += $value['pay_amount'];
|
|
|
} else {
|
|
|
$sumAllData['pay_amount'] += $value['pay_amount'];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$sumAllData['pay_amount'] = number_format($sumAllData['pay_amount'],2,'.','');;
|
|
|
$sumAllData['platform_amount'] = number_format($sumAllData['platform_amount'],2,'.','');;
|
|
|
|
|
|
$this->meta_title = "游戏订单查看";
|
|
|
$sumAllData['sum'] = number_format($sumAllData['bind_amount']+$sumAllData['platform_amount']+$sumAllData['pay_amount'],2,'.','');
|
|
|
// var_dump($sumAllData);die();
|
|
|
$this->assign('sumAllData',$sumAllData);
|
|
|
$this->assign('data',$data);
|
|
|
$this->display();
|
|
|
}
|
|
|
|
|
|
public function export_gameDatail() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
$map = [];
|
|
|
$coinMap = [];
|
|
|
|
|
|
$model = 'spend';
|
|
|
|
|
|
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]);
|
|
|
$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()]);
|
|
|
$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));
|
|
|
$spreadMap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
|
|
|
$offcialmap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['pay_order_number'])) {
|
|
|
$map['pay_order_number'] = array('like',"{$_REQUEST['pay_order_number']}%");
|
|
|
$coinMap['pay_order_number'] = array('like',"{$_REQUEST['pay_order_number']}%");
|
|
|
$spreadMap['pay_order_number'] = array('like',"{$_REQUEST['pay_order_number']}%");
|
|
|
$offcialmap['pay_order_number'] = array('like',"{$_REQUEST['pay_order_number']}%");
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like',"{$_REQUEST['user_account']}%");
|
|
|
$coinMap['tab_deposit.user_account'] = array('like',"{$_REQUEST['user_account']}%");
|
|
|
}
|
|
|
$coinMap['tab_deposit.pay_way'] =$spreadMap['pay_way']=$map['pay_way'] = array('egt',1);
|
|
|
$offcialmap['pay_way'] = array('egt',1);
|
|
|
if (!empty($_REQUEST['pay_way']) || $_REQUEST['pay_way']=='0') {
|
|
|
$map['pay_way'] = $_REQUEST['pay_way'];
|
|
|
$coinMap['tab_deposit.pay_way'] = $_REQUEST['pay_way'];
|
|
|
$spreadMap['pay_way'] = $_REQUEST['pay_way'];
|
|
|
$offcialmap['pay_way'] = $_REQUEST['pay_way'];
|
|
|
}
|
|
|
$_REQUEST['game_id']?$map['game_id'] = $_REQUEST['game_id']:false;
|
|
|
$_REQUEST['game_id']?$coinMap['game_id'] = $_REQUEST['game_id']:false;
|
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
// setPowerPromoteIds($map,'promote_id');
|
|
|
// setPowerPromoteIds($coinMap,'tab_deposit.promote_id');
|
|
|
|
|
|
// $_REQUEST['model']?$model= $_REQUEST['model']:false;
|
|
|
if ($_REQUEST['model']) {
|
|
|
$model= $_REQUEST['model'];
|
|
|
}
|
|
|
|
|
|
$spendData = M('spend','tab_')
|
|
|
->field("pay_order_number,pay_time,user_account,game_name,sdk_version,promote_account,spend_ip,server_name,game_player_name,cost,pay_amount,pay_way")
|
|
|
->where($map)
|
|
|
->select(false);
|
|
|
// var_dump($spendData);die();
|
|
|
$coinMap['pay_status'] = 1;
|
|
|
$coinMap['pay_source'] = 2;
|
|
|
$coinMap['extend'] = '';
|
|
|
|
|
|
$coinData = M('pay_info','tab_')
|
|
|
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
|
|
|
->field("pay_order_number,tab_deposit.create_time as pay_time,tab_deposit.user_account,tab_pay_info.game_name,tab_pay_info.sdk_version,tab_deposit.promote_account,
|
|
|
tab_deposit.pay_ip as spend_ip,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")
|
|
|
->where($coinMap)
|
|
|
->select(false);
|
|
|
|
|
|
$spreadMap['order_status'] = array('egt',1);
|
|
|
// setPowerPromoteIds($spreadMap,'promote_id');
|
|
|
|
|
|
$coin_pay_order = M('coin_pay_order','tab_')
|
|
|
->field("pay_order_number,create_time as pay_time,promote_account,pay_amount as cost,real_amount as pay_amount,pay_way")
|
|
|
->where($spreadMap)
|
|
|
->select(false);
|
|
|
|
|
|
//官网数据
|
|
|
$offcialmap['pay_status'] = 1;
|
|
|
$offcialmap['pay_source'] = 0;
|
|
|
// setPowerPromoteIds($offcialmap,'promote_id');
|
|
|
|
|
|
$offcialData = M('deposit','tab_')
|
|
|
->field("pay_order_number,create_time as pay_time,user_account,promote_account,pay_ip as spend_ip,pay_amount as cost,pay_amount,pay_way")
|
|
|
->where($offcialmap)
|
|
|
->select(false);
|
|
|
|
|
|
if ($map['user_account']) {
|
|
|
$map['account'] = $map['user_account'];
|
|
|
unset($map['user_account']);
|
|
|
}
|
|
|
if ($map['pay_order_number']){
|
|
|
$map['order_id'] = $map['pay_order_number'];
|
|
|
unset($map['pay_order_number']);
|
|
|
}
|
|
|
|
|
|
// unset($map['promote_id']);
|
|
|
//超级签数据
|
|
|
$superSignData = M('game_supersign','tab_')
|
|
|
->field("order_id as pay_order_number,pay_time,tab_user.account as user_account,tab_user.promote_account,pay_price as cost,pay_price as pay_amount,pay_way")
|
|
|
->join('inner join tab_user on tab_user.id=tab_game_supersign.user_id')
|
|
|
->where($map)
|
|
|
->select(false);
|
|
|
|
|
|
if ($model == 'spend') {
|
|
|
|
|
|
$xlsCell = array('支付订单号', '充值时间', '玩家账号', '游戏名称', '设备名称','所属推广员', '充值ip', '游戏区服', '角色名称', '订单金额', '实付金额', '充值方式');
|
|
|
$unionSql = "{$spendData} UNION ALL {$coinData}";
|
|
|
} elseif($model == 'coin_pay_order') {
|
|
|
$xlsCell = array('支付订单号', '充值时间', '所属推广员', '订单金额', '实付金额', '充值方式');
|
|
|
$unionSql = "{$coin_pay_order}";
|
|
|
} elseif($model == 'deposit') {
|
|
|
$xlsCell = array('支付订单号', '充值时间', '玩家账号', '所属推广员', '充值ip', '订单金额', '实付金额', '充值方式');
|
|
|
$unionSql = "{$offcialData}";
|
|
|
} elseif($model == 'game_supersign') {
|
|
|
$xlsCell = array('支付订单号', '充值时间', '玩家账号', '所属推广员', '订单金额', '实付金额', '充值方式');
|
|
|
$unionSql = "{$superSignData}";
|
|
|
}
|
|
|
|
|
|
$sql = "select count(1) as count from ({$unionSql})t;";
|
|
|
$count = M()->query($sql);
|
|
|
$accessNum = $count[0]['count'];
|
|
|
|
|
|
$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流中
|
|
|
|
|
|
$perSize = 50000;//每次查询的条数
|
|
|
$pages = ceil($accessNum / $perSize);
|
|
|
for($i = 1; $i <= $pages; $i++) {
|
|
|
|
|
|
$page = ($i-1)*$perSize;
|
|
|
|
|
|
$sql = "select * from ({$unionSql})t order by pay_time DESC limit {$page},{$perSize};";
|
|
|
|
|
|
$xlsData = M()->query($sql);
|
|
|
|
|
|
foreach ($xlsData as $k => $v) {
|
|
|
if ($model == 'spend') {
|
|
|
$v['game_name'] =clearGameNameType($v['game_name']);
|
|
|
$v['sdk_version'] =getGameTypeName($v['sdk_version']);
|
|
|
}
|
|
|
$v['pay_time'] = date('Y-m-d H:i:s',$v['pay_time']);
|
|
|
$v['pay_way'] = get_pay_way($v['pay_way']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
mb_convert_variables('GBK', 'UTF-8', $v);
|
|
|
fputcsv($fp, $v);
|
|
|
}
|
|
|
|
|
|
unset($xlsData);//释放变量的内存
|
|
|
//刷新输出缓冲到浏览器
|
|
|
ob_flush();
|
|
|
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
|
|
|
}
|
|
|
|
|
|
//总计金额逻辑
|
|
|
if ($model == 'spend') {
|
|
|
$unionSql = "{$spendData}";
|
|
|
} elseif($model == 'coin_pay_order') {
|
|
|
$unionSql = "{$coin_pay_order}";
|
|
|
} elseif($model == 'deposit') {
|
|
|
$unionSql = "{$offcialData}";
|
|
|
} elseif($model == 'game_supersign') {
|
|
|
$unionSql = "{$superSignData}";
|
|
|
}
|
|
|
|
|
|
$sql = "select sum(pay_amount) as pay_amount,pay_way from ({$unionSql})t group by pay_way;";
|
|
|
$sumData = M()->query($sql);
|
|
|
|
|
|
$sumAllData['pay_amount'] = 0;
|
|
|
$sumAllData['platform_amount'] = 0;
|
|
|
|
|
|
if ($model == 'spend') {
|
|
|
$sumAllData['platform_amount'] = M('pay_info','tab_')
|
|
|
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
|
|
|
->where($coinMap)
|
|
|
->sum('tab_deposit.pay_amount');
|
|
|
}
|
|
|
|
|
|
$sumAllData['platform_amount'] = $sumAllData['platform_amount']?$sumAllData['platform_amount']:0;
|
|
|
|
|
|
foreach ($sumData as $key => $value) {
|
|
|
if ($value['pay_way']>=1) {
|
|
|
if($model == 'deposit'||$model == 'coin_pay_order') {
|
|
|
$sumAllData['platform_amount'] += $value['pay_amount'];
|
|
|
} else {
|
|
|
$sumAllData['pay_amount'] += $value['pay_amount'];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$sumAllData['sum'] = $sumAllData['bind_amount']+$sumAllData['platform_amount']+$sumAllData['pay_amount'];
|
|
|
|
|
|
$sumDatas['pay_order_number'] = "总计";
|
|
|
|
|
|
$sumDatas['pay_time'] = "累计充值:{$sumAllData['sum']} 现金:{$sumAllData['pay_amount']} 平台币:{$sumAllData['platform_amount']}";
|
|
|
mb_convert_variables('GBK', 'UTF-8',$sumDatas);
|
|
|
fputcsv($fp, $sumDatas);
|
|
|
|
|
|
exit();
|
|
|
|
|
|
}
|
|
|
|
|
|
public function testDetail($p=1) {
|
|
|
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
|
|
|
if (isset($_REQUEST['row'])) {
|
|
|
$row = $_REQUEST['row'];
|
|
|
} else {
|
|
|
$row = 10;
|
|
|
}
|
|
|
|
|
|
$map = [];
|
|
|
|
|
|
if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$map['pay_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()]);
|
|
|
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$map['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['pay_order_number'])) {
|
|
|
$map['pay_order_number'] = array('like',"{$_REQUEST['pay_order_number']}%");
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['order_number'])) {
|
|
|
$map['order_number'] = array('like',"{$_REQUEST['order_number']}%");
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['user_account'])) {
|
|
|
$map['tab_spend.user_account'] = array('like',"{$_REQUEST['user_account']}%");
|
|
|
}
|
|
|
$map['pay_status'] = $coinMap['tab_deposit.pay_status'] = 1;
|
|
|
$map['pay_way'] = array('egt',1);
|
|
|
|
|
|
if ($_REQUEST['pay_way'] || $_REQUEST['pay_way']=='0') {
|
|
|
$map['pay_way'] = $_REQUEST['pay_way'];
|
|
|
}
|
|
|
|
|
|
$model = $_REQUEST['model']?$_REQUEST['model']:'spend';
|
|
|
|
|
|
$data = [];
|
|
|
|
|
|
if ($model == 'spend') {
|
|
|
|
|
|
if ($_REQUEST['game_id']) {
|
|
|
$map['game_id'] = $_REQUEST['game_id'];
|
|
|
}
|
|
|
// setPowerPromoteIds($map,'promote_id');
|
|
|
$data = M('spend','tab_')
|
|
|
->field("pay_order_number,order_number,tab_spend.user_account,pay_time,game_name,server_name,game_player_name,cost,pay_amount,pay_way as pay_type,pay_way,pay_game_status,sdk_version")
|
|
|
->join('inner join tab_test_white_list on tab_spend.user_id=tab_test_white_list.user_id')
|
|
|
->where($map)
|
|
|
// ->order('tab_spend.id DESC')
|
|
|
->select(false);
|
|
|
|
|
|
if ($map['user_account']) {
|
|
|
$map['tab_deposit.user_account'] = $map['user_account'];
|
|
|
}
|
|
|
|
|
|
$map['user_account'] = $map['tab_spend.user_account'];
|
|
|
unset($map['tab_spend.user_account']);
|
|
|
$coinMap = $map;
|
|
|
$map['tab_spend.user_account'] = array('like',"{$_REQUEST['user_account']}%");
|
|
|
$coinMap['tab_deposit.pay_status'] = 1;
|
|
|
$coinMap['tab_deposit.pay_way'] = $map['pay_way'];
|
|
|
$coinMap['tab_deposit.user_account'] = $coinMap['user_account'];
|
|
|
unset($coinMap['user_account']);
|
|
|
|
|
|
if(!$coinMap['tab_deposit.user_account']) {
|
|
|
unset($coinMap['tab_deposit.user_account']);
|
|
|
}
|
|
|
|
|
|
if (!$map['user_account']) {
|
|
|
unset($map['user_account']);
|
|
|
}
|
|
|
|
|
|
unset($coinMap['pay_status']);
|
|
|
unset($coinMap['pay_way']);
|
|
|
|
|
|
if ($map['pay_time']) {
|
|
|
$coinMap['tab_deposit.create_time'] = $map['pay_time'];
|
|
|
unset($coinMap['pay_time']);
|
|
|
}
|
|
|
// unset($coinMap['promote_id']);
|
|
|
// setPowerPromoteIds($coinMap,'tab_deposit.promote_id');
|
|
|
|
|
|
$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,tab_pay_info.sdk_version")
|
|
|
->where($coinMap)
|
|
|
->select(false);
|
|
|
|
|
|
// var_dump($coinData);die();
|
|
|
|
|
|
$page = ($page-1) * $row;
|
|
|
$count = "select count(*) as count from ({$data} UNION ALL {$coinData})t;";
|
|
|
|
|
|
$data = "select * from ({$data} UNION ALL {$coinData})t limit {$page},{$row};";
|
|
|
|
|
|
$data = M()->query($data);
|
|
|
|
|
|
|
|
|
$count = M()->query($count);
|
|
|
$count = $count[0]['count'];
|
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
|
if(!$value['order_number']) {
|
|
|
$data[$key]['order_number'] = '无';
|
|
|
}
|
|
|
|
|
|
$data[$key]['pay_time'] = Date('Y-m-d H:i:s',$value['pay_time']);
|
|
|
|
|
|
$data[$key]['pay_type'] = get_pay_way($value['pay_type']);
|
|
|
|
|
|
$data[$key]['game_name'] =clearGameNameType($data[$key]['game_name']);
|
|
|
$data[$key]['sdk_version'] =getGameTypeName($data[$key]['sdk_version']);
|
|
|
|
|
|
if ($value['pay_way']==1 || $value['pay_way']==9 ) {
|
|
|
$data[$key]['pay_way'] = '支付宝';
|
|
|
} else if ($value['pay_way']==2 || $value['pay_way']==3 ) {
|
|
|
$data[$key]['pay_way'] = '微信支付';
|
|
|
} else if ($value['pay_way']==15) {
|
|
|
$data[$key]['pay_way'] = '快捷支付';
|
|
|
} else if ($value['pay_way']==7) {
|
|
|
$data[$key]['pay_way'] = '苹果支付';
|
|
|
} else if ($value['pay_way']==17) {
|
|
|
$data[$key]['pay_way'] = '易宝支付';
|
|
|
} else if($value['pay_way']){
|
|
|
$data[$key]['pay_way'] = '其他支付';
|
|
|
}
|
|
|
|
|
|
if ($value['pay_game_status'] == '0') {
|
|
|
$data[$key]['pay_game_status'] = '失败';
|
|
|
} else if ($value['pay_game_status'] == 1) {
|
|
|
$data[$key]['pay_game_status'] = '成功';
|
|
|
} else if ($value['pay_game_status'] == 2) {
|
|
|
$data[$key]['pay_game_status'] = '已退款';
|
|
|
} else if (!$value['pay_game_status']) {
|
|
|
$data[$key]['pay_game_status'] = '无';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$field = "sum(cost) as cost,sum(pay_amount) as pay_amount,pay_way";
|
|
|
|
|
|
$coinDataSum = 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($coinMap)
|
|
|
->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($coinMap)
|
|
|
->group('pay_way')
|
|
|
->select(false);
|
|
|
|
|
|
} elseif($model == 'game_supersign') {
|
|
|
if ($map['pay_order_number']) {
|
|
|
$map['order_id'] = $map['pay_order_number'];
|
|
|
unset($map['pay_order_number']);
|
|
|
}
|
|
|
|
|
|
if ($map['user_account']) {
|
|
|
$map['account'] = $map['user_account'];
|
|
|
unset($map['user_account']);
|
|
|
}
|
|
|
|
|
|
if ($_REQUEST['game_id']) {
|
|
|
$map['game_id'] = $_REQUEST['game_id'];
|
|
|
}
|
|
|
|
|
|
$map['tab_game_supersign.pay_status'] = $map['pay_status'];
|
|
|
unset($map['pay_status']);
|
|
|
|
|
|
$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")
|
|
|
->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')
|
|
|
->page($page, $row)
|
|
|
->where($map)
|
|
|
->order('tab_game_supersign.id DESC')
|
|
|
->select();
|
|
|
|
|
|
foreach($data as $key => $value) {
|
|
|
|
|
|
$data[$key]['pay_time'] = Date('Y-m-d H:i:s',$value['pay_time']);
|
|
|
|
|
|
$data[$key]['pay_type'] = get_pay_way($value['pay_type']);
|
|
|
$data[$key]['game_name'] =clearGameNameType($data[$key]['game_name']);
|
|
|
$data[$key]['sdk_version'] ="苹果";
|
|
|
|
|
|
if ($value['pay_way']==1 || $value['pay_way']==9 ) {
|
|
|
$data[$key]['pay_way'] = '支付宝';
|
|
|
} else if ($value['pay_way']==2 || $value['pay_way']==3 ) {
|
|
|
$data[$key]['pay_way'] = '微信支付';
|
|
|
} else if ($value['pay_way']==15) {
|
|
|
$data[$key]['pay_way'] = '快捷支付';
|
|
|
} else if ($value['pay_way']==7) {
|
|
|
$data[$key]['pay_way'] = '苹果支付';
|
|
|
} else if ($value['pay_way']==17) {
|
|
|
$data[$key]['pay_way'] = '易宝支付';
|
|
|
} else if($value['pay_way']){
|
|
|
$data[$key]['pay_way'] = '其他支付';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$count = 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")
|
|
|
->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)
|
|
|
->order('tab_game_supersign.id DESC')
|
|
|
->count();
|
|
|
|
|
|
$field = "sum(pay_price) as cost,sum(pay_price) as pay_amount,pay_way";
|
|
|
} elseif($model == 'deposit') {
|
|
|
$map['pay_source'] = 0;
|
|
|
if ($map['pay_time']) {
|
|
|
$map['create_time'] = $map['pay_time'];
|
|
|
unset($map['pay_time']);
|
|
|
}
|
|
|
// setPowerPromoteIds($map,'tab_deposit.promote_id');
|
|
|
$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();
|
|
|
|
|
|
foreach($data as $key => $value) {
|
|
|
|
|
|
$data[$key]['pay_time'] = Date('Y-m-d H:i:s',$value['pay_time']);
|
|
|
|
|
|
$data[$key]['pay_type'] = get_pay_way($value['pay_type']);
|
|
|
|
|
|
if ($value['pay_way']==1 || $value['pay_way']==9 ) {
|
|
|
$data[$key]['pay_way'] = '支付宝';
|
|
|
} else if ($value['pay_way']==2 || $value['pay_way']==3 ) {
|
|
|
$data[$key]['pay_way'] = '微信支付';
|
|
|
} else if ($value['pay_way']==15) {
|
|
|
$data[$key]['pay_way'] = '快捷支付';
|
|
|
} else if ($value['pay_way']==7) {
|
|
|
$data[$key]['pay_way'] = '苹果支付';
|
|
|
} else if ($value['pay_way']==17) {
|
|
|
$data[$key]['pay_way'] = '易宝支付';
|
|
|
} else if($value['pay_way']){
|
|
|
$data[$key]['pay_way'] = '其他支付';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$count = 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)
|
|
|
->order('tab_deposit.id DESC')
|
|
|
->count();
|
|
|
|
|
|
$field = "sum(pay_amount) as cost,sum(pay_amount) as pay_amount,pay_way";
|
|
|
}
|
|
|
|
|
|
$sumAllData = M($model,'tab_')
|
|
|
->field($field)
|
|
|
->join('inner join tab_test_white_list on tab_'.$model.'.user_id=tab_test_white_list.user_id')
|
|
|
->where($map)
|
|
|
->find();
|
|
|
|
|
|
$sumData = M($model,'tab_')
|
|
|
->field($field)
|
|
|
->join('inner join tab_test_white_list on tab_'.$model.'.user_id=tab_test_white_list.user_id')
|
|
|
->where($map)
|
|
|
->group('pay_way')
|
|
|
->select(false);
|
|
|
if ($model == 'spend') {
|
|
|
$sumData = "{$sumData} union all {$coinDataSumSql}";
|
|
|
|
|
|
$sumAllData['pay_amount'] += $coinDataSum['pay_amount'];
|
|
|
$sumAllData['cost'] += $coinDataSum['cost'];
|
|
|
}
|
|
|
|
|
|
$sumAllData['pay_amount'] = number_format($sumAllData['pay_amount'],2,'.','');
|
|
|
$sumAllData['cost'] = number_format($sumAllData['cost'],2,'.','');
|
|
|
|
|
|
|
|
|
$this->assign('sumAllData',$sumAllData);
|
|
|
|
|
|
|
|
|
$sumData = "select cost,sum(pay_amount) as pay_amount,pay_way from ({$sumData})t group by pay_way";
|
|
|
|
|
|
$sumData = M()->query($sumData);
|
|
|
|
|
|
$payTypeData['支付宝支付金额'] = 0;
|
|
|
$payTypeData['微信支付金额'] = 0;
|
|
|
$payTypeData['快捷支付金额'] = 0;
|
|
|
$payTypeData['苹果支付金额'] = 0;
|
|
|
$payTypeData['易宝支付金额'] = 0;
|
|
|
$payTypeData['其他支付金额'] = 0;
|
|
|
|
|
|
foreach($sumData as $key => $value) {
|
|
|
|
|
|
if ($value['pay_way']==1 || $value['pay_way']==9 ) {
|
|
|
$payTypeData['支付宝支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if ($value['pay_way']==2 || $value['pay_way']==3 ) {
|
|
|
$payTypeData['微信支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if ($value['pay_way']==15) {
|
|
|
$payTypeData['快捷支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if ($value['pay_way']==7) {
|
|
|
$payTypeData['苹果支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if ($value['pay_way']==17) {
|
|
|
$payTypeData['易宝支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if($value['pay_way']){
|
|
|
$payTypeData['其他支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$payTypeData['支付宝支付金额'] = number_format($payTypeData['支付宝支付金额'],2,'.','');
|
|
|
$payTypeData['微信支付金额'] = number_format($payTypeData['微信支付金额'],2,'.','');
|
|
|
$payTypeData['快捷支付金额'] = number_format($payTypeData['快捷支付金额'],2,'.','');
|
|
|
$payTypeData['其他支付金额'] = number_format($payTypeData['其他支付金额'],2,'.','');
|
|
|
$payTypeData['苹果支付金额'] = number_format($payTypeData['苹果支付金额'],2,'.','');
|
|
|
$payTypeData['易宝支付金额'] = number_format($payTypeData['易宝支付金额'],2,'.','');
|
|
|
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
if (!$value['pay_way']) {
|
|
|
unset($sumData[$key]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$page = set_pagination($count, $row);
|
|
|
if ($page) {
|
|
|
$this->assign('_page', $page);
|
|
|
}
|
|
|
|
|
|
$this->meta_title = "测试统计";
|
|
|
|
|
|
$this->assign('sumData',$sumData);
|
|
|
|
|
|
$this->assign('data',$data);
|
|
|
|
|
|
$this->display();
|
|
|
}
|
|
|
|
|
|
public function export_testDetail() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
$map = [];
|
|
|
|
|
|
if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$map['pay_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()]);
|
|
|
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$map['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['pay_order_number'])) {
|
|
|
$map['pay_order_number'] = array('like',"{$_REQUEST['pay_order_number']}%");
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['order_number'])) {
|
|
|
$map['order_number'] = array('like',"{$_REQUEST['order_number']}%");
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like',"{$_REQUEST['user_account']}%");
|
|
|
}
|
|
|
|
|
|
$map['pay_status'] = $coinMap['tab_deposit.pay_status'] = 1;
|
|
|
$map['pay_way'] = array('egt',1);
|
|
|
$model = $_REQUEST['model']?$_REQUEST['model']:'spend';
|
|
|
|
|
|
if ($_REQUEST['pay_way'] || $_REQUEST['pay_way']=='0') {
|
|
|
$map['pay_way'] = $_REQUEST['pay_way'];
|
|
|
}
|
|
|
|
|
|
$data = [];
|
|
|
|
|
|
$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流
|
|
|
|
|
|
$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'];
|
|
|
}
|
|
|
// setPowerPromoteIds($map,'promote_id');
|
|
|
|
|
|
$data = M('spend','tab_')
|
|
|
->field("pay_order_number,order_number,user_account,pay_time,game_name,sdk_version,server_name,game_player_name,cost,pay_amount,pay_way as pay_type,pay_way,pay_game_status")
|
|
|
->join('inner join tab_test_white_list on tab_spend.user_id=tab_test_white_list.user_id')
|
|
|
->where($map)
|
|
|
// ->order('tab_spend.id DESC')
|
|
|
->select(false);
|
|
|
|
|
|
// if ($map['user_account']) {
|
|
|
// $map['tab_deposit.user_account'] = $map['user_account'];
|
|
|
// }
|
|
|
|
|
|
$map['user_account'] = $map['tab_spend.user_account'];
|
|
|
unset($map['tab_spend.user_account']);
|
|
|
|
|
|
$coinMap = $map;
|
|
|
|
|
|
$coinMap['tab_deposit.pay_status'] = 1;
|
|
|
$coinMap['tab_deposit.pay_way'] = $map['pay_way'];
|
|
|
|
|
|
|
|
|
unset($coinMap['pay_status']);
|
|
|
unset($coinMap['pay_way']);
|
|
|
$coinMap['tab_deposit.user_account'] = $coinMap['user_account'];
|
|
|
unset($coinMap['user_account']);
|
|
|
|
|
|
if(!$coinMap['tab_deposit.user_account']) {
|
|
|
unset($coinMap['tab_deposit.user_account']);
|
|
|
}
|
|
|
|
|
|
if (!$map['user_account']) {
|
|
|
unset($map['user_account']);
|
|
|
}
|
|
|
|
|
|
if($map['pay_time']) {
|
|
|
$coinMap['tab_deposit.create_time'] = $map['pay_time'];
|
|
|
unset($coinMap['pay_time']);
|
|
|
}
|
|
|
|
|
|
// unset($coinMap['promote_id']);
|
|
|
// setPowerPromoteIds($coinMap,'tab_deposit.promote_id');
|
|
|
|
|
|
$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.sdk_version,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($coinMap)
|
|
|
->select(false);
|
|
|
|
|
|
$count = "select count(*) as count from ({$data} UNION ALL {$coinData})t;";
|
|
|
|
|
|
$count = M()->query($count);
|
|
|
$accessNum = $count[0]['count'];
|
|
|
|
|
|
$pages = ceil($accessNum / $perSize);
|
|
|
|
|
|
for($i = 1; $i <= $pages; $i++) {
|
|
|
|
|
|
$page = ($i - 1) * $perSize;
|
|
|
|
|
|
$data = "select * from ({$data} UNION ALL {$coinData})t limit {$page},{$perSize};";
|
|
|
$data = M()->query($data);
|
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
|
$value['pay_order_number'] = "'".$value['pay_order_number'];
|
|
|
$value['order_number'] = "'".$value['order_number'];
|
|
|
$value['game_name'] =clearGameNameType($value['game_name']);
|
|
|
$value['sdk_version'] =getGameTypeName($value['sdk_version']);
|
|
|
|
|
|
if (!$value['order_number']) {
|
|
|
$data[$key]['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']==7) {
|
|
|
$data[$key]['pay_way'] = '苹果支付';
|
|
|
} else if ($value['pay_way']==17) {
|
|
|
$data[$key]['pay_way'] = '易宝支付';
|
|
|
} else if ($value['pay_way']) {
|
|
|
$value['pay_way'] = '其他支付';
|
|
|
}
|
|
|
|
|
|
if ($value['pay_game_status'] == '0') {
|
|
|
$value['pay_game_status'] = '失败';
|
|
|
} else if ($value['pay_game_status'] == 1) {
|
|
|
$value['pay_game_status'] = '成功';
|
|
|
} else if ($value['pay_game_status'] == 2) {
|
|
|
$value['pay_game_status'] = '已退款';
|
|
|
} else if (!$value['pay_game_status']) {
|
|
|
$value['pay_game_status'] = '无';
|
|
|
}
|
|
|
|
|
|
mb_convert_variables('GBK', 'UTF-8', $value);
|
|
|
fputcsv($fp, $value);
|
|
|
}
|
|
|
|
|
|
unset($data);//释放变量的内存
|
|
|
//刷新输出缓冲到浏览器
|
|
|
ob_flush();
|
|
|
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
|
|
|
}
|
|
|
|
|
|
$field = "sum(cost) as cost,sum(pay_amount) as pay_amount,pay_way";
|
|
|
|
|
|
$coinDataSum = 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($coinMap)
|
|
|
->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($coinMap)
|
|
|
->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']);
|
|
|
}
|
|
|
|
|
|
if ($map['user_account']) {
|
|
|
$map['account'] = $map['user_account'];
|
|
|
unset($map['user_account']);
|
|
|
}
|
|
|
|
|
|
if ($_REQUEST['game_id']) {
|
|
|
$map['game_id'] = $_REQUEST['game_id'];
|
|
|
}
|
|
|
|
|
|
$map['tab_game_supersign.pay_status'] = $map['pay_status'];
|
|
|
unset($map['pay_status']);
|
|
|
|
|
|
$accessNum = 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")
|
|
|
->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)
|
|
|
->order('tab_game_supersign.id DESC')
|
|
|
->count();
|
|
|
|
|
|
$pages = ceil($accessNum / $perSize);
|
|
|
|
|
|
for($i = 1; $i <= $pages; $i++) {
|
|
|
|
|
|
$page = ($i - 1) * $perSize;
|
|
|
|
|
|
$data = M('game_supersign', 'tab_')
|
|
|
->field("order_id as pay_order_number,account as user_account,pay_time,game_name,@t:='苹果' sdk_version,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)
|
|
|
->limit($page ,$perSize)
|
|
|
->order('tab_game_supersign.id DESC')
|
|
|
->select();
|
|
|
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['game_name'] =clearGameNameType($value['game_name']);
|
|
|
$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']==7) {
|
|
|
$data[$key]['pay_way'] = '苹果支付';
|
|
|
} else if ($value['pay_way']==17) {
|
|
|
$data[$key]['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_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']);
|
|
|
}
|
|
|
// setPowerPromoteIds($map,'tab_deposit.promote_id');
|
|
|
|
|
|
$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)
|
|
|
->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']==7) {
|
|
|
$data[$key]['pay_way'] = '苹果支付';
|
|
|
} else if ($value['pay_way']==17) {
|
|
|
$data[$key]['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";
|
|
|
}
|
|
|
|
|
|
$sumAllData = M($model,'tab_')
|
|
|
->field($field)
|
|
|
->join('inner join tab_test_white_list on tab_'.$model.'.user_id=tab_test_white_list.user_id')
|
|
|
->where($map)
|
|
|
->find();
|
|
|
|
|
|
$sumData = M($model,'tab_')
|
|
|
->field($field)
|
|
|
->join('inner join tab_test_white_list on tab_'.$model.'.user_id=tab_test_white_list.user_id')
|
|
|
->where($map)
|
|
|
->group('pay_way')
|
|
|
->select(false);
|
|
|
if ($model == 'spend') {
|
|
|
$sumData = "{$sumData} union all {$coinDataSumSql}";
|
|
|
|
|
|
$sumAllData['pay_amount'] += $coinDataSum['pay_amount'];
|
|
|
$sumAllData['cost'] += $coinDataSum['cost'];
|
|
|
}
|
|
|
|
|
|
|
|
|
$sumData = "select cost,sum(pay_amount) as pay_amount,pay_way from ({$sumData})t group by pay_way";
|
|
|
|
|
|
$sumData = M()->query($sumData);
|
|
|
|
|
|
$payTypeData['支付宝支付金额'] = 0;
|
|
|
$payTypeData['微信支付金额'] = 0;
|
|
|
$payTypeData['快捷支付金额'] = 0;
|
|
|
$payTypeData['其他支付金额'] = 0;
|
|
|
$payTypeData['苹果支付金额'] = number_format($payTypeData['苹果支付金额'],2,'.','');
|
|
|
$payTypeData['易宝支付金额'] = number_format($payTypeData['易宝支付金额'],2,'.','');
|
|
|
|
|
|
foreach($sumData as $key => $value) {
|
|
|
|
|
|
if ($value['pay_way']==1 || $value['pay_way']==9 ) {
|
|
|
$payTypeData['支付宝支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if ($value['pay_way']==2 || $value['pay_way']==3 ) {
|
|
|
$payTypeData['微信支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if ($value['pay_way']==15) {
|
|
|
$payTypeData['快捷支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if ($value['pay_way']==7) {
|
|
|
$payTypeData['苹果支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if ($value['pay_way']==17) {
|
|
|
$payTypeData['易宝支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
} else if($value['pay_way']){
|
|
|
$payTypeData['其他支付金额'] += number_format($value['pay_amount'],2,'.','');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
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']);
|
|
|
|
|
|
if (!$value['pay_way']) {
|
|
|
unset($sumData[$key]);
|
|
|
}
|
|
|
}
|
|
|
//总计
|
|
|
if ($model == 'spend') {
|
|
|
$sumAllDataother['pay_order_number'] = '总计';
|
|
|
$sumAllDataother['order_number'] = '------';
|
|
|
$sumAllDataother['user_account'] = '------';
|
|
|
$sumAllDataother['pay_time'] = '------';
|
|
|
$sumAllDataother['game_name'] = '------';
|
|
|
$sumAllDataother['sdk_version'] = '------';
|
|
|
$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);
|
|
|
|
|
|
}
|
|
|
function getGameList() {
|
|
|
|
|
|
if (I('partner_id')) {
|
|
|
$map['partner_id'] = I('partner_id');
|
|
|
}
|
|
|
if (I('sdk_type')) {
|
|
|
$map['sdk_version'] = I('sdk_type');
|
|
|
}
|
|
|
$data = M('game','tab_')->field("id,game_name")->where($map)->select();
|
|
|
|
|
|
$this->ajaxReturn($data,'json');
|
|
|
}
|
|
|
|
|
|
} |