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