diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 034c3d047..a211927d3 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -8279,18 +8279,23 @@ class ExportController extends Controller $map = []; + $searchGameIds = null; $game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id'); + $gameWhere = []; if ($game_ids) { $map['s.game_id'] = ['in', $game_ids]; + $gameWhere['id'] = ['in', $game_ids]; } + if (!empty(I('partner_id'))) { $map['g.partner_id'] = I('partner_id'); + $gameWhere['partner_id'] = I('partner_id'); } if (!empty(I('timestart'))) { $timestart = strtotime(I('timestart')); - $map['_string'] = "s.pay_time >= {$timestart}"; + $map['_string'] = "s.payed_time >= {$timestart}"; } if (!empty(I('timeend'))) { @@ -8303,20 +8308,39 @@ class ExportController extends Controller if (!empty(I('game_type_id'))) { $map['g.game_type_id'] = I('game_type_id'); + $gameWhere['game_type_id'] = I('game_type_id', 0); } + + $searchGameIds = M('game', 'tab_')->where($gameWhere)->getField('id', true); $xlsData = D("spend")->gameStatistics($map); $uniqueCodes = array_column($xlsData, 'unique_code'); + $gameIds = array_column($xlsData, 'game_id'); $uniqueCodes = array_filter($uniqueCodes, function($value) { if ($value) { return true; } return false; }); + + $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, + 'device_type' => I("sdk_type", 0), + ]); $aggData = []; $aggTotal = '0.00'; if ($result['code'] == '0000') { @@ -8324,7 +8348,7 @@ class ExportController extends Controller $aggTotal = $result['data']['total']; } - $exceptIds = []; + $exceptIds = getAggExceptIds($gameSets); foreach ($xlsData as $key => $value) { $aggAmount = '0.00'; $deviceType = $value['sdk_version'] == 1 ? 'android' : 'ios'; @@ -8332,11 +8356,10 @@ class ExportController extends Controller $aggAmount = number_format($aggData[$value['unique_code']][$deviceType], 2, '.', ''); } $xlsData[$key]['agg_amount'] = $aggAmount; - if ($aggAmount != '0.00') { - $value['cash_count'] = 0; - $value['balance_coin_count'] = 0; - $value['inside_cash_count'] = 0; - $exceptIds[] = $value['game_id']; + 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; } // $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']; diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index bc0b8d2ba..99c379e8e 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -707,13 +707,17 @@ class FinanceController extends ThinkController $map = []; + $searchGameIds = null; $game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id'); + $gameWhere = []; if ($game_ids) { $map['s.game_id'] = ['in', $game_ids]; + $gameWhere['id'] = ['in', $game_ids]; } if (!empty(I('partner_id'))) { $map['g.partner_id'] = I('partner_id'); + $gameWhere['partner_id'] = I('partner_id'); } if (!empty(I('timestart'))) { @@ -731,10 +735,14 @@ class FinanceController extends ThinkController if (!empty(I('game_type_id'))) { $map['g.game_type_id'] = I('game_type_id'); + $gameWhere['game_type_id'] = I('game_type_id', 0); } + + $searchGameIds = M('game', 'tab_')->where($gameWhere)->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 +751,23 @@ class FinanceController extends ThinkController return false; }); + $gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->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, + 'device_type' => I("sdk_type", 0), + ]); $aggData = []; $aggTotal = '0.00'; if ($result['code'] == '0000') { @@ -753,18 +776,18 @@ class FinanceController extends ThinkController } $endTime = time(); - $exceptIds = []; + $exceptIds = getAggExceptIds($gameSets); foreach ($data as $key => $value) { $aggAmount = '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, '.', ''); } - 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; - $exceptIds[] = $value['game_id']; } $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'; diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index 526108922..6a50765dc 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -3029,4 +3029,23 @@ 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; +} + +function getAggExceptIds($gameSettings) +{ + $exceptIds = []; + foreach ($gameSettings as $setting) { + if (isAggGame($setting['pay_notify_url'])) { + $exceptIds[] = $setting['game_id']; + } + } + return $exceptIds; } \ No newline at end of file diff --git a/Application/Home/Controller/SafeController.class.php b/Application/Home/Controller/SafeController.class.php index c4ddb5e71..07ec33d96 100644 --- a/Application/Home/Controller/SafeController.class.php +++ b/Application/Home/Controller/SafeController.class.php @@ -415,7 +415,7 @@ class SafeController extends BaseController{ $bank = $_REQUEST["bank_card"]; //银行账号 $bank_name = $_REQUEST["bank_name"]; //开户银行 $bank_account = $_REQUEST['bank_account']; //银行账户名 - $agreementpic = $_REQUEST["agreementpic"]; + $agreementpic = $_REQUEST["agreementpic"] ?? ''; $alipayaccount = $_REQUEST['alipay_account']; $alipayrealname = $_REQUEST['alipay_real_name']; @@ -482,10 +482,10 @@ class SafeController extends BaseController{ $this->error('卡号格式错误'); return false; } - if(empty($agreementpic)) { - $this->error("补充协议不能为空"); - return false; - } + // if(empty($agreementpic)) { + // $this->error("补充协议不能为空"); + // return false; + // } if (empty($alipayaccount)) { $this->error('支付宝账户不能为空'); return false; @@ -519,7 +519,7 @@ class SafeController extends BaseController{ $data['alipay_real_name'] = $alipayrealname; // $data['agreementpic'] = $ - $data['anothpic'] = $agreementpic; + $agreementpic ? $data['anothpic'] = $agreementpic : null; $id = get_pid(); $updateRs = M("promote","tab_")->where(['id'=>$id])->save($data); if($updateRs) {