|
|
@ -1709,118 +1709,132 @@ class QueryController extends BaseController
|
|
|
|
$isSelf = I('is_self', 0);
|
|
|
|
$isSelf = I('is_self', 0);
|
|
|
|
$roleName = I('role_name', '');
|
|
|
|
$roleName = I('role_name', '');
|
|
|
|
$userAccount = I('user_account', '');
|
|
|
|
$userAccount = I('user_account', '');
|
|
|
|
$promoteId = I('promote_id', 0);
|
|
|
|
|
|
|
|
$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', '');
|
|
|
|
|
|
|
|
$sortName = trim(I('sort_name', ''));
|
|
|
|
|
|
|
|
$sort = intval(I('sort', 1));
|
|
|
|
|
|
|
|
$nowTime = date('Y-m-d');
|
|
|
|
|
|
|
|
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
|
|
|
|
|
|
|
|
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
|
|
|
|
|
|
|
|
$initEndTime = $nowTime;
|
|
|
|
|
|
|
|
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
|
|
|
|
|
|
|
|
$begTime = strtotime($initBegTime);
|
|
|
|
|
|
|
|
$endTime = strtotime($initEndTime);
|
|
|
|
|
|
|
|
$endTime += 3600 * 24;
|
|
|
|
|
|
|
|
|
|
|
|
$promote = $this->getLoginPromote();
|
|
|
|
$promote = $this->getLoginPromote();
|
|
|
|
$levelPromote = $this->getLevelPromote();
|
|
|
|
$levelPromote = $this->getLevelPromote();
|
|
|
|
$queryPromote = $this->getQueryPromote($levelPromote);
|
|
|
|
$queryPromote = $this->getQueryPromote($levelPromote);
|
|
|
|
|
|
|
|
|
|
|
|
$map[] = [
|
|
|
|
$records = [];
|
|
|
|
'_logic' => 'or',
|
|
|
|
$pagination = '';
|
|
|
|
'id' => $queryPromote['id'],
|
|
|
|
$count = 0;
|
|
|
|
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
|
|
|
|
if (intval($endTime - $begTime) / (24 * 3600) <= 31) {
|
|
|
|
];
|
|
|
|
$map[] = [
|
|
|
|
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
|
|
|
|
'_logic' => 'or',
|
|
|
|
|
|
|
|
'id' => $queryPromote['id'],
|
|
|
|
|
|
|
|
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
|
|
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
$map = [];
|
|
|
|
if (count($ids) > 0) {
|
|
|
|
if (count($ids) > 0) {
|
|
|
|
$map = ['promote_id' => ['in', $ids]];
|
|
|
|
$map = ['promote_id' => ['in', $ids]];
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$map['_string'] = '1<>1';
|
|
|
|
$map['_string'] = '1<>1';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$spendMap = $map;
|
|
|
|
$subMap = [];
|
|
|
|
if ($gameId != 0) {
|
|
|
|
if ($gameId != 0) {
|
|
|
|
$map['game_id'] = $gameId;
|
|
|
|
$map['game_id'] = $gameId;
|
|
|
|
}
|
|
|
|
$subMap['game_id'] = $gameId;
|
|
|
|
if ($serverId != 0) {
|
|
|
|
}
|
|
|
|
$map['server_id'] = $serverId;
|
|
|
|
if ($serverId != 0) {
|
|
|
|
}
|
|
|
|
$map['server_id'] = $serverId;
|
|
|
|
if ($roleName != '') {
|
|
|
|
$subMap['server_id'] = $serverId;
|
|
|
|
$map['role_name'] = ['like', '%' . $roleName . '%'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($roleName != '') {
|
|
|
|
if ($userAccount != '') {
|
|
|
|
$map['role_name'] = ['like', '%' . $roleName . '%'];
|
|
|
|
$map['user_account'] = ['like', '%' . $userAccount . '%'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($userAccount != '') {
|
|
|
|
if ($sdkVersion != 0) {
|
|
|
|
$map['user_account'] = ['like', '%' . $userAccount . '%'];
|
|
|
|
$map['sdk_version'] = $sdkVersion;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($sdkVersion != 0) {
|
|
|
|
if ($isSelf) {
|
|
|
|
$map['sdk_version'] = $sdkVersion;
|
|
|
|
$map['promote_id'] = $queryPromote['id'];
|
|
|
|
}
|
|
|
|
$spendMap['promote_id'] = $queryPromote['id'];
|
|
|
|
if ($isSelf) {
|
|
|
|
}
|
|
|
|
$map['promote_id'] = $queryPromote['id'];
|
|
|
|
if ($costBegin != '' || $costEnd != '') {
|
|
|
|
|
|
|
|
$having = '';
|
|
|
|
|
|
|
|
if ($costBegin != '' && $costEnd != '') {
|
|
|
|
|
|
|
|
$having = 'sum(cost) between ' . $costBegin . ' and ' . $costEnd;
|
|
|
|
|
|
|
|
} elseif ($costBegin != '' && $costEnd == '') {
|
|
|
|
|
|
|
|
$having = 'sum(cost) >= ' . $costBegin;
|
|
|
|
|
|
|
|
} elseif ($costBegin == '' && $costEnd != '') {
|
|
|
|
|
|
|
|
$having = 'sum(cost) <= ' . $costEnd;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$subMap = $map;
|
|
|
|
|
|
|
|
$subMap['pay_status'] = 1;
|
|
|
|
|
|
|
|
$subMap['pay_game_status'] = 1;
|
|
|
|
|
|
|
|
$subQuery = M('spend', 'tab_')->field('game_player_id')->where($subMap)->group('game_player_id')->having($having)->buildSql();
|
|
|
|
|
|
|
|
$map['_string'] = 'role_id in (' . $subQuery . ')';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$query = M('user_play_info', 'tab_')->where($map)->order('play_time desc');
|
|
|
|
|
|
|
|
list($roles, $pagination, $count) = $this->paginate($query);
|
|
|
|
|
|
|
|
$roleIds = array_column($roles, 'role_id');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$spendMap['pay_status'] = 1;
|
|
|
|
|
|
|
|
$spendMap['pay_game_status'] = 1;
|
|
|
|
|
|
|
|
if (count($roleIds) > 0) {
|
|
|
|
|
|
|
|
$spendMap['game_player_id'] = ['in', $roleIds];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$spendMap['_string'] = '1<>1';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$allRecharges = M('spend', 'tab_')->field('count(*) count, sum(cost) cost, game_player_id')->where($spendMap)->group('game_player_id')->select();
|
|
|
|
|
|
|
|
$allRecords = [];
|
|
|
|
|
|
|
|
foreach ($allRecharges as $recharge) {
|
|
|
|
|
|
|
|
$allRecords[$recharge['game_player_id']] = $recharge;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$spendMap['pay_time'] = ['between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]];
|
|
|
|
$subMap['create_time'] = ['between', [$begTime, $endTime - 1]];
|
|
|
|
$todayRecharges = M('spend', 'tab_')->field('sum(cost) cost, game_player_id')->where($spendMap)->group('game_player_id')->select();
|
|
|
|
if ($costBegin != '' || $costEnd != '') {
|
|
|
|
$todayRecords = [];
|
|
|
|
$having = '';
|
|
|
|
foreach ($todayRecharges as $recharge) {
|
|
|
|
if ($costBegin != '' && $costEnd != '') {
|
|
|
|
$todayRecords[$recharge['game_player_id']] = $recharge;
|
|
|
|
$having = 'sum(recharge_cost) between ' . $costBegin . ' and ' . $costEnd;
|
|
|
|
}
|
|
|
|
} elseif ($costBegin != '' && $costEnd == '') {
|
|
|
|
|
|
|
|
$having = 'sum(recharge_cost) >= ' . $costBegin;
|
|
|
|
|
|
|
|
} elseif ($costBegin == '' && $costEnd != '') {
|
|
|
|
|
|
|
|
$having = 'sum(recharge_cost) <= ' . $costEnd;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$subQuery = M('user_play_data_count', 'tab_')->field('role_id')
|
|
|
|
|
|
|
|
->where($subMap)
|
|
|
|
|
|
|
|
->group('game_id,server_id,role_id')
|
|
|
|
|
|
|
|
->having($having)
|
|
|
|
|
|
|
|
->buildSql();
|
|
|
|
|
|
|
|
$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';
|
|
|
|
|
|
|
|
$sqlCost = M('user_play_data_count', 'tab_')->alias('uc')
|
|
|
|
|
|
|
|
->field('sum(uc.recharge_cost) cost')
|
|
|
|
|
|
|
|
->where($spendMap)
|
|
|
|
|
|
|
|
->buildSql();
|
|
|
|
|
|
|
|
$sqlCount = M('user_play_data_count', 'tab_')->alias('uc')
|
|
|
|
|
|
|
|
->field('sum(uc.recharge_count) count')
|
|
|
|
|
|
|
|
->where($spendMap)
|
|
|
|
|
|
|
|
->buildSql();
|
|
|
|
|
|
|
|
$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')
|
|
|
|
|
|
|
|
->field('sum(uc.recharge_count) count')
|
|
|
|
|
|
|
|
->where($spendMap)
|
|
|
|
|
|
|
|
->buildSql();
|
|
|
|
|
|
|
|
$query = M('user_play_info', 'tab_')
|
|
|
|
|
|
|
|
->field("*,$sqlCost as cost,$sqlCount as count,$sqlTodayCost as today_cost")
|
|
|
|
|
|
|
|
->where($map)
|
|
|
|
|
|
|
|
->order('play_time desc');
|
|
|
|
|
|
|
|
list($roles, $pagination, $count) = $this->paginate($query);
|
|
|
|
|
|
|
|
|
|
|
|
$records = [];
|
|
|
|
foreach ($roles as $role) {
|
|
|
|
foreach ($roles as $role) {
|
|
|
|
$records[] = [
|
|
|
|
$records[] = [
|
|
|
|
'user_account' => encryption($role['user_account']),
|
|
|
|
'user_account' => encryption($role['user_account']),
|
|
|
|
'game_name' => $role['game_name'],
|
|
|
|
'game_name' => $role['game_name'],
|
|
|
|
'role_name' => $role['role_name'],
|
|
|
|
'role_name' => $role['role_name'],
|
|
|
|
'role_id' => $role['role_id'],
|
|
|
|
'role_id' => $role['role_id'],
|
|
|
|
'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' => isset($allRecords[$role['role_id']]) ? round(floatval($allRecords[$role['role_id']]['cost']), 2) : 0,
|
|
|
|
'recharge_count' => $role['count'],
|
|
|
|
'recharge_count' => isset($allRecords[$role['role_id']]) ? $allRecords[$role['role_id']]['count'] : 0,
|
|
|
|
'recharge_cost_today' => $role['cost_today'],
|
|
|
|
'recharge_cost_today' => isset($todayRecords[$role['role_id']]) ? round(floatval($todayRecords[$role['role_id']]['cost']), 2) : 0,
|
|
|
|
'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))
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$games = $this->getGamesByPromote($promote);
|
|
|
|
$games = $this->getGamesByPromote($promote);
|
|
|
|
|
|
|
|
|
|
|
|
$this->assign('games', $games);
|
|
|
|
$this->assign('games', $games);
|
|
|
|
$this->assign('promotes', $promotes);
|
|
|
|
|
|
|
|
$this->assign('groupPromotes', $groupPromotes);
|
|
|
|
|
|
|
|
$this->assign('records', $records);
|
|
|
|
$this->assign('records', $records);
|
|
|
|
$this->assign('pagination', $pagination);
|
|
|
|
$this->assign('pagination', $pagination);
|
|
|
|
$this->assign('count', $count);
|
|
|
|
$this->assign('count', $count);
|
|
|
|
|
|
|
|
$this->assign('initBegTime', $initBegTime);
|
|
|
|
|
|
|
|
$this->assign('initEndTime', $initEndTime);
|
|
|
|
$this->display('userRecharges');
|
|
|
|
$this->display('userRecharges');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1906,10 +1920,10 @@ 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);
|
|
|
@ -2000,7 +2014,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;
|
|
|
@ -2013,7 +2027,7 @@ class QueryController extends BaseController
|
|
|
|
$selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams);
|
|
|
|
$selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams);
|
|
|
|
$selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams);
|
|
|
|
$selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams);
|
|
|
|
$selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams);
|
|
|
|
$selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams);
|
|
|
|
|
|
|
|
|
|
|
|
$records[] = [
|
|
|
|
$records[] = [
|
|
|
|
'id' => $parent['id'],
|
|
|
|
'id' => $parent['id'],
|
|
|
|
'account' => $parent['account'],
|
|
|
|
'account' => $parent['account'],
|
|
|
@ -2070,7 +2084,7 @@ 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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|