From 3dfc92ecc39c1a0e650749903048ad57269daff4 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 6 Jan 2021 15:29:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=BD=BD=E8=B6=85?= =?UTF-8?q?=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Repository/SpendRepository.class.php | 14 +++++++------- .../Home/Controller/QueryController.class.php | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Application/Base/Repository/SpendRepository.class.php b/Application/Base/Repository/SpendRepository.class.php index 1421a45e7..4451eef2c 100644 --- a/Application/Base/Repository/SpendRepository.class.php +++ b/Application/Base/Repository/SpendRepository.class.php @@ -177,7 +177,7 @@ class SpendRepository $gameIds = $params['game_ids'] ?? []; $conditions = $this->getGameGroupConditionsNew($params); $field = 'game_id, sum(pay_amount) as amount'; - $items = M('spend', 'tab_')->field($field)->where($conditions)->group('game_id')->select(); + $items = M('spend use index(spend_search)', 'tab_')->field($field)->where($conditions)->group('game_id')->select(); return $this->assembleRecords($items, $gameIds, 'amount', 'game_id'); } @@ -187,7 +187,7 @@ class SpendRepository public function getPayAmountByGameAndType($params) { $conditions = $this->getGameGroupConditionsNew($params); - return M('spend', 'tab_')->where($conditions)->sum('pay_amount'); + return M('spend use index(spend_search)', 'tab_')->where($conditions)->sum('pay_amount'); } /** @@ -234,7 +234,7 @@ class SpendRepository $gameIds = $params['game_ids'] ?? []; $conditions = $this->getGameGroupConditions($params); $field = 'game_id, count(*) count'; - $items = M('spend', 'tab_')->field($field)->where($conditions)->group('game_id')->select(); + $items = M('spend use index(spend_search)', 'tab_')->field($field)->where($conditions)->group('game_id')->select(); return $this->assembleRecords($items, $gameIds, 'count', 'game_id'); } @@ -244,7 +244,7 @@ class SpendRepository public function getPayCountByGame($params) { $conditions = $this->getGameGroupConditions($params); - return M('spend', 'tab_')->where($conditions)->count(); + return M('spend use index(spend_search)', 'tab_')->where($conditions)->count(); } /** @@ -255,7 +255,7 @@ class SpendRepository $gameIds = $params['game_ids'] ?? []; $conditions = $this->getGameGroupConditions($params); $field = 'game_id, count(distinct user_id) count'; - $items = M('spend', 'tab_')->field($field)->where($conditions)->group('game_id')->select(); + $items = M('spend use index(spend_search)', 'tab_')->field($field)->where($conditions)->group('game_id')->select(); return $this->assembleRecords($items, $gameIds, 'count', 'game_id'); } @@ -265,7 +265,7 @@ class SpendRepository public function getPayUserCountByGame($params) { $conditions = $this->getGameGroupConditions($params); - $sql = M('spend', 'tab_')->field('distinct game_id, user_id') + $sql = M('spend use index(spend_search)', 'tab_')->field('distinct game_id, user_id') ->where($conditions) ->fetchSql(true) ->select(); @@ -307,7 +307,7 @@ class SpendRepository $oldConditions['pay_time'] = ['lt', $beginTime]; $oldQuery = M('spend', 'tab_')->field('user_id')->where($oldConditions)->group('user_id')->buildSql(); $conditions['user_id'] = ['exp', ' not in (' . $oldQuery . ')']; - $items = M('spend', 'tab_')->field('count(distinct user_id) count, game_id')->where($conditions)->group('game_id')->select(); + $items = M('spend use index(spend_search)', 'tab_')->field('count(distinct user_id) count, game_id')->where($conditions)->group('game_id')->select(); return $this->assembleRecords($items, $gameIds, 'count', 'game_id'); } diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 1c4f73d6a..c73569d46 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1326,6 +1326,7 @@ class QueryController extends BaseController $promoteService = new PromoteService(); $allGameIs = $promoteService->getHistoryGameIds($loginPromote); + if ($allGameIs && count($allGameIs) > 0) { $map['_string'] .= ' and id in(' . implode(',', $allGameIs) . ')'; } else {