测试订单优化

master
ELF 4 years ago
parent a18e4188bd
commit 3c3222ad26

@ -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);

@ -768,6 +768,7 @@ class FinanceController extends ThinkController
$searchGameCodes = array_unique($searchGameCodes);
$testWhere['game_id'] = ['in', $searchGameIds];
$testRows = M('test_order', 'tab_')
->field(['game_id', 'sum(pay_amount) amount'])
->where($testWhere)

@ -13,6 +13,10 @@ class TestOrderController extends ThinkController
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$arraypage = $page;
$platformType = I('platform_type', 0);
$startedAt = I('timestart', '');
$endedAt = I('timeend', '');
$gameId = I('game_id', 0);
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
@ -20,7 +24,12 @@ class TestOrderController extends ThinkController
$row = 10;
}
$gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->select();
$gameSets = index_by_column('game_id', $gameSets);
$aggGameIds = getAggExceptIds($gameSets);
$map['1'] = "1";
$map['_string'] = '1=1';
if (!empty($_REQUEST['server_type'])) {
$map['t.server_type'] = $_REQUEST['server_type'];
}
@ -36,16 +45,20 @@ class TestOrderController extends ThinkController
if (!empty($_REQUEST['pay_way'])) {
$map['pay_way'] = $_REQUEST['pay_way'];
}
if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])){
$timestart = strtotime($_REQUEST['timestart']);
$timeend = strtotime($_REQUEST['timeend'])+86399;
$map['pay_time'] = array("between",array($timestart,$timeend));
}else if(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$timestart = strtotime($_REQUEST['timestart']);
$map['pay_time'] = array("EGT",$timestart);
}else if (!empty($_REQUEST['timeend']) && empty($_REQUEST['timestart'])) {
$timeend = strtotime($_REQUEST['timeend'])+86399;
$map['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'];
@ -56,8 +69,9 @@ class TestOrderController extends ThinkController
->join("tab_game g on t.game_id = g.id","left")
->where($map)->page($page,$row)->order('add_time desc')->select();
foreach ($order_list as $k => &$v) {
$v['game_name'] =clearGameNameType($v['game_name']);
$v['sdk_version'] =getGameTypeName($v['sdk_version']);
$v['game_name'] = clearGameNameType($v['game_name']);
$v['sdk_version'] = getGameTypeName($v['sdk_version']);
$v['platform_type'] = in_array($v['game_id'], $aggGameIds) ? '聚合' : '联运';
}
$sum_order_amount = M('test_order', 'tab_')->alias("t")->where($map)->field('sum(order_amount) as sum_order_amount,count(1) as count')->find();
$sum_pay_amount = M('test_order', 'tab_')->alias("t")->where($map)->field('sum(pay_amount) as sum_order_amount')->find();

@ -256,7 +256,7 @@
<td><span style="color: red"><if condition="$sumNoticeFail neq ''">{$sumNoticeFail}<else/>0</if></span></td>
<td>{$aggTotal}</td>
<td><span style="color: red"><if condition="$testAllAmount neq ''">{$testAllAmount}<else/>0</if></span></td>
<td><span style="color: red"><if condition="$sumNoticeFail neq ''">{$aggFailTotal}<else/>0</if></span></td>
<td><span style="color: red"><if condition="$aggFailTotal neq ''">{$aggFailTotal}<else/>0</if></span></td>
<td>
<a href="{:U('Finance/gameStatisticsDetail',
array(

@ -95,7 +95,13 @@
</volist>
</select>
</div>
<div class="input-list input-list-server search_label_rehab">
<select id="platform_type" name="platform_type" class="select_gallery" style="width:120px;">
<option value="0">所属平台</option>
<option value="1" <if condition="$_GET['platform_type'] eq '1'">selected</if>>联运</option>
<option value="2" <if condition="$_GET['platform_type'] eq '2'">selected</if>>聚合</option>
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('TestOrder/lists','model='.$model['name'].'&row='.I('row'),false)}" style="">搜索</a>
@ -136,6 +142,8 @@
<th >实付金额</th>
<th >所属平台</th>
<th >充值方式</th>
<th>所属商户</th>
@ -154,7 +162,7 @@
</style>
<if condition = "empty($datas)">
<tr>
<td colspan="14" class="text-center">aOh! 暂时还没有内容!</td>
<td colspan="15" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<notemtpy name = "datas">
@ -170,6 +178,7 @@
<if condition="$_GET['model'] neq 'deposit'"><td >{$data.sdk_version}</td></if>
<td >{$data.order_amount}</td>
<td >{$data.pay_amount}</td>
<td >{$data.platform_type}</td>
<td >{$data.pay_way|get_pay_way}</td>
<td>{:getMerchantName($data['merchant_id'])}</td>
<td >{$data.add_time|date='Y-m-d H:i:s',###}</td>
@ -191,6 +200,7 @@
<td >------</td>
<td >------</td>
<td >------</td>
<td >------</td>
</tr>
</notemtpy>
</tbody>

Loading…
Cancel
Save