查询功能

master
elf@home 5 years ago
parent bfadef687f
commit 9f88ac7c11

@ -1160,7 +1160,8 @@ class QueryController extends BaseController
public function users() public function users()
{ {
$promoteId = session('promote_auth.pid'); $promote = $this->getLoginPromote();
$promoteId = $promote['id'];
$map = [ $map = [
'_logic' => 'or', '_logic' => 'or',
'id' => $promoteId, 'id' => $promoteId,
@ -1192,44 +1193,85 @@ class QueryController extends BaseController
$this->display(); $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 = [ $map = [
'_logic' => 'or', '_logic' => 'or',
'id' => $promoteId, 'id' => $promote['id'],
'parent_id' => $promoteId, 'parent_id' => $promote['id'],
'grand_id' => $promoteId, 'grand_id' => $promote['id'],
]; ];
$ids = M('promote', 'tab_')->where($map)->getField('id', true); $ids = M('promote', 'tab_')->where($map)->getField('id', true);
$promotes = []; $promotes = $this->getGroupPromotes($promote);
$groupPromotes = []; $groupPromotes = $this->getGroupPromotes($promote);
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();
}
$map = []; $map = [];
$map = ['user_id' => $userId]; $map = ['promote_id' => ['in', $ids]];
if (isset($_REQUEST['game_name'])) {
$map['game_name'] = trim($_REQUEST['game_name']); if ($gameId != 0) {
unset($_REQUEST['game_name']); $map['game_id'] = $gameId;
} }
if (isset($_REQUEST['server_id'])) { if ($serverId != 0) {
$map['server_id'] = trim($_REQUEST['server_id']); $map['serverId'] = $serverId;
unset($_REQUEST['server_id']); }
if ($roleName != '') {
$map['role_name'] = ['like', '%' . $roleName . '%'];
} }
if (isset($_REQUEST['role_name'])) { if ($userAccount != '') {
$map['role_name'] = trim($_REQUEST['role_name']); $map['user_acount'] = ['like', '%' . $userAccount . '%'];
unset($_REQUEST['role_name']); }
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); $query = M('user_play_info', 'tab_')->where($map);
list($records, $pagination, $count) = $this->paginate($query); list($records, $pagination, $count) = $this->paginate($query);
$games = $this->getGamesByPromote($promote);
$this->assign('games', $games);
$this->assign('records', $records); $this->assign('records', $records);
$this->assign('pagination', $pagination); $this->assign('pagination', $pagination);
$this->assign('count', $count); $this->assign('count', $count);
@ -1238,44 +1280,67 @@ class QueryController extends BaseController
public function userRecharges() public function userRecharges()
{ {
$userId = I('id', 0); $gameId = I('game_id', 0);
$serverId = I('server_id', 0);
$promoteId = session('promote_auth.pid'); $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 = [ $map = [
'_logic' => 'or', '_logic' => 'or',
'id' => $promoteId, 'id' => $promote['id'],
'parent_id' => $promoteId, 'parent_id' => $promote['id'],
'grand_id' => $promoteId, 'grand_id' => $promote['id'],
]; ];
$ids = M('promote', 'tab_')->where($map)->getField('id', true); $ids = M('promote', 'tab_')->where($map)->getField('id', true);
$map = ['user_id' => $userId]; $promotes = $this->getGroupPromotes($promote);
if (isset($_REQUEST['game_name'])) { $groupPromotes = $this->getGroupPromotes($promote);
$map['game_name'] = trim($_REQUEST['game_name']);
unset($_REQUEST['game_name']); $map = $spendMap = ['promote_id' => ['in' => $ids]];
if ($gameId != 0) {
$map['game_id'] = $gameId;
} }
if (isset($_REQUEST['server_id'])) { if ($serverId != 0) {
$map['server_id'] = trim($_REQUEST['server_id']); $map['serverId'] = $serverId;
unset($_REQUEST['server_id']); }
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'])) { if ($isSelf) {
$map['role_name'] = trim($_REQUEST['role_name']); $map['promote_id'] = $promote['id'];
unset($_REQUEST['role_name']); $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); $query = M('user_play_info', 'tab_')->where($map);
list($roles, $pagination, $count) = $this->paginate($query); list($roles, $pagination, $count) = $this->paginate($query);
$roleIds = array_column($roles, 'role_id'); $roleIds = array_column($roles, 'role_id');
$map = []; $spendMap['pay_status'] = 1;
$map['pay_status'] = 1; $spendMap['pay_game_status'] = 1;
$map['pay_game_status'] = 1;
if (count($roleIds) > 0) { if (count($roleIds) > 0) {
$map['game_player_id'] = ['in', $roleIds]; $spendMap['game_player_id'] = ['in', $roleIds];
} else { } 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($gameMap)->group('game_player_id')->select();
$allRecharges = M('spend', 'tab_')->field('count(*) count, sum(cost) cost, game_player_id')->where($map)->group('game_player_id')->select();
$allRecords = []; $allRecords = [];
foreach ($allRecharges as $recharge) { foreach ($allRecharges as $recharge) {
$allRecords[$recharge['game_player_id']] = $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('records', $records);
$this->assign('pagination', $pagination); $this->assign('pagination', $pagination);
$this->assign('count', $count); $this->assign('count', $count);
$this->display('userRecharges'); $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] * @param $id [充值id]

@ -930,7 +930,7 @@ class UserEvent extends BaseEvent {
public function arpu_analysis_data() { public function arpu_analysis_data() {
if ($_REQUEST['time_start'] && $_REQUEST['time_end']) { if ($_REQUEST['time_start'] && $_REQUEST['time_end']) {
$request = $_REQUEST; $request = $_REQUEST;
$game_id = $request['game_id']; $game_id = $request['game_id'];

@ -1,6 +1,16 @@
<extend name="Public/promote_base"/> <extend name="Public/promote_base"/>
<block name="css"> <block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" > <link href="__CSS__/20180207/account.css" rel="stylesheet" >
<style>
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
</style>
</block> </block>
<block name="body"> <block name="body">
<div class="page-list normal_list promote-mychlid-list"> <div class="page-list normal_list promote-mychlid-list">
@ -13,19 +23,16 @@
</div> </div>
<div class="trunk-content article"> <div class="trunk-content article">
<div class="trunk-search clearfix"> <div class="trunk-search clearfix">
<form action="{:U('Promote/mychlid',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data"> <form action="{:U('Query/userRecharges',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
<div class="form-group fr"> <div class="form-group normal_space">
<input type="submit" class="submit normal_space" value="查询"> <select name="game_id" class="reselect select_gallery" style="width: 220px;" >
</div>
<div class="form-group fr normal_space">
<select name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择游戏</option> <option value="0">请选择游戏</option>
<volist name="groupPromotes" id="promote"> <volist name="games" id="game">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option> <option value="{$game.game_id}">{$game.game_name}</option>
</volist> </volist>
</select> </select>
</div> </div>
<div class="form-group fr normal_space"> <div class="form-group normal_space">
<select name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" > <select name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择区服</option> <option value="0">请选择区服</option>
<volist name="groupPromotes" id="promote"> <volist name="groupPromotes" id="promote">
@ -33,16 +40,15 @@
</volist> </volist>
</select> </select>
</div> </div>
<div class="form-group fr normal_space"> <div class="form-group normal_space">
<select name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" > <select name="sdk_version" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择设备类型</option> <option value="0">请选择设备类型</option>
<volist name="groupPromotes" id="promote"> <option value="1" <if condition="I('sdk_version') === '1'">selected</if>>Andriod</option>
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option> <option value="2" <if condition="I('sdk_version') === '2'">selected</if>>IOS</option>
</volist>
</select> </select>
</div> </div>
<if condition="$grand_id eq 0"> <if condition="$grand_id eq 0">
<div class="form-group fr normal_space"> <div class="form-group normal_space">
<select name="promote_id" class="reselect select_gallery" style="width: 220px;" > <select name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广员</option> <option value="0">请选择推广员</option>
<volist name="promotes" id="promote"> <volist name="promotes" id="promote">
@ -52,7 +58,7 @@
</div> </div>
</if> </if>
<if condition="$parent_id eq 0"> <if condition="$parent_id eq 0">
<div class="form-group fr normal_space"> <div class="form-group normal_space">
<select name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" > <select name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择组长</option> <option value="0">请选择组长</option>
<volist name="groupPromotes" id="promote"> <volist name="groupPromotes" id="promote">
@ -61,14 +67,26 @@
</select> </select>
</div> </div>
</if> </if>
<div class="form-group fr normal_space"> <div class="form-group normal_space">
<input type="text" name="real_name" class="txt normal_txt" id="uid" placeholder="请输入角色名" value="{:I('real_name')}"> <input type="text" name="role_name" class="txt normal_txt" id="uid" placeholder="请输入角色名" value="{:I('role_name')}">
</div>
<div class="form-group normal_space">
<input type="text" name="user_account" class="txt normal_txt" id="uid" placeholder="请输入玩家账号" value="{:I('user_account')}">
</div>
<!-- <div class="form-group normal_space">
<input type="text" name="device_sn" class="txt normal_txt" id="uid" placeholder="请输入设备号" value="{:I('device_sn')}">
</div> -->
<div class="form-group normal_space fr">
<label>充值总额:</label>
<input type="text" class="txt" name="cost_begin" style="width: 50px" value="{:I('cost_begin')}" >
<label> ~ </label>
<input type="text" class="txt" name="cost_end" style="width: 50px" value="{:I('cost_end')}" >
</div> </div>
<div class="form-group fr normal_space"> <div class="form-group normal_space">
<input type="text" name="mobile" class="txt normal_txt" id="uid" placeholder="请输入玩家账号" value="{:I('mobile')}"> <input type="submit" class="submit" value="查询">
</div> </div>
<div class="form-group fr normal_space"> <div class="form-group normal_space">
<input type="text" name="idcard" class="txt normal_txt" id="uid" placeholder="请输入设备号" value="{:I('idcard')}"> <label><input name="is_self" value="1" type="checkbox"> 本账号推广</label>
</div> </div>
</form> </form>
</div> </div>

@ -1,6 +1,16 @@
<extend name="Public/promote_base"/> <extend name="Public/promote_base"/>
<block name="css"> <block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" > <link href="__CSS__/20180207/account.css" rel="stylesheet" >
<style>
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
</style>
</block> </block>
<block name="body"> <block name="body">
<div class="page-list normal_list promote-mychlid-list"> <div class="page-list normal_list promote-mychlid-list">
@ -13,36 +23,72 @@
</div> </div>
<div class="trunk-content article"> <div class="trunk-content article">
<div class="trunk-search clearfix"> <div class="trunk-search clearfix">
<form action="{:U('Promote/mychlid',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data"> <form action="{:U('Query/userRoles',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
<div class="form-group fr">
<input type="submit" class="submit normal_space" value="查询"> <div class="form-group normal_space">
</div> <select name="game_id" class="reselect select_gallery" style="width: 220px;" >
<div class="form-group fr normal_space">
<select name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择游戏</option> <option value="0">请选择游戏</option>
<volist name="groupPromotes" id="promote"> <volist name="games" id="game">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option> <option value="{$game.game_id}" <if condition="I('game_id') === $game['id']">selected</if>>{$game.game_name}</option>
</volist> </volist>
</select> </select>
</div> </div>
<div class="form-group fr normal_space"> <div class="form-group normal_space">
<select name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" > <select name="server_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择区服</option> <option value="0">请选择区服</option>
<volist name="groupPromotes" id="promote"> <volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option> <option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
</volist> </volist>
</select> </select>
</div> </div>
<div class="form-group fr normal_space"> <div class="form-group normal_space">
<select name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" > <select name="sdk_version" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择设备类型</option> <option value="0">请选择设备类型</option>
<option value="1" <if condition="I('sdk_version') === '1'">selected</if>>Andriod</option>
<option value="2" <if condition="I('sdk_version') === '2'">selected</if>>IOS</option>
</select>
</div>
<div class="form-group normal_space">
<input type="text" name="role_name" class="txt normal_txt" id="uid" placeholder="请输入角色名" value="{:I('role_name')}">
</div>
<div class="form-group normal_space">
<input type="text" name="user_account" class="txt normal_txt" id="uid" placeholder="请输入玩家账号" value="{:I('user_account')}">
</div>
<if condition="$grand_id eq 0">
<div class="form-group normal_space">
<select name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广员</option>
<volist name="promotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') === $promote['id']">selected</if>>{$promote.account}</option>
</volist>
</select>
</div>
</if>
<if condition="$parent_id eq 0">
<div class="form-group normal_space">
<select name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择组长</option>
<volist name="groupPromotes" id="promote"> <volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option> <option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') === $promote['id']">selected</if>>{$promote.account}</option>
</volist> </volist>
</select> </select>
</div> </div>
<div class="form-group fr normal_space"> </if>
<input type="text" name="role_name" class="txt normal_txt" id="uid" placeholder="请输入角色名" value="{:I('role_name')}"> <div class="form-group normal_space fr">
<label>创建时间:</label>
<input type="text" class="txt range-date" name="play_time" placeholder="创建时间" value="{:I('play_time')}" >
</div>
<div class="form-group normal_space fr">
<label>玩家等级:</label>
<input type="text" class="txt" name="role_level_begin" style="width: 50px" value="{:I('role_level_begin')}" >
<label> ~ </label>
<input type="text" class="txt" name="role_level_end" style="width: 50px" value="{:I('role_level_end')}" >
</div>
<div class="form-group">
<input type="submit" class="submit normal_space" value="查询">
</div>
<div class="form-group normal_space">
<label><input name="is_self" value="1" type="checkbox"> 本账号推广</label>
</div> </div>
</form> </form>
</div> </div>
@ -95,9 +141,16 @@
</div> </div>
</block> </block>
<block name="script"> <block name="script">
<link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
<script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
<script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script> <script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function() {
$('.range-date').flatpickr({
mode: 'range',
locale: 'zh',
})
$('.select_gallery').select2(); $('.select_gallery').select2();
}) })
</script> </script>

Loading…
Cancel
Save