|
|
@ -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');
|
|
|
@ -1767,6 +1769,8 @@ class QueryController extends BaseController
|
|
|
|
$map['promote_id'] = $queryPromote['id'];
|
|
|
|
$map['promote_id'] = $queryPromote['id'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$roleIds = M('user_play_data_count', 'tab_')->group('role_id')->getField('role_id', true);
|
|
|
|
|
|
|
|
$map['role_id'] = ['in', $roleIds];
|
|
|
|
$subMap['create_time'] = ['between', [$begTime, $endTime - 1]];
|
|
|
|
$subMap['create_time'] = ['between', [$begTime, $endTime - 1]];
|
|
|
|
if ($costBegin != '' || $costEnd != '') {
|
|
|
|
if ($costBegin != '' || $costEnd != '') {
|
|
|
|
$having = '';
|
|
|
|
$having = '';
|
|
|
@ -1782,27 +1786,57 @@ class QueryController extends BaseController
|
|
|
|
->group('game_id,server_id,role_id')
|
|
|
|
->group('game_id,server_id,role_id')
|
|
|
|
->having($having)
|
|
|
|
->having($having)
|
|
|
|
->buildSql();
|
|
|
|
->buildSql();
|
|
|
|
$map['_string'] = 'role_id in (' . $subQuery . ')';
|
|
|
|
$map['_string'] = 'role_id in(' . $subQuery . ')';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$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';
|
|
|
|
$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['_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)
|
|
|
|
->buildSql();
|
|
|
|
->buildSql();
|
|
|
|
$sqlCount = M('user_play_data_count', 'tab_')->alias('uc')
|
|
|
|
$sqlCount = M('user_play_data_count', 'tab_')->alias('uc')
|
|
|
|
->field('sum(uc.recharge_count) count')
|
|
|
|
->field('sum(uc . recharge_count) count')
|
|
|
|
->where($spendMap)
|
|
|
|
->where($spendMap)
|
|
|
|
->buildSql();
|
|
|
|
->buildSql();
|
|
|
|
$spendMap['uc.create_time'] = ['between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]];
|
|
|
|
$spendMap['uc . create_time'] = ['between', [strtotime(date('Y - m - d 00:00:00')), strtotime(date('Y - m - d 23:59:59'))]];
|
|
|
|
$sqlTodayCost = M('user_play_data_count', 'tab_')->alias('uc')
|
|
|
|
$sqlTodayCost = M('user_play_data_count', 'tab_')->alias('uc')
|
|
|
|
->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,15 +1848,15 @@ 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'],
|
|
|
|
'promote_account' => $role['promote_account'],
|
|
|
|
'promote_account' => $role['promote_account'],
|
|
|
|
'sdk_version' => $role['sdk_version'],
|
|
|
|
'sdk_version' => $role['sdk_version'],
|
|
|
|
'unlogin_day' => intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $role['play_time']))) / (24 * 3600))
|
|
|
|
'unlogin_day' => intval((strtotime(date('Y - m - d 00:00:00')) - strtotime(date('Y - m - d 00:00:00', $role['play_time']))) / (24 * 3600))
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1835,6 +1869,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');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1919,11 +1954,11 @@ class QueryController extends BaseController
|
|
|
|
|
|
|
|
|
|
|
|
public function achievement()
|
|
|
|
public function achievement()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$time = I('time', date('Y-m-d'));
|
|
|
|
$time = I('time', date('Y - m - d'));
|
|
|
|
if(!empty($time)) {
|
|
|
|
if (!empty($time)) {
|
|
|
|
$defaultTime = $time ;
|
|
|
|
$defaultTime = $time;
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
$defaultTime = date('Y-m-d',time());
|
|
|
|
$defaultTime = date('Y - m - d', time());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$sdkVersion = I('sdk_version', 0);
|
|
|
|
$sdkVersion = I('sdk_version', 0);
|
|
|
|
$gameId = I('game_id', 0);
|
|
|
|
$gameId = I('game_id', 0);
|
|
|
@ -1968,14 +2003,14 @@ class QueryController extends BaseController
|
|
|
|
if (count($ids) > 0) {
|
|
|
|
if (count($ids) > 0) {
|
|
|
|
$rows = M('promote', 'tab_')
|
|
|
|
$rows = M('promote', 'tab_')
|
|
|
|
->field(['id', 'chain'])
|
|
|
|
->field(['id', 'chain'])
|
|
|
|
->where(['chain' => ['like', [$parent['chain'] . $parent['id'] . '/%']], 'level' => ['gt', $parent['level'] + 1]])
|
|
|
|
->where(['chain' => ['like', [$parent['chain'] . $parent['id'] . ' /%']], 'level' => ['gt', $parent['level'] + 1]])
|
|
|
|
->select();
|
|
|
|
->select();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$basicPromotes = [];
|
|
|
|
$basicPromotes = [];
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
foreach ($rows as $row) {
|
|
|
|
foreach ($rows as $row) {
|
|
|
|
$needChain = $parent['chain'] . $parent['id'] . '/' . $id . '/';
|
|
|
|
$needChain = $parent['chain'] . $parent['id'] . ' / ' . $id . ' / ';
|
|
|
|
if (strpos($row['chain'], $needChain) !== false) {
|
|
|
|
if (strpos($row['chain'], $needChain) !== false) {
|
|
|
|
$basicPromotes[$row['id']] = $id;
|
|
|
|
$basicPromotes[$row['id']] = $id;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2014,7 +2049,7 @@ class QueryController extends BaseController
|
|
|
|
$rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params);
|
|
|
|
$rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params);
|
|
|
|
$rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params);
|
|
|
|
$rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params);
|
|
|
|
$rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params);
|
|
|
|
$rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params);
|
|
|
|
|
|
|
|
|
|
|
|
if (I('p', 1) == 1) {
|
|
|
|
if (I('p', 1) == 1) {
|
|
|
|
$selfParams = $params;
|
|
|
|
$selfParams = $params;
|
|
|
|
$selfParams['isContainSubs'] = false;
|
|
|
|
$selfParams['isContainSubs'] = false;
|
|
|
@ -2083,13 +2118,13 @@ class QueryController extends BaseController
|
|
|
|
$this->assign('parentid', $parentId);
|
|
|
|
$this->assign('parentid', $parentId);
|
|
|
|
$this->assign('count', $count);
|
|
|
|
$this->assign('count', $count);
|
|
|
|
$this->assign('timeout', $timeout);
|
|
|
|
$this->assign('timeout', $timeout);
|
|
|
|
$this->assign('time',$defaultTime);
|
|
|
|
$this->assign('time', $defaultTime);
|
|
|
|
$this->display();
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getChildPromoteList()
|
|
|
|
public function getChildPromoteList()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$promoteId = intval(I('post.promote_id', 0));
|
|
|
|
$promoteId = intval(I('post . promote_id', 0));
|
|
|
|
$promoteId = empty($promoteId) ? PID : $promoteId;
|
|
|
|
$promoteId = empty($promoteId) ? PID : $promoteId;
|
|
|
|
$promoteList = getAllPromoteListByType(3, false, $promoteId);
|
|
|
|
$promoteList = getAllPromoteListByType(3, false, $promoteId);
|
|
|
|
$data['status'] = 1;
|
|
|
|
$data['status'] = 1;
|
|
|
@ -2100,13 +2135,13 @@ class QueryController extends BaseController
|
|
|
|
|
|
|
|
|
|
|
|
public function userPlayDataCount()
|
|
|
|
public function userPlayDataCount()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$time = strtotime(date('Y-m-d 00:00:00',time() - (3600 * 24)));
|
|
|
|
$time = strtotime(date('Y - m - d 00:00:00', time() - (3600 * 24)));
|
|
|
|
$spendMap['pay_status'] = 1;
|
|
|
|
$spendMap['pay_status'] = 1;
|
|
|
|
$spendMap['pay_game_status'] = 1;
|
|
|
|
$spendMap['pay_game_status'] = 1;
|
|
|
|
$spendMap['game_player_id'] = ['gt', 0];
|
|
|
|
$spendMap['game_player_id'] = ['gt', 0];
|
|
|
|
$spendMap['pay_time'] = ['between', [$time, strtotime(date('Y-m-d 23:59:59', $time))]];
|
|
|
|
$spendMap['pay_time'] = ['between', [$time, strtotime(date('Y - m - d 23:59:59', $time))]];
|
|
|
|
|
|
|
|
|
|
|
|
$field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as day,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count';
|
|
|
|
$field = 'FROM_UNIXTIME(pay_time, "%Y-%m-%d") as day,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count';
|
|
|
|
$spendCostData = M('spend', 'tab_')->field($field)
|
|
|
|
$spendCostData = M('spend', 'tab_')->field($field)
|
|
|
|
->where($spendMap)
|
|
|
|
->where($spendMap)
|
|
|
|
->group('day,game_player_id,server_id,game_id')
|
|
|
|
->group('day,game_player_id,server_id,game_id')
|
|
|
|