diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php
index a211927d3..aed2f929e 100644
--- a/Application/Admin/Controller/ExportController.class.php
+++ b/Application/Admin/Controller/ExportController.class.php
@@ -8273,8 +8273,10 @@ class ExportController extends Controller
array('balance_coin_count','平台币直充支出'),
array('inside_cash_count','内充支出'),
array('all_cash_count','游戏内充值合计'),
+ array('notice_fail_count','联运通知失败合计'),
array('agg_amount','聚合平台数据'),
- array('notice_fail_count','通知失败合计'),
+ array('test_amount','聚合平台测试订单'),
+ array('agg_failed_amount','聚合通知失败合计'),
);
$map = [];
@@ -8282,6 +8284,7 @@ class ExportController extends Controller
$searchGameIds = null;
$game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id');
$gameWhere = [];
+ $testStrWhere = '1=1';
if ($game_ids) {
$map['s.game_id'] = ['in', $game_ids];
$gameWhere['id'] = ['in', $game_ids];
@@ -8296,6 +8299,7 @@ class ExportController extends Controller
if (!empty(I('timestart'))) {
$timestart = strtotime(I('timestart'));
$map['_string'] = "s.payed_time >= {$timestart}";
+ $testStrWhere .= " and pay_time >= {$timestart}";
}
if (!empty(I('timeend'))) {
@@ -8304,6 +8308,7 @@ class ExportController extends Controller
$map['_string'] .= " and ";
}
$map['_string'] .= " s.pay_time <= {$timeend}";
+ $testStrWhere .= " and pay_time <= {$timeend}";
}
if (!empty(I('game_type_id'))) {
@@ -8328,9 +8333,23 @@ class ExportController extends Controller
$gameSets = index_by_column('game_id', $gameSets);
$searchGameCodes = [];
+ $testList = [];
+ $testWhere = [
+ 'game_id' => 0,
+ '_string' => $testStrWhere,
+ ];
if (count($searchGameIds) > 0) {
$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)
+ ->group('game_id')
+ ->select();
+ foreach ($testRows as $testRow) {
+ $testList[$testRow['game_id']] = round(floatval($testRow['amount']), 2);
+ }
}
$client = new AggregateClient();
@@ -8341,26 +8360,39 @@ class ExportController extends Controller
'search_games' => $searchGameCodes,
'device_type' => I("sdk_type", 0),
]);
+
$aggData = [];
+ $aggFailData = [];
$aggTotal = '0.00';
+ $aggFailTotal = '0.00';
if ($result['code'] == '0000') {
$aggData = $result['data']['records'];
+ $aggFailData = $result['data']['fail_records'];
$aggTotal = $result['data']['total'];
+ $aggFailTotal = $result['data']['fail_total'];
}
$exceptIds = getAggExceptIds($gameSets);
foreach ($xlsData as $key => $value) {
$aggAmount = '0.00';
+ $aggFailAmount = '0.00';
+ $testAmount = '0.00';
$deviceType = $value['sdk_version'] == 1 ? 'android' : 'ios';
if ($value['unique_code'] && isset($aggData[$value['unique_code']]) && isset($aggData[$value['unique_code']][$deviceType])) {
$aggAmount = number_format($aggData[$value['unique_code']][$deviceType], 2, '.', '');
+ $aggFailAmount = number_format($aggFailData[$value['unique_code']][$deviceType], 2, '.', '');
}
$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;
$xlsData[$key]['inside_cash_count'] =$value['inside_cash_count'] = 0;
+ $testAmount = $testList[$value['game_id']] ?? '0.00';
}
+
+ $xlsData[$key]['test_amount'] = $testAmount;
// $xlsData[$key]['game_name'] = substr($value["game_name"],0,strrpos($value["game_name"],'('));
$xlsData[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count'];
if ($value['sdk_version'] == 1) {
@@ -8377,6 +8409,10 @@ class ExportController extends Controller
$map['_string'] = " s.game_id not in (" . implode(',', $exceptIds) . ")";
}
}
+
+ $testWhere['_string'] .= ' and game_id in(' . implode(',', $exceptIds) . ')';
+ $testAllAmount = M('test_order', 'tab_')->where($testWhere)->sum('pay_amount');
+
$totalData = D("spend")->totalGameStatistics($map);
$sumCash = $totalData['cash_count'];
@@ -8390,8 +8426,11 @@ class ExportController extends Controller
'balance_coin_count'=>$sumBalance,
'inside_cash_count'=>$sumInside,
'all_cash_count'=>$sumAll,
+ 'notice_fail_count'=>$sumNoticeFail,
'agg_amount' => $aggTotal,
- 'notice_fail_count'=>$sumNoticeFail]];
+ 'testAllAmount' => $testAllAmount,
+ 'aggFailTotal' => $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 99c379e8e..8c6db5e2e 100644
--- a/Application/Admin/Controller/FinanceController.class.php
+++ b/Application/Admin/Controller/FinanceController.class.php
@@ -710,6 +710,7 @@ class FinanceController extends ThinkController
$searchGameIds = null;
$game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id');
$gameWhere = [];
+ $testStrWhere = '1=1';
if ($game_ids) {
$map['s.game_id'] = ['in', $game_ids];
$gameWhere['id'] = ['in', $game_ids];
@@ -723,6 +724,7 @@ class FinanceController extends ThinkController
if (!empty(I('timestart'))) {
$timestart = strtotime(I('timestart'));
$map['_string'] = "s.payed_time >= {$timestart}";
+ $testStrWhere .= " and pay_time >= {$timestart}";
}
if (!empty(I('timeend'))) {
@@ -731,6 +733,7 @@ class FinanceController extends ThinkController
$map['_string'] .= " and ";
}
$map['_string'] .= " s.payed_time <= {$timeend}";
+ $testStrWhere .= " and pay_time <= {$timeend}";
}
if (!empty(I('game_type_id'))) {
@@ -755,9 +758,24 @@ class FinanceController extends ThinkController
$gameSets = index_by_column('game_id', $gameSets);
$searchGameCodes = [];
+ $testList = [];
+ $testWhere = [
+ 'game_id' => 0,
+ '_string' => $testStrWhere,
+ ];
if (count($searchGameIds) > 0) {
$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)
+ ->group('game_id')
+ ->select();
+ foreach ($testRows as $testRow) {
+ $testList[$testRow['game_id']] = round(floatval($testRow['amount']), 2);
+ }
}
$client = new AggregateClient();
@@ -769,28 +787,38 @@ class FinanceController extends ThinkController
'device_type' => I("sdk_type", 0),
]);
$aggData = [];
+ $aggFailData = [];
$aggTotal = '0.00';
+ $aggFailTotal = '0.00';
if ($result['code'] == '0000') {
$aggData = $result['data']['records'];
+ $aggFailData = $result['data']['fail_records'];
$aggTotal = $result['data']['total'];
+ $aggFailTotal = $result['data']['fail_total'];
}
$endTime = time();
$exceptIds = getAggExceptIds($gameSets);
foreach ($data as $key => $value) {
$aggAmount = '0.00';
+ $aggFailAmount = '0.00';
+ $testAmount = '0.00';
$deviceType = $value['sdk_version'] == 1 ? 'android' : 'ios';
if ($value['unique_code'] && isset($aggData[$value['unique_code']]) && isset($aggData[$value['unique_code']][$deviceType])) {
$aggAmount = number_format($aggData[$value['unique_code']][$deviceType], 2, '.', '');
+ $aggFailAmount = number_format($aggFailData[$value['unique_code']][$deviceType], 2, '.', '');
}
// if ($aggAmount != '0.00') {
if (isset($gameSets[$value['game_id']]) && isAggGame($gameSets[$value['game_id']]['pay_notify_url'])) {
$data[$key]['cash_count'] = $value['cash_count'] = 0;
$data[$key]['balance_coin_count'] = $value['balance_coin_count'] = 0;
$data[$key]['inside_cash_count'] = $value['inside_cash_count'] = 0;
+ $testAmount = $testList[$value['game_id']] ?? '0.00';
}
$data[$key]['all_cash_count'] = number_format($value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count'],2,'.','');
$data[$key]['agg_amount'] = $value['unique_code'] ? $aggAmount : '0.00';
+ $data[$key]['agg_failed_amount'] = $value['unique_code'] ? $aggFailAmount : '0.00';
+ $data[$key]['test_amount'] = $testAmount;
}
$count = D("spend")->gameStatisticsCount($map);//列表总数
@@ -803,6 +831,9 @@ 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');
+
//统计合计
if (count($exceptIds) > 0) {
if (isset($map['_string'])) {
@@ -824,6 +855,8 @@ class FinanceController extends ThinkController
$aggRate = round($aggTotal/($sumAll + $aggTotal) * 100, 2) . '%';
$allRate = round($sumAll/($sumAll + $aggTotal) * 100, 2) . '%';
+ $this->assign('testAllAmount', $testAllAmount);
+ $this->assign('aggFailTotal', $aggFailTotal);
$this->assign('aggRate', $aggRate);
$this->assign('allRate', $allRate);
$this->assign('aggTotal', $aggTotal);
@@ -838,6 +871,72 @@ class FinanceController extends ThinkController
$this->display();
}
+ public function aggDetail($p = 1)
+ {
+ $limit = I('row', 10);
+ $gameId = I('game_id', 0);
+ $deviceType = 0;
+ $orderNumber = I('order_number', '');
+ $roleName = I('role_name', '');
+ $account = I('account', '');
+ $gameId = I('game_id', 0);
+
+ $game = M('game', 'tab_')->field(['id', 'unique_code', 'game_name'])->where(['game_id' => $gameId])->find();
+
+ $client = new AggregateClient();
+ $result = $client->api('game-recharge-detail', [
+ 'unique_code' => $game['unique_code'],
+ 'started_at' => I('timestart', ''),
+ 'ended_at' => I('timeend', ''),
+ 'account' => $account,
+ 'order_number' => $orderNumber,
+ 'role_name' => $roleName,
+ 'device_type' => I("sdk_type", 0),
+ 'page' => $p,
+ 'limit' => $limit,
+ ]);
+
+ $count = 0;
+ $total = '0.00';
+ $records = [];
+ if ($result['code'] != '0000') {
+ $count = $result['data']['count'];
+ $total = $result['data']['total'];
+ $records = $result['data']['records'];
+ }
+
+ foreach ($records as $key => $record) {
+ $records[$key]['game_name'] = $game['game_name'];
+ }
+
+ if(isset($_REQUEST['export'])){
+ //操作日志
+ $GetData = $_GET;
+ unset($GetData['export']);
+ $dcop = array(
+ "order_number"=>"支付订单号",
+ "pay_success_time"=>"充值时间",
+ "account"=>"玩家账号",
+ "game_name"=>"游戏名称",
+ "rom_platform"=>"设备类型",
+ "role_name"=>"角色名称",
+ "money"=>"充值金额",
+ );
+ addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData),'menu'=>"充值-财务管理-游戏统计-订单查看-导出"]);
+ data2csv($records, "聚合游戏统计订单查看", $dcop);
+ }
+
+ $page = set_pagination($count, $limit);
+ if ($page) {
+ $this->assign('_page', $page);
+ }
+
+ $this->assign('pagination', $page);
+ $this->assign('total', $total);
+ $this->assign('records', $records);
+ $this->display();
+ }
+
public function gameStatisticsDetail($p = 1) {
diff --git a/Application/Admin/View/Finance/aggDetail.html b/Application/Admin/View/Finance/aggDetail.html
new file mode 100644
index 000000000..4edc6edd5
--- /dev/null
+++ b/Application/Admin/View/Finance/aggDetail.html
@@ -0,0 +1,287 @@
+{$_REQUEST['game_name']}游戏订单查看
+
+
+
+
+
+
+
+
+
+
+
+ 支付订单号
+ 充值时间
+ 玩家账号
+ 游戏名称
+ 设备类型
+ 所属平台
+
+ 角色名称
+ 充值金额
+
+
+ aOh! 暂时还没有内容!
+
+
+ {$data.order_number}
+ {$data.pay_success_time}
+ {$data.account}
+ {$data.game_name}
+ {$data.rom_platform}
+ 聚合
+
+ {$data.role_name}
+ {$data.money}
+
+
+ 总计
+
+