diff --git a/Application/Base/Repository/PromoteRepository.class.php b/Application/Base/Repository/PromoteRepository.class.php index 75eb08215..518d2cc5e 100644 --- a/Application/Base/Repository/PromoteRepository.class.php +++ b/Application/Base/Repository/PromoteRepository.class.php @@ -106,7 +106,6 @@ class PromoteRepository { $params['time_column'] = 'create_time'; $map = $this->getPublicAchievementMap($ids, $params); $items = M('user_play_info', 'tab_')->field(['count(distinct user_id) count', 'promote_id'])->where($map)->group('promote_id')->select(); - $records = []; foreach ($items as $item) { $promoteId = $item['promote_id']; @@ -119,7 +118,6 @@ class PromoteRepository { $records[$promoteId] = $item['count']; } } - $records = $this->assembleZero($ids, $records, 0); return $records; @@ -188,7 +186,7 @@ class PromoteRepository { $inQuery = M('user_play_info', 'tab_')->field('create_ip')->group('create_ip')->where($map)->buildSql(); $resultMap = ['create_ip' => ['exp', ' in (' . $inQuery . ')']]; - $items = M('user_play_info', 'tab_')->field(['count(*) count', 'promote_id'])->where($resultMap)->group('promote_id')->select(); + $items = M('user_play_info', 'tab_')->field(['count(DISTINCT create_ip) count', 'promote_id'])->where($resultMap)->group('promote_id')->select(); $records = []; foreach ($items as $item) { @@ -233,7 +231,8 @@ class PromoteRepository { $inQuery = M('user_play_info', 'tab_')->field('user_id')->group('user_id')->where($map)->buildSql(); $resultMap = ['_string' => 'user_id in (' . $inQuery . ')']; - $items = M('user_play_info', 'tab_')->field(['count(*) count', 'promote_id'])->where($resultMap)->group('promote_id')->select(); + $items = M('user_play_info', 'tab_')->field(['count(DISTINCT user_id) count', 'promote_id'])->where($resultMap)->group('promote_id')->select(); + // var_dump(M()->getLastSql()); $records = []; foreach ($items as $item) { $promoteId = $item['promote_id'];