From 4f3c21263da57fb3ffc50ed770d2fd61e7ca03c9 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 28 Jan 2021 12:01:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Repository/SpendRepository.class.php | 10 +++- .../Base/Repository/UserRepository.class.php | 15 +++++- .../Home/Controller/QueryController.class.php | 16 ++++--- Application/Home/View/default/Query/arpu.html | 48 ++++++++++++++----- 4 files changed, 69 insertions(+), 20 deletions(-) diff --git a/Application/Base/Repository/SpendRepository.class.php b/Application/Base/Repository/SpendRepository.class.php index 4451eef2c..fb2009543 100644 --- a/Application/Base/Repository/SpendRepository.class.php +++ b/Application/Base/Repository/SpendRepository.class.php @@ -85,7 +85,15 @@ class SpendRepository $conditions['pay_status'] = 1; $conditions['promote_id'] = ['in', $ids]; $conditions['pay_time'] = ['between', [$beginTime, $endTime]]; - $conditions['game_id'] = $gameId > 0 ? $gameId : ['gt', 0]; + if (is_array($gameId)) { + if (count($gameId)) { + $conditions['game_id'] = ['in', $gameId]; + } + } else { + if ($gameId > 0) { + $conditions['game_id'] = $gameId; + } + } if (isset($params['server_id'])) { $conditions['server_id'] = $serverId; } diff --git a/Application/Base/Repository/UserRepository.class.php b/Application/Base/Repository/UserRepository.class.php index 2598a165f..1d85ae130 100644 --- a/Application/Base/Repository/UserRepository.class.php +++ b/Application/Base/Repository/UserRepository.class.php @@ -44,8 +44,14 @@ class UserRepository $conditions = []; $conditions['promote_id'] = ['in', $ids]; $conditions[$params['time_column']] = ['between', [$beginTime, $endTime]]; - if ($gameId > 0) { - $conditions['game_id'] = $gameId; + if (is_array($gameId)) { + if (count($gameId)) { + $conditions['game_id'] = ['in', $gameId]; + } + } else { + if ($gameId > 0) { + $conditions['game_id'] = $gameId; + } } $conditions['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1']; @@ -180,6 +186,11 @@ class UserRepository $params['time_column'] = 'register_time'; $conditions = $this->getDayGroupConditions($params); + /* if (isset($conditions['game_id'])) { + $conditions['fgame_id'] = $conditions['game_id']; + unset($conditions['game_id']); + } */ + $items = M('user', 'tab_')->field('count(*) count, FROM_UNIXTIME(register_time, "%Y-%m-%d") as day') ->where($conditions) ->group('day') diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 16300c0c8..16993ad90 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -749,13 +749,12 @@ class QueryController extends BaseController public function arpu() { $this->meta_title = 'ARPU统计'; - $defaultTime = date('Y-m-d', time() - 6 * 24 * 3600) . ' 至 ' . date('Y-m-d'); - $time = I('time', ''); $time = $time == '' ? $defaultTime : $time; $sdkVersion = I('sdk_version', 0); - $gameId = I('game_id', 0); + // $gameId = I('game_id', 0); + $relationGameId = I('relation_game_id', 0); $serverId = I('server_id', 0); $levelPromote = $this->getLevelPromote(); $searchPromote = $this->getQueryPromote($levelPromote); @@ -772,9 +771,14 @@ class QueryController extends BaseController $params = []; $searchGameName = ''; $searchServerName = ''; - if ($gameId > 0) { - $params['game_id'] = $gameId; - $searchGameName = M('game', 'tab_')->where(['id' => $gameId])->getField('game_name'); + if ($relationGameId > 0) { + $subMap = ['relation_game_id' => $relationGameId]; + if ($sdkVersion > 0 && in_array($sdkVersion, [1, 2])) { + $subMap['sdk_version'] = $sdkVersion; + } + $searchGames = M('game', 'tab_')->field(['id', 'game_name'])->where($subMap)->select(); + $params['game_id'] = array_column($searchGames, 'id'); + $searchGameName = str_replace('(苹果版)', '', str_replace('(安卓版)', '', $searchGames[0]['game_name'])); } if ($serverId > 0) { $params['server_id'] = $serverId; diff --git a/Application/Home/View/default/Query/arpu.html b/Application/Home/View/default/Query/arpu.html index a3aa103aa..ef5085f41 100644 --- a/Application/Home/View/default/Query/arpu.html +++ b/Application/Home/View/default/Query/arpu.html @@ -124,13 +124,29 @@