|
|
|
@ -133,8 +133,13 @@ class UserRepository
|
|
|
|
|
$dayList = $params['dayList'] ?? [];
|
|
|
|
|
$params['time_column'] = 'create_time';
|
|
|
|
|
$conditions = $this->getDayGroupConditions($params);
|
|
|
|
|
$items = M('login_daily_record', 'tab_')->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day, count(DISTINCT user_id, game_id) as count')
|
|
|
|
|
$subQuery = M('login_daily_record', 'tab_')->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day,count(DISTINCT user_id) as count')
|
|
|
|
|
->where($conditions)
|
|
|
|
|
->group('game_id')
|
|
|
|
|
->buildSql();
|
|
|
|
|
$items = M()->field('*,sum(count) as count')
|
|
|
|
|
->table($subQuery)
|
|
|
|
|
->alias('a')
|
|
|
|
|
->group('day')
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
@ -294,8 +299,13 @@ class UserRepository
|
|
|
|
|
$params['time_column'] = 'create_time';
|
|
|
|
|
$conditions = $this->getCreateRoleConditions($params);
|
|
|
|
|
|
|
|
|
|
$items = M('user_play_info', 'tab_')->field('count(distinct game_id,user_id) count, FROM_UNIXTIME(create_time, "%Y-%m-%d") as day')
|
|
|
|
|
$subQuery = M('user_play_info', 'tab_')->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day,count(DISTINCT user_id) as count')
|
|
|
|
|
->where($conditions)
|
|
|
|
|
->group('game_id')
|
|
|
|
|
->buildSql();
|
|
|
|
|
$items = M()->field('*,sum(count) as count')
|
|
|
|
|
->table($subQuery)
|
|
|
|
|
->alias('a')
|
|
|
|
|
->group('day')
|
|
|
|
|
->select();
|
|
|
|
|
return $this->assembleRecords($items, $dayList, 'count');
|
|
|
|
@ -346,10 +356,14 @@ class UserRepository
|
|
|
|
|
->where("ti.user_id = user_id and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
|
|
|
|
|
->fetchSql(true)
|
|
|
|
|
->count();
|
|
|
|
|
$items = $model->field("count(distinct game_id,user_id) count, FROM_UNIXTIME(create_time, '%Y-%m-%d') as day,
|
|
|
|
|
(" . $sql . ") as num")
|
|
|
|
|
$subQuery = $model->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day,count(DISTINCT user_id) as count')
|
|
|
|
|
->where($conditions)
|
|
|
|
|
->group("day")
|
|
|
|
|
->group('game_id')
|
|
|
|
|
->buildSql();
|
|
|
|
|
$items = M()->field("*,sum(count) as count,(" . $sql . ") as num")
|
|
|
|
|
->table($subQuery)
|
|
|
|
|
->alias('a')
|
|
|
|
|
->group('day')
|
|
|
|
|
->having('num = 0')
|
|
|
|
|
->select();
|
|
|
|
|
return $this->assembleRecords($items, $dayList, 'count');
|
|
|
|
@ -411,10 +425,14 @@ class UserRepository
|
|
|
|
|
->where("ti.create_device_number = create_device_number and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
|
|
|
|
|
->fetchSql(true)
|
|
|
|
|
->count();
|
|
|
|
|
$items = $model->field("count(distinct game_id,create_device_number) count, FROM_UNIXTIME(create_time, '%Y-%m-%d') as day,
|
|
|
|
|
(" . $sql . ") as num")
|
|
|
|
|
$subQuery = $model->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day,count(DISTINCT create_device_number) as count')
|
|
|
|
|
->where($conditions)
|
|
|
|
|
->group("day")
|
|
|
|
|
->group('game_id')
|
|
|
|
|
->buildSql();
|
|
|
|
|
$items = M()->field("*,sum(count) as count,(" . $sql . ") as num")
|
|
|
|
|
->table($subQuery)
|
|
|
|
|
->alias('a')
|
|
|
|
|
->group('day')
|
|
|
|
|
->having('num = 0')
|
|
|
|
|
->select();
|
|
|
|
|
return $this->assembleRecords($items, $dayList, 'count');
|
|
|
|
@ -476,10 +494,14 @@ class UserRepository
|
|
|
|
|
->where("ti.create_ip = create_ip and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
|
|
|
|
|
->fetchSql(true)
|
|
|
|
|
->count();
|
|
|
|
|
$items = $model->field("count(distinct game_id,create_ip) count, FROM_UNIXTIME(create_time, '%Y-%m-%d') as day,
|
|
|
|
|
(" . $sql . ") as num")
|
|
|
|
|
$subQuery = $model->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day,count(DISTINCT create_ip) as count')
|
|
|
|
|
->where($conditions)
|
|
|
|
|
->group("day")
|
|
|
|
|
->group('game_id')
|
|
|
|
|
->buildSql();
|
|
|
|
|
$items = M()->field("*,sum(count) as count,(" . $sql . ") as num")
|
|
|
|
|
->table($subQuery)
|
|
|
|
|
->alias('a')
|
|
|
|
|
->group('day')
|
|
|
|
|
->having('num = 0')
|
|
|
|
|
->select();
|
|
|
|
|
return $this->assembleRecords($items, $dayList, 'count');
|
|
|
|
|