|
|
|
@ -1160,7 +1160,8 @@ class QueryController extends BaseController
|
|
|
|
|
|
|
|
|
|
public function users()
|
|
|
|
|
{
|
|
|
|
|
$promoteId = session('promote_auth.pid');
|
|
|
|
|
$promote = $this->getLoginPromote();
|
|
|
|
|
$promoteId = $promote['id'];
|
|
|
|
|
$map = [
|
|
|
|
|
'_logic' => 'or',
|
|
|
|
|
'id' => $promoteId,
|
|
|
|
@ -1192,44 +1193,85 @@ class QueryController extends BaseController
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function userRoles($p = 0)
|
|
|
|
|
public function userRoles()
|
|
|
|
|
{
|
|
|
|
|
$promoteId = session('promote_auth.pid');
|
|
|
|
|
$gameId = I('game_id', 0);
|
|
|
|
|
$serverId = I('server_id', 0);
|
|
|
|
|
$isSelf = I('is_self', 0);
|
|
|
|
|
$roleName = I('role_name', '');
|
|
|
|
|
$userAccount = I('user_account', '');
|
|
|
|
|
$promoteId = I('promote_id', 0);
|
|
|
|
|
$sdkVersion = I('sdk_version', 0);
|
|
|
|
|
$roleLevelBegin = intval(I('role_level_begin', 0));
|
|
|
|
|
$roleLevelEnd = intval(I('role_level_end', 0));
|
|
|
|
|
$headmanPromoteId = I('headman_promote_id', 0);
|
|
|
|
|
$playTime = I('play_time', '');
|
|
|
|
|
|
|
|
|
|
$promote = $this->getLoginPromote();
|
|
|
|
|
$map = [
|
|
|
|
|
'_logic' => 'or',
|
|
|
|
|
'id' => $promoteId,
|
|
|
|
|
'parent_id' => $promoteId,
|
|
|
|
|
'grand_id' => $promoteId,
|
|
|
|
|
'id' => $promote['id'],
|
|
|
|
|
'parent_id' => $promote['id'],
|
|
|
|
|
'grand_id' => $promote['id'],
|
|
|
|
|
];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
|
|
|
|
|
|
|
|
|
|
$promotes = [];
|
|
|
|
|
$groupPromotes = [];
|
|
|
|
|
if ($promote['parent_id'] == 0) {
|
|
|
|
|
$groupPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promoteId])->select();
|
|
|
|
|
$promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['grand_id' => $promoteId])->select();
|
|
|
|
|
}
|
|
|
|
|
if ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) {
|
|
|
|
|
$promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promoteId])->select();
|
|
|
|
|
}
|
|
|
|
|
$promotes = $this->getGroupPromotes($promote);
|
|
|
|
|
$groupPromotes = $this->getGroupPromotes($promote);
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
|
$map = ['user_id' => $userId];
|
|
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
|
|
$map['game_name'] = trim($_REQUEST['game_name']);
|
|
|
|
|
unset($_REQUEST['game_name']);
|
|
|
|
|
$map = ['promote_id' => ['in', $ids]];
|
|
|
|
|
|
|
|
|
|
if ($gameId != 0) {
|
|
|
|
|
$map['game_id'] = $gameId;
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['server_id'])) {
|
|
|
|
|
$map['server_id'] = trim($_REQUEST['server_id']);
|
|
|
|
|
unset($_REQUEST['server_id']);
|
|
|
|
|
if ($serverId != 0) {
|
|
|
|
|
$map['serverId'] = $serverId;
|
|
|
|
|
}
|
|
|
|
|
if ($roleName != '') {
|
|
|
|
|
$map['role_name'] = ['like', '%' . $roleName . '%'];
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['role_name'])) {
|
|
|
|
|
$map['role_name'] = trim($_REQUEST['role_name']);
|
|
|
|
|
unset($_REQUEST['role_name']);
|
|
|
|
|
if ($userAccount != '') {
|
|
|
|
|
$map['user_acount'] = ['like', '%' . $userAccount . '%'];
|
|
|
|
|
}
|
|
|
|
|
if ($sdkVersion != 0) {
|
|
|
|
|
$map['sdk_version'] = $sdkVersion;
|
|
|
|
|
}
|
|
|
|
|
if ($roleLevelBegin != 0 && $roleLevelEnd == 0) {
|
|
|
|
|
$map['role_level'] = ['egt', $roleLevelBegin];
|
|
|
|
|
} elseif ($roleLevelEnd != 0 && $roleLevelBegin == 0) {
|
|
|
|
|
$map['role_level'] = ['elt', $roleLevelEnd];
|
|
|
|
|
} elseif ($roleLevelEnd != 0 && $roleLevelBegin != 0) {
|
|
|
|
|
$map['role_level'] = ['between', [$roleLevelBegin, $roleLevelEnd]];
|
|
|
|
|
}
|
|
|
|
|
if ($playTime != '') {
|
|
|
|
|
$playTimeRow = explode(' 至 ', $playTime);
|
|
|
|
|
$playTimeBegin = 0;
|
|
|
|
|
$playTimeEnd = 0;
|
|
|
|
|
if (count($playTimeRow) == 2) {
|
|
|
|
|
$playTimeBegin = strtotime($playTimeRow[0] . ' 00:00:00');
|
|
|
|
|
$playTimeEnd = strtotime($playTimeRow[1] . ' 23:59:59');
|
|
|
|
|
} else {
|
|
|
|
|
$playTimeBegin = strtotime($playTimeRow[0] . ' 00:00:00');
|
|
|
|
|
$playTimeEnd = strtotime($playTimeRow[0] . ' 23:59:59');
|
|
|
|
|
}
|
|
|
|
|
$map['play_time'] = ['between', [$playTimeBegin, $playTimeEnd]];
|
|
|
|
|
}
|
|
|
|
|
if ($isSelf) {
|
|
|
|
|
$map['promote_id'] = $promote['id'];
|
|
|
|
|
} else {
|
|
|
|
|
if ($headmanPromoteId != 0) {
|
|
|
|
|
$map['promote_id'] = $headmanPromoteId;
|
|
|
|
|
} elseif ($promoteId != 0) {
|
|
|
|
|
$map['promote_id'] = $promoteId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$map['promote_d'] = ['in', $ids];
|
|
|
|
|
$query = M('user_play_info', 'tab_')->where($map);
|
|
|
|
|
list($records, $pagination, $count) = $this->paginate($query);
|
|
|
|
|
|
|
|
|
|
$games = $this->getGamesByPromote($promote);
|
|
|
|
|
|
|
|
|
|
$this->assign('games', $games);
|
|
|
|
|
$this->assign('records', $records);
|
|
|
|
|
$this->assign('pagination', $pagination);
|
|
|
|
|
$this->assign('count', $count);
|
|
|
|
@ -1238,44 +1280,67 @@ class QueryController extends BaseController
|
|
|
|
|
|
|
|
|
|
public function userRecharges()
|
|
|
|
|
{
|
|
|
|
|
$userId = I('id', 0);
|
|
|
|
|
|
|
|
|
|
$promoteId = session('promote_auth.pid');
|
|
|
|
|
$gameId = I('game_id', 0);
|
|
|
|
|
$serverId = I('server_id', 0);
|
|
|
|
|
$isSelf = I('is_self', 0);
|
|
|
|
|
$roleName = I('role_name', '');
|
|
|
|
|
$userAccount = I('user_account', '');
|
|
|
|
|
$promoteId = I('promote_id', 0);
|
|
|
|
|
$sdkVersion = I('sdk_version', 0);
|
|
|
|
|
$headmanPromoteId = I('headman_promote_id', 0);
|
|
|
|
|
|
|
|
|
|
$promote = $this->getLoginPromote();
|
|
|
|
|
$map = [
|
|
|
|
|
'_logic' => 'or',
|
|
|
|
|
'id' => $promoteId,
|
|
|
|
|
'parent_id' => $promoteId,
|
|
|
|
|
'grand_id' => $promoteId,
|
|
|
|
|
'id' => $promote['id'],
|
|
|
|
|
'parent_id' => $promote['id'],
|
|
|
|
|
'grand_id' => $promote['id'],
|
|
|
|
|
];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
|
|
|
|
|
|
|
|
|
|
$map = ['user_id' => $userId];
|
|
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
|
|
$map['game_name'] = trim($_REQUEST['game_name']);
|
|
|
|
|
unset($_REQUEST['game_name']);
|
|
|
|
|
$promotes = $this->getGroupPromotes($promote);
|
|
|
|
|
$groupPromotes = $this->getGroupPromotes($promote);
|
|
|
|
|
|
|
|
|
|
$map = $spendMap = ['promote_id' => ['in' => $ids]];
|
|
|
|
|
if ($gameId != 0) {
|
|
|
|
|
$map['game_id'] = $gameId;
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['server_id'])) {
|
|
|
|
|
$map['server_id'] = trim($_REQUEST['server_id']);
|
|
|
|
|
unset($_REQUEST['server_id']);
|
|
|
|
|
if ($serverId != 0) {
|
|
|
|
|
$map['serverId'] = $serverId;
|
|
|
|
|
}
|
|
|
|
|
if ($roleName != '') {
|
|
|
|
|
$map['role_name'] = ['like', '%' . $roleName . '%'];
|
|
|
|
|
}
|
|
|
|
|
if ($userAccount != '') {
|
|
|
|
|
$map['user_acount'] = ['like', '%' . $userAccount . '%'];
|
|
|
|
|
}
|
|
|
|
|
if ($sdkVersion != 0) {
|
|
|
|
|
$map['sdk_version'] = $sdkVersion;
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['role_name'])) {
|
|
|
|
|
$map['role_name'] = trim($_REQUEST['role_name']);
|
|
|
|
|
unset($_REQUEST['role_name']);
|
|
|
|
|
if ($isSelf) {
|
|
|
|
|
$map['promote_id'] = $promote['id'];
|
|
|
|
|
$spendMap['promote_id'] = $promote['id'];
|
|
|
|
|
} else {
|
|
|
|
|
if ($headmanPromoteId != 0) {
|
|
|
|
|
$map['promote_id'] = $headmanPromoteId;
|
|
|
|
|
$spendMap['promote_id'] = $headmanPromoteId;
|
|
|
|
|
} elseif ($promoteId != 0) {
|
|
|
|
|
$map['promote_id'] = $promoteId;
|
|
|
|
|
$spendMap['promote_id'] = $promoteId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$query = M('user_play_info', 'tab_')->where($map);
|
|
|
|
|
list($roles, $pagination, $count) = $this->paginate($query);
|
|
|
|
|
$roleIds = array_column($roles, 'role_id');
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
$map['pay_game_status'] = 1;
|
|
|
|
|
|
|
|
|
|
$spendMap['pay_status'] = 1;
|
|
|
|
|
$spendMap['pay_game_status'] = 1;
|
|
|
|
|
if (count($roleIds) > 0) {
|
|
|
|
|
$map['game_player_id'] = ['in', $roleIds];
|
|
|
|
|
$spendMap['game_player_id'] = ['in', $roleIds];
|
|
|
|
|
} else {
|
|
|
|
|
$map['_string'] = '1<>1';
|
|
|
|
|
$spendMap['_string'] = '1<>1';
|
|
|
|
|
}
|
|
|
|
|
$map['promote_id'] = ['in', $ids];
|
|
|
|
|
$allRecharges = M('spend', 'tab_')->field('count(*) count, sum(cost) cost, game_player_id')->where($map)->group('game_player_id')->select();
|
|
|
|
|
$allRecharges = M('spend', 'tab_')->field('count(*) count, sum(cost) cost, game_player_id')->where($gameMap)->group('game_player_id')->select();
|
|
|
|
|
$allRecords = [];
|
|
|
|
|
foreach ($allRecharges as $recharge) {
|
|
|
|
|
$allRecords[$recharge['game_player_id']] = $recharge;
|
|
|
|
@ -1310,12 +1375,53 @@ class QueryController extends BaseController
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$games = $this->getGamesByPromote($promote);
|
|
|
|
|
|
|
|
|
|
$this->assign('games', $games);
|
|
|
|
|
$this->assign('promotes', $promotes);
|
|
|
|
|
$this->assign('groupPromotes', $groupPromotes);
|
|
|
|
|
$this->assign('records', $records);
|
|
|
|
|
$this->assign('pagination', $pagination);
|
|
|
|
|
$this->assign('count', $count);
|
|
|
|
|
$this->display('userRecharges');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getGamesByPromote($promote)
|
|
|
|
|
{
|
|
|
|
|
return M('apply', 'tab_')->field(['game_id', 'game_name'])->where(['promote_id' => $promote['id']])->select();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getGroupPromotes($promote)
|
|
|
|
|
{
|
|
|
|
|
$promotes = [];
|
|
|
|
|
if ($promote['parent_id'] == 0) {
|
|
|
|
|
$promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promote['id']])->select();
|
|
|
|
|
}
|
|
|
|
|
return $promotes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getNormalPromotes($promote)
|
|
|
|
|
{
|
|
|
|
|
$promotes = [];
|
|
|
|
|
if ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) {
|
|
|
|
|
$promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promote['id']])->select();
|
|
|
|
|
} elseif ($promote['parent_id'] == 0) {
|
|
|
|
|
$promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['grand_id' => $promote['id']])->select();
|
|
|
|
|
}
|
|
|
|
|
return $promotes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getGameServers()
|
|
|
|
|
{
|
|
|
|
|
$gameId = I('game_id', 0);
|
|
|
|
|
$servers = M('server', 'tab_')->field(['id', 'server_name'])->where(['game_id' => $gameId])->select();
|
|
|
|
|
$this->ajaxReturn([
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'msg' => '成功',
|
|
|
|
|
'data' => ['servers' => $servers]
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* [充值详细信息]
|
|
|
|
|
* @param $id [充值id]
|
|
|
|
|