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

master
chenxiaojun 5 years ago
parent 1c79152b5c
commit 15373077b7

@ -131,9 +131,9 @@ class UserRepository
public function getLoginCountGroupByDayNew($params)
{
$dayList = $params['dayList'] ?? [];
$params['time_column'] = 'login_time';
$params['time_column'] = 'create_time';
$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)
->group('day')
->select();
@ -147,17 +147,17 @@ class UserRepository
public function getLoginCountGroupByGame($params)
{
$gameIds = $params['game_ids'] ?? [];
$params['time_column'] = 'login_time';
$params['time_column'] = 'create_time';
$conditions = $this->getGameGroupConditions($params);
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)
->fetchSql(true)
->select();
$model = new \Think\Model();
return $model->query("select count(*) as num from ($sql) as t")[0]['num'];
} 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)
->group('game_id')
->select();

Loading…
Cancel
Save