|
|
@ -1712,8 +1712,10 @@ class QueryController extends BaseController
|
|
|
|
$sdkVersion = I('sdk_version', 0);
|
|
|
|
$sdkVersion = I('sdk_version', 0);
|
|
|
|
$costBegin = I('cost_begin', '');
|
|
|
|
$costBegin = I('cost_begin', '');
|
|
|
|
$costEnd = I('cost_end', '');
|
|
|
|
$costEnd = I('cost_end', '');
|
|
|
|
|
|
|
|
$lastSortName = trim(I('last_sort_name', ''));
|
|
|
|
$sortName = trim(I('sort_name', ''));
|
|
|
|
$sortName = trim(I('sort_name', ''));
|
|
|
|
$sort = intval(I('sort', 1));
|
|
|
|
$sort = intval(I('sort', 1));
|
|
|
|
|
|
|
|
$sortNameData = ['recharge_cost', 'recharge_count', 'recharge_cost_today', 'unlogin_day'];
|
|
|
|
$nowTime = date('Y-m-d');
|
|
|
|
$nowTime = date('Y-m-d');
|
|
|
|
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
|
|
|
|
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
|
|
|
|
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
|
|
|
|
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
|
|
|
@ -1784,8 +1786,32 @@ class QueryController extends BaseController
|
|
|
|
->buildSql();
|
|
|
|
->buildSql();
|
|
|
|
$map['_string'] = 'role_id in (' . $subQuery . ')';
|
|
|
|
$map['_string'] = 'role_id in (' . $subQuery . ')';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$orderBy = 'play_time desc';
|
|
|
|
|
|
|
|
if (!empty($sortName)) {
|
|
|
|
|
|
|
|
if (in_array($sortName, $sortNameData)) {
|
|
|
|
|
|
|
|
$desc = ' desc';
|
|
|
|
|
|
|
|
$asc = ' asc';
|
|
|
|
|
|
|
|
if ($sortName == 'unlogin_day') {
|
|
|
|
|
|
|
|
$sortName = 'play_time';
|
|
|
|
|
|
|
|
$desc = ' asc';
|
|
|
|
|
|
|
|
$asc = ' desc';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($lastSortName == 'unlogin_day') {
|
|
|
|
|
|
|
|
$lastSortName = 'play_time';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($lastSortName != $sortName) {
|
|
|
|
|
|
|
|
$sortString = $desc;
|
|
|
|
|
|
|
|
$sort = 1;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$sortString = ($sort == 1) ? $desc : $asc;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$orderBy = $sortName . $sortString;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$spendMap['uc.create_time'] = ['between', [$begTime, $endTime - 1]];
|
|
|
|
$spendMap['uc.create_time'] = ['between', [$begTime, $endTime - 1]];
|
|
|
|
$spendMap['_string'] = 'uc.game_id = game_id and uc.server_id = server_id and uc.role_id = role_id';
|
|
|
|
$spendMap['_string'] = 'uc.game_id = tab_user_play_info.game_id and uc.server_id = tab_user_play_info.server_id and uc.role_id = tab_user_play_info.role_id';
|
|
|
|
$sqlCost = M('user_play_data_count', 'tab_')->alias('uc')
|
|
|
|
$sqlCost = M('user_play_data_count', 'tab_')->alias('uc')
|
|
|
|
->field('sum(uc.recharge_cost) cost')
|
|
|
|
->field('sum(uc.recharge_cost) cost')
|
|
|
|
->where($spendMap)
|
|
|
|
->where($spendMap)
|
|
|
@ -1799,10 +1825,16 @@ class QueryController extends BaseController
|
|
|
|
->field('sum(uc.recharge_count) count')
|
|
|
|
->field('sum(uc.recharge_count) count')
|
|
|
|
->where($spendMap)
|
|
|
|
->where($spendMap)
|
|
|
|
->buildSql();
|
|
|
|
->buildSql();
|
|
|
|
$query = M('user_play_info', 'tab_')
|
|
|
|
$subQuery = M('user_play_info', 'tab_')
|
|
|
|
->field("*,$sqlCost as cost,$sqlCount as count,$sqlTodayCost as today_cost")
|
|
|
|
->field("*,$sqlCost as recharge_cost,$sqlCount as recharge_count,$sqlTodayCost as recharge_cost_today")
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->order('play_time desc');
|
|
|
|
->order('play_time desc')
|
|
|
|
|
|
|
|
->buildSql();
|
|
|
|
|
|
|
|
$query = M()->field('*')
|
|
|
|
|
|
|
|
->table($subQuery)
|
|
|
|
|
|
|
|
->alias('a')
|
|
|
|
|
|
|
|
->order($orderBy);
|
|
|
|
|
|
|
|
|
|
|
|
list($roles, $pagination, $count) = $this->paginate($query);
|
|
|
|
list($roles, $pagination, $count) = $this->paginate($query);
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($roles as $role) {
|
|
|
|
foreach ($roles as $role) {
|
|
|
@ -1814,9 +1846,9 @@ class QueryController extends BaseController
|
|
|
|
'role_level' => $role['role_level'],
|
|
|
|
'role_level' => $role['role_level'],
|
|
|
|
'server_id' => $role['server_id'],
|
|
|
|
'server_id' => $role['server_id'],
|
|
|
|
'server_name' => $role['server_name'],
|
|
|
|
'server_name' => $role['server_name'],
|
|
|
|
'recharge_cost' => $role['cost'],
|
|
|
|
'recharge_cost' => empty($role['recharge_cost']) ? 0 : $role['recharge_cost'],
|
|
|
|
'recharge_count' => $role['count'],
|
|
|
|
'recharge_count' => empty($role['recharge_count']) ? 0 : $role['recharge_count'],
|
|
|
|
'recharge_cost_today' => $role['cost_today'],
|
|
|
|
'recharge_cost_today' => empty($role['recharge_cost_today']) ? 0 : $role['recharge_cost_today'],
|
|
|
|
'play_time' => $role['play_time'],
|
|
|
|
'play_time' => $role['play_time'],
|
|
|
|
'play_ip' => $role['play_ip'],
|
|
|
|
'play_ip' => $role['play_ip'],
|
|
|
|
'promote_id' => $role['promote_id'],
|
|
|
|
'promote_id' => $role['promote_id'],
|
|
|
@ -1835,6 +1867,7 @@ class QueryController extends BaseController
|
|
|
|
$this->assign('count', $count);
|
|
|
|
$this->assign('count', $count);
|
|
|
|
$this->assign('initBegTime', $initBegTime);
|
|
|
|
$this->assign('initBegTime', $initBegTime);
|
|
|
|
$this->assign('initEndTime', $initEndTime);
|
|
|
|
$this->assign('initEndTime', $initEndTime);
|
|
|
|
|
|
|
|
$this->assign('sort', $sort);
|
|
|
|
$this->display('userRecharges');
|
|
|
|
$this->display('userRecharges');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|