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 {