3级变4级修改

master
ELF 5 years ago
parent ae44fc79bd
commit fc89281a48

@ -762,7 +762,7 @@ class PromoteService {
public function getLevelName($level)
{
return self::levels[$level] ?? '未知';
return self::$levels[$level] ?? '未知';
}
public function addPromote($params, $parent = null)

@ -7,6 +7,7 @@ use User\Api\PromoteApi;
use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository;
use Base\Repository\UserRepository;
use Base\Service\PromoteService;
/**
* 前台首页控制器
@ -705,21 +706,13 @@ class QueryController extends BaseController
$sdkVersion = I('sdk_version', 0);
$gameId = I('game_id', 0);
$serverId = I('server_id', 0);
$promoteId = I('promote_id', 0);
$subPromoteId = I('sub_promote_id', 0);
$promote = $this->getLoginPromote();
$searchPromote = $promote;
if ($promoteId > 0) {
$searchPromote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
}
if ($subPromoteId > 0) {
$searchPromote = M('promote', 'tab_')->where(['id' => $subPromoteId])->find();
}
$map = [
$levelPromote = $this->getLevelPromote();
$searchPromote = $this->getQueryPromote($levelPromote);
$map[] = [
'_logic' => 'or',
'id' => $searchPromote['id'],
'parent_id' => $searchPromote['id'],
'grand_id' => $searchPromote['id'],
'chain' => ['like', $searchPromote['chain'] . $searchPromote['id'] . '/%']
];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
@ -795,11 +788,10 @@ class QueryController extends BaseController
public function gameArpu()
{
$promote = $this->getLoginPromote();
$map = [
$map[] = [
'_logic' => 'or',
'id' => $promote['id'],
'parent_id' => $promote['id'],
'grand_id' => $promote['id'],
'chain' => ['like', $promote['chain'] . $promote['id'] . '/%']
];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
@ -1649,42 +1641,6 @@ class QueryController extends BaseController
$this->display('view_role');
}
public function users()
{
$promote = $this->getLoginPromote();
$promoteId = $promote['id'];
$map = [
'_logic' => 'or',
'id' => $promoteId,
'parent_id' => $promoteId,
'grand_id' => $promoteId,
];
$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();
}
$fields = [
'id', 'account', 'promote_account', 'promote_id', 'device_number', 'register_time', 'register_ip', 'login_time', 'login_ip', 'device_type'
];
$query = M('user', 'tab_')->field($fields)->where(['promote_id' => ['in', $ids]]);
list($records, $pagination, $count) = $this->paginate($query);
$this->assign('promotes', $promotes);
$this->assign('groupPromotes', $groupPromotes);
$this->assign('records', $records);
$this->assign('pagination', $pagination);
$this->assign('count', $count);
$this->display();
}
private function getLevelPromote()
{
$levelPromote = [];
@ -1933,17 +1889,6 @@ class QueryController extends BaseController
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);
@ -2018,29 +1963,36 @@ class QueryController extends BaseController
$parentId = I('parent_id', 0);
$promoteId = I('promote_id', 0);
$status = I('status', 0);
$searchLevel = 0;
$searchLevelName = '';
$currentDisplay = '';
$prevParentId = 0;
$promoteService = new PromoteService();
$loginPromote = $this->getLoginPromote();
$promote = null;
$searchPromoteType = 0;
$parent = null;
if ($parentId > 0) {
$promote = M('promote', 'tab_')->where(['id' => $parentId])->find();
$searchPromoteType = 2;
$parent = M('promote', 'tab_')->where(['id' => $parentId])->find();
$currentDisplay = $promoteService->getLevelName($promote['level']) . '推广';
$prevParentId = $parent['parent_id'] == $loginPromote['parent_id'] ? 0 : $parent['parent_id'];
} else {
$promote = $loginPromote;
$searchPromoteType = 1;
$parent = $loginPromote;
$currentDisplay = '自己';
}
$searchLevel = $parent['level'] + 1;
$searchLevelName = $promoteService->getLevelName($searchLevel);
$games = $this->getGamesByPromote($promote);
$games = $this->getGamesByPromote($parent);
$subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promote['id']])->select();
$subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $parent['id']])->select();
$map = ['parent_id' => $promote['id']];
$map = ['parent_id' => $parent['id']];
if ($promoteId > 0) {
$map['id'] = $promoteId;
}
$query = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where($map);
$query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level'])->where($map);
list($promotes, $pagination, $count) = $this->paginate($query);
$ids = array_column($promotes, 'id');
@ -2099,9 +2051,10 @@ class QueryController extends BaseController
$selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$promote['id']], $selfParams);
$records[] = [
'id' => $promote['id'],
'account' => $promote['account'],
'real_name' => $promote['real_name'],
'id' => $parent['id'],
'account' => $parent['account'],
'real_name' => $parent['real_name'],
'level' => $parent['level'],
'create_role_count' => $selfCreateRoleCountList[$promote['id']],
'create_role_user_count' => $selfCreateRoleUserCountList[$promote['id']],
'new_create_role_user_count' => $selfNewCreateRoleUserCountList[$promote['id']],
@ -2114,16 +2067,16 @@ class QueryController extends BaseController
'recharge_by_ban_coin' => $selfRechargeAmountList[$promote['id']]['ban_coin'],
'recharge_by_coin' => $selfRechargeAmountList[$promote['id']]['coin'],
'recharge_by_cash' => $selfRechargeAmountList[$promote['id']]['cash'],
'search_promote_type' => $searchPromoteType,
'current_display' => $currentDisplay,
];
}
foreach ($promotes as $promote) {
$id = $promote['id'];
$records[] = [
'id' => $id,
'account' => $promote['account'],
'real_name' => $promote['real_name'],
'level' => $promote['level'],
'create_role_count' => $createRoleCountList[$id],
'create_role_user_count' => $createRoleUserCountList[$id],
'new_create_role_user_count' => $newCreateRoleUserCountList[$id],
@ -2136,23 +2089,14 @@ class QueryController extends BaseController
'recharge_by_ban_coin' => $rechargeAmountList[$id]['ban_coin'],
'recharge_by_coin' => $rechargeAmountList[$id]['coin'],
'recharge_by_cash' => $rechargeAmountList[$id]['cash'],
'search_promote_type' => 0,
'current_display' => '',
];
}
$level = 0;
if ($parentId > 0) {
$level = 2;
} elseif ($loginPromote['parent_id'] == 0) {
$level = 1;
} elseif ($loginPromote['parent_id'] > 0 && $loginPromote['grand_id'] == 0) {
$level = 2;
} elseif ($loginPromote['parent_id'] > 0 && $loginPromote['grand_id'] > 0) {
$level = 3;
}
$this->assign('prevParentId', $prevParentId);
$this->assign('searchLevelName', $searchLevelName);
$this->assign('games', $games);
$this->assign('level', $level);
$this->assign('parent', $parent);
$this->assign('subPromotes', $subPromotes);
$this->assign('records', $records);
$this->assign('pagination', $pagination);

@ -46,42 +46,29 @@
</select>
</div>
<div class="form-group normal_space">
<select name="status" class="reselect select_gallery" style="width: 220px;" >
<option value="0">帐号状态</option>
<option value="1" <if condition="I('status') === '1'">selected</if>>正常</option>
<option value="2" <if condition="I('status') === '2'">selected</if>>冻结</option>
</select>
</div>
<if condition="I('parent_id', 0) eq 0 and $parent_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="subPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') == $promote['id']">selected</if>>{$promote.account}({$promote.real_name})</option>
</volist>
<select name="status" class="reselect select_gallery" style="width: 220px;" >
<option value="0">帐号状态</option>
<option value="1" <if condition="I('status') === '1'">selected</if>>正常</option>
<option value="2" <if condition="I('status') === '2'">selected</if>>冻结</option>
</select>
</div>
</if>
<if condition="I('parent_id', 0) neq 0 or ($parent_id gt 0 and $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>
<option value="0">请选择{$searchLevelName}</option>
<volist name="subPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') == $promote['id']">selected</if>>{$promote.account}</option>
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') == $promote['id']">selected</if>>{$promote.account}({$promote.real_name})</option>
</volist>
</select>
</div>
</if>
<div class="form-group normal_space fr">
<!-- <label>起止时间:</label> -->
<input type="text" class="txt range-date" name="time" placeholder="起止时间" value="{:I('time', date('Y-m-d'))}" >
</div>
<div class="form-group">
<input type="submit" class="submit normal_space" value="查询">
</div>
<?php if (I('parent_id', 0) > 0):?>
<?php if ($prevParentId > 0):?>
<div class="form-group">
<a class="submit normal_space" href="{:U('Query/achievement', ['row'=>I('get.row')])}" style="line-height: 36px; display: inline-block; text-align: center; background: #E5E5E5; color: #2bd8ed; cursor: pointer;">返回上级</a>
<a class="submit normal_space" href="{:U('Query/achievement', ['row'=>I('get.row'), 'parent_id' => $prevParentId])}" style="line-height: 36px; display: inline-block; text-align: center; background: #E5E5E5; color: #2bd8ed; cursor: pointer;">返回上级</a>
</div>
<?php endif;?>
</form>
@ -102,7 +89,7 @@
<th>现金充值</th>
<th>通用币充值</th>
<th>绑定币充值</th>
<?php if($level == 1):?>
<?php if($parent['level'] < 4):?>
<th>操作</th>
<?php endif;?>
</tr>
@ -112,8 +99,9 @@
<volist name="records" id="record" mod="2">
<tr data-id="{$vo.id}" class="<eq name='mod' value='1'>odd</eq>">
<td>{$record.account}({$record.real_name})
<?php if($record['search_promote_type'] == 1):?><span style="color: #06C;">[自己]</span><?php endif;?>
<?php if($record['search_promote_type'] == 2):?><span style="color: #06C;">[组长推广]</span><?php endif;?>
<?php if($record['current_display'] != ''):?>
<span style="color: #06C;">[{$record['current_display']}]</span>
<?php endif;?>
</td>
<td>{$record.create_role_count}</td>
<td>{$record.create_role_user_count}</td>
@ -127,8 +115,12 @@
<td>{$record.recharge_by_cash}</td>
<td>{$record.recharge_by_coin}</td>
<td>{$record.recharge_by_ban_coin}</td>
<?php if($record['search_promote_type'] == 0 && $level == 1):?>
<td><a href="{:U('Query/achievement', ['parent_id' => $record['id']])}">查看下级</a></td>
<?php if($parent['level'] < 4):?>
<td>
<?php if($record['current_display'] == '' && $record['level'] < 4):?>
<a href="{:U('Query/achievement', ['parent_id' => $record['id']])}">查看下级</a>
<?php endif;?>
</td>
<?php endif;?>
</tr>
</volist>

@ -217,6 +217,7 @@
<script type="text/javascript" src="__JS__/20170831/pagination.js"></script>
<script type="text/javascript" src="__JS__/20170831/string.js"></script>
<script type="text/javascript" src="__JS__/20170831/tabpage.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<eq name='timeout' value='1'>
<script>
layer.msg('时间间隔不能超过30天');

Loading…
Cancel
Save