推广平台->数据管理->每日概况|数据汇总--登录统计优化

master
chenxiaojun 5 years ago
commit 71fca054fd

@ -131,9 +131,9 @@ class UserRepository
public function getLoginCountGroupByDayNew($params) public function getLoginCountGroupByDayNew($params)
{ {
$dayList = $params['dayList'] ?? []; $dayList = $params['dayList'] ?? [];
$params['time_column'] = 'login_time'; $params['time_column'] = 'create_time';
$conditions = $this->getDayGroupConditions($params); $conditions = $this->getDayGroupConditions($params);
$items = M('user_login_record', 'tab_')->field('FROM_UNIXTIME(login_time, "%Y-%m-%d") as day, count(DISTINCT user_id, game_id) as count') $items = M('login_daily_record', 'tab_')->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day, count(DISTINCT user_id, game_id) as count')
->where($conditions) ->where($conditions)
->group('day') ->group('day')
->select(); ->select();
@ -147,17 +147,17 @@ class UserRepository
public function getLoginCountGroupByGame($params) public function getLoginCountGroupByGame($params)
{ {
$gameIds = $params['game_ids'] ?? []; $gameIds = $params['game_ids'] ?? [];
$params['time_column'] = 'login_time'; $params['time_column'] = 'create_time';
$conditions = $this->getGameGroupConditions($params); $conditions = $this->getGameGroupConditions($params);
if (isset($params['all_data'])) { if (isset($params['all_data'])) {
$sql = M('user_login_record', 'tab_')->field('distinct game_id, user_id') $sql = M('login_daily_record', 'tab_')->field('distinct game_id, user_id')
->where($conditions) ->where($conditions)
->fetchSql(true) ->fetchSql(true)
->select(); ->select();
$model = new \Think\Model(); $model = new \Think\Model();
return $model->query("select count(*) as num from ($sql) as t")[0]['num']; return $model->query("select count(*) as num from ($sql) as t")[0]['num'];
} else { } else {
$items = M('user_login_record', 'tab_')->field('game_id, count(DISTINCT user_id) as count') $items = M('login_daily_record', 'tab_')->field('game_id, count(DISTINCT user_id) as count')
->where($conditions) ->where($conditions)
->group('game_id') ->group('game_id')
->select(); ->select();

Loading…
Cancel
Save