推广平台->数据管理--更新

master
chenxiaojun 5 years ago
parent bd6932d8d4
commit 80f76c4490

@ -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');

@ -1834,7 +1834,7 @@ class QueryController extends BaseController
->having('recharge_cost > 0') ->having('recharge_cost > 0')
->order('play_time desc') ->order('play_time desc')
->buildSql(); ->buildSql();
$query = M()->field(' * ') $query = M()->field('*')
->table($subQuery) ->table($subQuery)
->alias('a') ->alias('a')
->order($orderBy); ->order($orderBy);

@ -60,7 +60,7 @@
<label> ~ </label> <label> ~ </label>
<input type="text" class="txt integer-input" name="role_level_end" style="width: 50px" value="{:I('role_level_end')}" > <input type="text" class="txt integer-input" name="role_level_end" style="width: 50px" value="{:I('role_level_end')}" >
</div> </div>
<div class="form-group"> <div class="form-group normal_space">
<input type="submit" class="submit" id='submit' url="{:U('Query/userRoles','model='.$model['name'],false)}" <input type="submit" class="submit" id='submit' url="{:U('Query/userRoles','model='.$model['name'],false)}"
value="查询"> value="查询">
</div> </div>
@ -107,7 +107,7 @@
</div> </div>
<div class="pagenation clearfix"> <div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?> <?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" data-href="{:U('download/userRoles_data_export',array_merge(['xlsname'=>'ceshi'],I('post.')))}" class="ajax-get">导出</a> <a id="sch-btn" data-href="{:U('download/userRoles_data_export',array_merge(['xlsname'=>'ceshi'],I('get.')))}" class="ajax-get">导出</a>
<?php endif ;?> <?php endif ;?>
{$pagination} {$pagination}
</div> </div>

Loading…
Cancel
Save