diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index aed2f929e..7f5c1709f 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -2468,18 +2468,25 @@ 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']; } @@ -2499,18 +2506,23 @@ class ExportController extends Controller if(isset($params['pay_way'])) { $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']); @@ -8328,8 +8341,8 @@ 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); diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index 6385a9579..516b47bb0 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -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) @@ -830,7 +831,7 @@ class FinanceController extends ThinkController } $this->checkListOrCountAuthRestMap($map,[]); - + $testWhere['_string'] .= ' and game_id in(' . implode(',', $exceptIds) . ')'; $testAllAmount = M('test_order', 'tab_')->where($testWhere)->sum('pay_amount'); @@ -895,7 +896,7 @@ class FinanceController extends ThinkController 'page' => $p, 'limit' => $limit, ]); - + $count = 0; $total = '0.00'; $records = []; diff --git a/Application/Admin/Controller/TestOrderController.class.php b/Application/Admin/Controller/TestOrderController.class.php index 638f3c3e1..6fd00d6fb 100644 --- a/Application/Admin/Controller/TestOrderController.class.php +++ b/Application/Admin/Controller/TestOrderController.class.php @@ -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(); diff --git a/Application/Admin/View/Finance/gameStatistics.html b/Application/Admin/View/Finance/gameStatistics.html index 099228a5b..f943c8e6c 100644 --- a/Application/Admin/View/Finance/gameStatistics.html +++ b/Application/Admin/View/Finance/gameStatistics.html @@ -256,7 +256,7 @@ {$sumNoticeFail}0 {$aggTotal} {$testAllAmount}0 - {$aggFailTotal}0 + {$aggFailTotal}0 + +
搜索 @@ -135,6 +141,8 @@ 订单金额 实付金额 + + 所属平台 充值方式 @@ -154,7 +162,7 @@ - aOh! 暂时还没有内容! + aOh! 暂时还没有内容! @@ -170,6 +178,7 @@ {$data.sdk_version} {$data.order_amount} {$data.pay_amount} + {$data.platform_type} {$data.pay_way|get_pay_way} {:getMerchantName($data['merchant_id'])} {$data.add_time|date='Y-m-d H:i:s',###} @@ -191,6 +200,7 @@ ------ ------ ------ + ------