From e34d28e2c820a2f7b662794d658735e86dde9846 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Mon, 3 Aug 2020 13:04:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExportController.class.php | 26 ++++++++++++-- .../Controller/FinanceController.class.php | 34 +++++++++++++++++-- Application/Common/Common/extend.php | 8 +++++ 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 3e430fb47..2cf7457d2 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -8279,11 +8279,14 @@ class ExportController extends Controller $map = []; + $searchGameIds = null; $game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id'); if ($game_ids) { $map['s.game_id'] = ['in', $game_ids]; + $searchGameIds = $game_ids; } + if (!empty(I('partner_id'))) { $map['g.partner_id'] = I('partner_id'); } @@ -8303,20 +8306,39 @@ class ExportController extends Controller if (!empty(I('game_type_id'))) { $map['g.game_type_id'] = I('game_type_id'); + $searchGameIds = M('game', 'tab_')->where(['game_type_id' => I('game_type_id', 0)])->getField('id', true); } $xlsData = D("spend")->gameStatistics($map); $uniqueCodes = array_column($xlsData, 'unique_code'); + $gameIds = array_column($data, 'game_id'); $uniqueCodes = array_filter($uniqueCodes, function($value) { if ($value) { return true; } return false; }); + + $gameSets = []; + if (count($gameIds) > 0) { + $gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->where(['game_id' => ['in', $gameIds]])->select(); + $gameSets = index_by_column('game_id', $gameSets); + } + + $searchGameCodes = []; + if (count($searchGameIds) > 0) { + $searchGameCodes = M('game', 'tab_')->where(['id' => ['in', $searchGameIds], 'unique_code' => ['neq', '']])->getField('unique_code', true); + $searchGameCodes = array_unique($searchGameCodes); + } $client = new AggregateClient(); - $result = $client->api('game-data', ['unique_codes' => $uniqueCodes, 'started_at' => I('timestart', ''), 'ended_at' => I('timeend', '')]); + $result = $client->api('game-data', [ + 'unique_codes' => $uniqueCodes, + 'started_at' => I('timestart', ''), + 'ended_at' => I('timeend', ''), + 'search_games' => $searchGameCodes, + ]); $aggData = []; $aggTotal = '0.00'; if ($result['code'] == '0000') { @@ -8332,7 +8354,7 @@ class ExportController extends Controller $aggAmount = number_format($aggData[$value['unique_code']][$deviceType], 2, '.', ''); } $xlsData[$key]['agg_amount'] = $aggAmount; - if ($aggAmount != '0.00') { + if (isset($gameSets[$value['game_id']]) && isAggGame($gameSets[$value['game_id']]['pay_notify_url'])) { $value['cash_count'] = 0; $value['balance_coin_count'] = 0; $value['inside_cash_count'] = 0; diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index 4cfd24076..a47e7bdfa 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -707,9 +707,11 @@ class FinanceController extends ThinkController $map = []; + $searchGameIds = null; $game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id'); if ($game_ids) { $map['s.game_id'] = ['in', $game_ids]; + $searchGameIds = $game_ids; } if (!empty(I('partner_id'))) { @@ -731,10 +733,13 @@ class FinanceController extends ThinkController if (!empty(I('game_type_id'))) { $map['g.game_type_id'] = I('game_type_id'); + $searchGameIds = M('game', 'tab_')->where(['game_type_id' => I('game_type_id', 0)])->getField('id', true); } + $startTime = time(); //游戏统计列表 $data = D("spend")->gameStatistics($map, $row, $p); + $gameIds = array_column($data, 'game_id'); $uniqueCodes = array_column($data, 'unique_code'); $uniqueCodes = array_filter($uniqueCodes, function($value) { if ($value) { @@ -743,8 +748,32 @@ class FinanceController extends ThinkController return false; }); + $gameSets = []; + if (count($gameIds) > 0) { + $gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->where(['game_id' => ['in', $gameIds]])->select(); + $gameSets = index_by_column('game_id', $gameSets); + } + + $searchGameCodes = []; + if (count($searchGameIds) > 0) { + $searchGameCodes = M('game', 'tab_')->where(['id' => ['in', $searchGameIds], 'unique_code' => ['neq', '']])->getField('unique_code', true); + $searchGameCodes = array_unique($searchGameCodes); + } + + var_dump([ + 'unique_codes' => $uniqueCodes, + 'started_at' => I('timestart', ''), + 'ended_at' => I('timeend', ''), + 'search_games' => $searchGameCodes, + ]); + $client = new AggregateClient(); - $result = $client->api('game-data', ['unique_codes' => $uniqueCodes, 'started_at' => I('timestart', ''), 'ended_at' => I('timeend', '')]); + $result = $client->api('game-data', [ + 'unique_codes' => $uniqueCodes, + 'started_at' => I('timestart', ''), + 'ended_at' => I('timeend', ''), + 'search_games' => $searchGameCodes, + ]); $aggData = []; $aggTotal = '0.00'; if ($result['code'] == '0000') { @@ -760,7 +789,8 @@ class FinanceController extends ThinkController if ($value['unique_code'] && isset($aggData[$value['unique_code']]) && isset($aggData[$value['unique_code']][$deviceType])) { $aggAmount = number_format($aggData[$value['unique_code']][$deviceType], 2, '.', ''); } - if ($aggAmount != '0.00') { + // 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; diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index 526108922..127fdec6f 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -3029,4 +3029,12 @@ function db2csv(&$data,$title,$header=false){ function hideRealName($realName) { return mb_strlen($realName,'utf-8') == 2 ? mb_substr($realName,0,1,'utf-8').'*':mb_substr($realName,0,1,'utf-8').'**'; +} + +function isAggGame($payUrl) +{ + if (strpos($payUrl, 'sdk-pay-a.wmtxkj') !== false || strpos($payUrl, 'sdk-pay-i.wmtxkj') !== false ) { + return true; + } + return false; } \ No newline at end of file