|
|
|
@ -2468,17 +2468,24 @@ class ExportController extends Controller
|
|
|
|
|
array('sdk_version', '设备名称'),
|
|
|
|
|
array('order_amount', '订单金额'),
|
|
|
|
|
array('pay_amount', '实付金额'),
|
|
|
|
|
array('platform_type', '所属平台'),
|
|
|
|
|
array('pay_way', '充值方式'),
|
|
|
|
|
array('merchant_id', '所属商户'),
|
|
|
|
|
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]);
|
|
|
|
|
// }
|
|
|
|
|
$platformType = I('platform_type', 0);
|
|
|
|
|
$startedAt = I('timestart', '');
|
|
|
|
|
$endedAt = I('timeend', '');
|
|
|
|
|
$gameId = I('game_id', 0);
|
|
|
|
|
|
|
|
|
|
$gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->select();
|
|
|
|
|
$gameSets = index_by_column('game_id', $gameSets);
|
|
|
|
|
$aggGameIds = getAggExceptIds($gameSets);
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
|
$map['_string'] = '1=1';
|
|
|
|
|
|
|
|
|
|
if(isset($params['server_type'])) {
|
|
|
|
|
$map['t.server_type'] = $params['server_type'];
|
|
|
|
@ -2500,17 +2507,22 @@ class ExportController extends Controller
|
|
|
|
|
$map['t.pay_way'] = $params['pay_way'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!empty($params['timestart']) && !empty($params['timeend'])){
|
|
|
|
|
$timestart = strtotime($params['timestart']);
|
|
|
|
|
$timeend = strtotime($params['timeend'])+86399;
|
|
|
|
|
$map['t.pay_time'] = array("between",array($timestart,$timeend));
|
|
|
|
|
}else if(!empty($params['timestart']) && empty($params['timeend'])) {
|
|
|
|
|
$timestart = strtotime($params['timestart']);
|
|
|
|
|
$map['t.pay_time'] = array("EGT",$timestart);
|
|
|
|
|
}else if (!empty($params['timeend']) && empty($params['timestart'])) {
|
|
|
|
|
$timeend = strtotime($params['timeend'])+86399;
|
|
|
|
|
$map['t.pay_time'] = array("ELT",$timeend);
|
|
|
|
|
if ($startedAt != '') {
|
|
|
|
|
$map['_string'] .= ' and pay_time>=' . strtotime($startedAt . ' 00:00:00');
|
|
|
|
|
}
|
|
|
|
|
if ($endedAt != '') {
|
|
|
|
|
$map['_string'] .= ' and pay_time<=' . strtotime($endedAt . ' 23:59:59');
|
|
|
|
|
}
|
|
|
|
|
if ($platformType == 1) {
|
|
|
|
|
$map['_string'] .= ' and game_id not in(' . implode(',', $aggGameIds) . ')';
|
|
|
|
|
}
|
|
|
|
|
if ($platformType == 2) {
|
|
|
|
|
$map['_string'] .= ' and game_id in(' . implode(',', $aggGameIds) . ')';
|
|
|
|
|
}
|
|
|
|
|
if ($gameId != 0) {
|
|
|
|
|
$map['_string'] .= ' and game_id=' . $gameId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($_REQUEST['merchant_id']) {
|
|
|
|
|
$map['merchant_id'] = $_REQUEST['merchant_id'];
|
|
|
|
|
unset($_REQUEST['merchant_id']);
|
|
|
|
@ -2530,6 +2542,7 @@ class ExportController extends Controller
|
|
|
|
|
}else {
|
|
|
|
|
$order_list['server_type'] = '测试外网';
|
|
|
|
|
}
|
|
|
|
|
$order_list['platform_type'] = in_array($v['game_id'], $aggGameIds) ? '聚合' : '联运';
|
|
|
|
|
$order_list['game_name'] =clearGameNameType($v['game_name']);
|
|
|
|
|
$order_list['sdk_version'] =getGameTypeName($v['sdk_version']);
|
|
|
|
|
$order_list['order_type'] = get_order_type($v['order_type']);
|
|
|
|
@ -8329,7 +8342,7 @@ class ExportController extends Controller
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->where(['game_id' => ['in', $gameIds]])->select();
|
|
|
|
|
$gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->select();
|
|
|
|
|
$gameSets = index_by_column('game_id', $gameSets);
|
|
|
|
|
|
|
|
|
|
$searchGameCodes = [];
|
|
|
|
@ -8342,6 +8355,7 @@ class ExportController extends Controller
|
|
|
|
|
$searchGameCodes = M('game', 'tab_')->where(['id' => ['in', $searchGameIds], 'unique_code' => ['neq', '']])->getField('unique_code', true);
|
|
|
|
|
$searchGameCodes = array_unique($searchGameCodes);
|
|
|
|
|
$testWhere['game_id'] = ['in', $searchGameIds];
|
|
|
|
|
|
|
|
|
|
$testRows = M('test_order', 'tab_')
|
|
|
|
|
->field(['game_id', 'sum(pay_amount) amount'])
|
|
|
|
|
->where($testWhere)
|
|
|
|
@ -8373,6 +8387,7 @@ class ExportController extends Controller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$exceptIds = getAggExceptIds($gameSets);
|
|
|
|
|
|
|
|
|
|
foreach ($xlsData as $key => $value) {
|
|
|
|
|
$aggAmount = '0.00';
|
|
|
|
|
$aggFailAmount = '0.00';
|
|
|
|
@ -8384,7 +8399,6 @@ class ExportController extends Controller
|
|
|
|
|
}
|
|
|
|
|
$xlsData[$key]['agg_amount'] = $aggAmount;
|
|
|
|
|
$xlsData[$key]['agg_failed_amount'] = $aggFailAmount;
|
|
|
|
|
$xlsData[$key]['agg_failed_amount'] = '0.00';
|
|
|
|
|
if (isset($gameSets[$value['game_id']]) && isAggGame($gameSets[$value['game_id']]['pay_notify_url'])) {
|
|
|
|
|
$xlsData[$key]['cash_count'] = $value['cash_count'] = 0;
|
|
|
|
|
$xlsData[$key]['balance_coin_count'] =$value['balance_coin_count'] = 0;
|
|
|
|
@ -8411,6 +8425,7 @@ class ExportController extends Controller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$testWhere['_string'] .= ' and game_id in(' . implode(',', $exceptIds) . ')';
|
|
|
|
|
|
|
|
|
|
$testAllAmount = M('test_order', 'tab_')->where($testWhere)->sum('pay_amount');
|
|
|
|
|
|
|
|
|
|
$totalData = D("spend")->totalGameStatistics($map);
|
|
|
|
@ -8420,17 +8435,19 @@ class ExportController extends Controller
|
|
|
|
|
$sumInside = $totalData['inside_cash_count'];
|
|
|
|
|
$sumNoticeFail = $totalData['notice_fail_count']? $totalData['notice_fail_count']:0;
|
|
|
|
|
$sumAll = $sumCash + $sumBalance + $sumInside;
|
|
|
|
|
|
|
|
|
|
$sumData = [['game_name'=>'总计',
|
|
|
|
|
'cash_count'=>$sumCash,
|
|
|
|
|
'balance_coin_count'=>$sumBalance,
|
|
|
|
|
'inside_cash_count'=>$sumInside,
|
|
|
|
|
'all_cash_count'=>$sumAll,
|
|
|
|
|
'notice_fail_count'=>$sumNoticeFail,
|
|
|
|
|
'agg_amount' => $aggTotal,
|
|
|
|
|
'testAllAmount' => $testAllAmount,
|
|
|
|
|
'aggFailTotal' => $aggFailTotal,
|
|
|
|
|
]];
|
|
|
|
|
$sumData = [
|
|
|
|
|
[
|
|
|
|
|
'game_name'=>'总计',
|
|
|
|
|
'cash_count'=>$sumCash,
|
|
|
|
|
'balance_coin_count'=>$sumBalance,
|
|
|
|
|
'inside_cash_count'=>$sumInside,
|
|
|
|
|
'all_cash_count'=>$sumAll,
|
|
|
|
|
'notice_fail_count'=>$sumNoticeFail,
|
|
|
|
|
'agg_amount' => $aggTotal,
|
|
|
|
|
'test_amount' => round(floatval($testAllAmount), 2),
|
|
|
|
|
'agg_failed_amount' => $aggFailTotal,
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
$xlsData = array_merge($xlsData,$sumData);
|
|
|
|
|
$this->exportAddOperationLog("Finance/gameStatistics","充值-财务管理-游戏统计-导出");
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|