Merge branch 'feature/promote' of 47.111.118.107:/srv/git/platform into feature/promote

master
ELF 5 years ago
commit 6d68ddfe07

@ -841,21 +841,12 @@ function getAllPromoteListByType($promoteType = 1, $retOne = false, $promoteId =
break;
case 2:
case 3:
$promoteData = D('Promote')->where(array('id' => $promoteId))->find();
if ($promoteData['grand_id'] > 0) {
return [];
} elseif ($promoteData['parent_id'] > 0) {
$promoteType--;
}
$childPromoteIds = getAllPromoteIdsByType((string)$promoteId, $promoteType);
case 4:
$map['chain'] = ['like', '%/' . $promoteId . '/%'];
$map['level'] = $promoteType;
break;
}
if (!empty($childPromoteIds)) {
$map['id'] = ['in', $childPromoteIds];
}
if (!empty($map)) {
if ($retOne) {
$childPromoteData = D('Promote')->where($map)->getField('id', true);
@ -968,9 +959,27 @@ function getParentPromoteId($promoteId)
//获会长渠道ID
function getGrandPromoteId($promoteId)
{
$model = D('Promote');
$map['id'] = $promoteId;
return D('Promote')->where($map)->getField('grand_id');
$data = $model->field('parent_id,chain,level')->where($map)->find();
if (empty($data)) {
return 0;
}
switch ($data['level']) {
case 1:
return $promoteId;
break;
case 2:
return $data['parent_id'];
break;
case 3:
case 4:
$ids = explode('/', $data['chain']);
return (isset($ids[1]) ? $ids[1] : 0);
break;
}
}
function getGamePermission($gameId)

@ -62,13 +62,13 @@ class ApplyController extends BaseController
//首页 $type-查询的游戏平台类型 0-全部 10-安卓+ios 2-ios 1-安卓
public function index($serverType = 1)
{
$promoteId = empty(I('promote_id')) ? PID : I('promote_id');//搜索的渠道ID
$loginPromote = $this->getLoginPromote();
$promoteId = empty(I('promote_id')) ? $loginPromote['id'] : I('promote_id');//搜索的渠道ID
$promoteRole = empty(I('promote_role')) ? 1 : I('promote_role');//渠道角色
$parentPromoteId = getParentPromoteId($promoteId);//上级渠道ID
$grandPromoteId = getGrandPromoteId($promoteId);
$grandPromoteId = empty($grandPromoteId) ? $parentPromoteId : $grandPromoteId;//本账号会长渠道ID
$grandPromoteId = getGrandPromoteId($promoteId);//本账号会长渠道ID
$childGameAddPermission = getChildGameAddPermission($grandPromoteId);//游戏添加权限
$thisParentPromoteId = getParentPromoteId(PID);//本账号上级渠道ID
$map['tab_game.online_status'] = 1;//开发者游戏上线状态
$map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请
@ -183,11 +183,9 @@ class ApplyController extends BaseController
$this->assign('list_data', $data);
$this->assign("count", $count);
$this->assign('loginPromote', $loginPromote);
$this->assign("promoteId", $promoteId);
$this->assign('parentPromoteId', $parentPromoteId);
$this->assign('thisParentPromoteId', $thisParentPromoteId);
$this->assign('promoteRole', $promoteRole);
$this->assign('pID', PID);
$this->assign('promoteData', getAllPromoteListByType($promoteRole));
$this->assign('type', $type);
$this->assign('myGame', ($serverType == 1) ? 'specialMyGameList' : 'myGameList');
@ -248,13 +246,13 @@ class ApplyController extends BaseController
// $where['_logic']='or';
} else {
$where['_complex'] = $map;
if(empty($noDeveloperGameArr)) {
$where['tab_game.id'] = ['in','-100'];
}else {
$where['tab_game.id'] = ['in',$noDeveloperGameArr];
if (empty($noDeveloperGameArr)) {
$where['tab_game.id'] = ['in', '-100'];
} else {
$where['tab_game.id'] = ['in', $noDeveloperGameArr];
}
$where['_logic']='or';
$where['_logic'] = 'or';
}
$data = M('Game', 'tab_')
@ -598,9 +596,11 @@ class ApplyController extends BaseController
public function my_game($serverType = 1)
{
$loginPromote = $this->getLoginPromote();
//渠道可申请游戏
if (empty($_REQUEST['promote_id'])) {
$promoteId = get_pid();
$promoteId = $loginPromote['id'];
} else {
$promoteId = $_REQUEST['promote_id'];
}
@ -689,10 +689,8 @@ class ApplyController extends BaseController
$this->assign("url", $url);
$this->assign("count", $count);
$this->assign("row", $row);
$this->assign('loginPromote', $loginPromote);
$this->assign('promoteId', $promoteId);
$this->assign('thisParentPromoteId', getParentPromoteId(PID));
$this->assign('parentPromoteId', getParentPromoteId($promoteId));
$this->assign('pID', PID);
$this->assign('promoteRole', $promoteRole);
$this->assign('promoteData', getAllPromoteListByType($promoteRole));
$this->assign('list_data', $data);
@ -1006,14 +1004,20 @@ class ApplyController extends BaseController
public function apply()
{
if ($_POST['game_id']) {
$loginPromote = $this->getLoginPromote();
$gameMap['tab_game.id'] = $_POST['game_id'];
$promoteId = I('promote_id');
if (empty($promoteId)) {
$promoteId = PID;
$promoteId = $loginPromote['id'];
}
if ($promoteId == $loginPromote['id']) {
$promoteData = $loginPromote;
} else {
$promoteData = D('Promote')->where(array('id' => $promoteId))->find();
}
$promoteData = D('Promote')->where(array('id' => $promoteId))->find();
$grandPromoteId = getGrandPromoteId($promoteId);
$grandPromoteId = empty($grandPromoteId) ? $promoteData['parent_id'] : $grandPromoteId;//本账号会长渠道ID
$childGameAddPermission = getChildGameAddPermission($grandPromoteId);//游戏添加权限
@ -1594,6 +1598,7 @@ class ApplyController extends BaseController
switch ($promoteRole) {
case 2:
case 3:
case 4:
$data = getAllPromoteListByType($promoteRole);
break;
}
@ -1617,11 +1622,6 @@ class ApplyController extends BaseController
$gameData['sdk_name'] = getSDKTypeName($gameData['sdk_version']);
$promoteData = D('Promote')->where(array('id' => PID))->find();
if ($promoteData['parent_id'] > 0 && $promoteData['grand_id'] == 0) {
$promoteType = 3;
}
$promoteIds = getAllPromoteListByType($promoteType);
$newPromoteData = [];
@ -1643,6 +1643,7 @@ class ApplyController extends BaseController
function addGameToPromote()
{
$loginPromote = $this->getLoginPromote();
$gameId = I('game_id');
$promoteIds = I('promote_ids');
@ -1665,7 +1666,7 @@ class ApplyController extends BaseController
foreach ($promoteIds as $value) {
$thisPromoteData = D('Promote')->where(array('id' => $value))->find();
if (empty($thisPromoteData) || !hasPromotePermission(PID, $value)) {
if (empty($thisPromoteData) || !hasPromotePermission($loginPromote['id'], $value)) {
$data['status'] = -1;
$data['msg'] = '渠道权限异常';

@ -100,7 +100,9 @@
color: #999;
}
.btn-role-border {
border-left: 0;
}
</style>
</block>
@ -154,29 +156,41 @@
</div>
</if>
<if condition="$thisParentPromoteId eq 0">
<if condition="$loginPromote['level'] eq 1">
<if condition="$promoteRole eq 2">
<div class="btn btn-role highlight" style="border-left: 0;<?=(isMinPromote($pID)==0)?'border-right: 0;':''?>" promote-role="2">
<div class="btn btn-role highlight btn-role-border" promote-role="2">
<p>部长</p>
</div>
<else/>
<div class="btn btn-role btn-role-border" promote-role="2">
<p>部长</p>
</div>
</if>
</if>
<if condition="$loginPromote['level'] elt 2">
<if condition="$promoteRole eq 3">
<div class="btn btn-role highlight btn-role-border" promote-role="3">
<p>组长</p>
</div>
<else/>
<div class="btn btn-role" style="border-left: 0;<?=(isMinPromote($pID)==0)?'border-right: 0;':''?>" promote-role="2">
<div class="btn btn-role btn-role-border" promote-role="3">
<p>组长</p>
</div>
</if>
</if>
<eq name="pID|isMinPromote" value="0">
<if condition="$promoteRole eq 3">
<div class="btn btn-role highlight" promote-role="3">
<if condition="$loginPromote['level'] elt 3">
<if condition="$promoteRole eq 4">
<div class="btn btn-role highlight btn-role-border" promote-role="4">
<p>推广员</p>
</div>
<else/>
<div class="btn btn-role" promote-role="3">
<div class="btn btn-role btn-role-border" promote-role="4">
<p>推广员</p>
</div>
</if>
</eq>
</if>
</div>
</div>
@ -202,12 +216,12 @@
<option value="">请选择渠道</option>
<volist name="promoteData" id="vo">
<if condition="$vo.id eq $promoteId">
<option value="{$vo.id}" title="{$vo.account}({$vo.nickname})" selected="selected">
{$vo.account}({$vo.nickname})
<option value="{$vo.id}" title="{$vo.account}({$vo.real_name})" selected="selected">
{$vo.account}({$vo.real_name})
</option>
<else/>
<option value="{$vo.id}" title="{$vo.account}({$vo.nickname})">
{$vo.account}({$vo.nickname})
<option value="{$vo.id}" title="{$vo.account}({$vo.real_name})">
{$vo.account}({$vo.real_name})
</option>
</if>
</volist>
@ -448,7 +462,7 @@
if (data.length > 0) {
$.each(data, function (index, item) {
var promoteTitle = item['account'] + '(' + item['nickname'] + ')';
var promoteTitle = item['account'] + '(' + item['real_name'] + ')';
html += '<option value="' + item['id'] + '" title="' + promoteTitle + '">';
html += promoteTitle;

@ -84,6 +84,10 @@
margin-bottom: 2px;
overflow:scroll;
}
.btn-role-border {
border-left: 0;
}
</style>
</block>
@ -126,29 +130,41 @@
</div>
</if>
<if condition="$thisParentPromoteId eq 0">
<if condition="$loginPromote['level'] eq 1">
<if condition="$promoteRole eq 2">
<div class="btn btn-role highlight" style="border-left: 0;<?=(isMinPromote($pID)==0)?'border-right: 0;':''?>" promote-role="2">
<div class="btn btn-role highlight btn-role-border" promote-role="2">
<p>部长</p>
</div>
<else/>
<div class="btn btn-role btn-role-border" promote-role="2">
<p>部长</p>
</div>
</if>
</if>
<if condition="$loginPromote['level'] elt 2">
<if condition="$promoteRole eq 3">
<div class="btn btn-role highlight btn-role-border" promote-role="3">
<p>组长</p>
</div>
<else/>
<div class="btn btn-role" style="border-left: 0;<?=(isMinPromote($pID)==0)?'border-right: 0;':''?>" promote-role="2">
<div class="btn btn-role btn-role-border" promote-role="3">
<p>组长</p>
</div>
</if>
</if>
<eq name="pID|isMinPromote" value="0">
<if condition="$promoteRole eq 3">
<div class="btn btn-role highlight" promote-role="3">
<if condition="$loginPromote['level'] elt 3">
<if condition="$promoteRole eq 4">
<div class="btn btn-role highlight btn-role-border" promote-role="4">
<p>推广员</p>
</div>
<else/>
<div class="btn btn-role" promote-role="3">
<div class="btn btn-role btn-role-border" promote-role="4">
<p>推广员</p>
</div>
</if>
</eq>
</if>
</div>
</div>
@ -181,12 +197,12 @@
<option value="">请选择渠道</option>
<volist name="promoteData" id="vo">
<if condition="$vo.id eq $promoteId">
<option value="{$vo.id}" title="{$vo.account}({$vo.nickname})" selected="selected">
{$vo.account}({$vo.nickname})
<option value="{$vo.id}" title="{$vo.account}({$vo.real_name})" selected="selected">
{$vo.account}({$vo.real_name})
</option>
<else/>
<option value="{$vo.id}" title="{$vo.account}({$vo.nickname})">
{$vo.account}({$vo.nickname})
<option value="{$vo.id}" title="{$vo.account}({$vo.real_name})">
{$vo.account}({$vo.real_name})
</option>
</if>
</volist>
@ -252,10 +268,15 @@
?>
<div class="game-operating" data-url="{$qrcodes}" style="width: 35%;">
<if condition="$promoteRole == 1">
<if condition="$parentPromoteId == 0">
<span class="add-game" game-id="{$vo.id}" promote-type="2" style="cursor: pointer;margin-right: 10px;"><u>添加组长游戏</u></span>
<if condition="$loginPromote['level'] eq 1">
<span class="add-game" game-id="{$vo.id}" promote-type="2" style="cursor: pointer;margin-right: 10px;"><u>添加部长游戏</u></span>
</if>
<if condition="$loginPromote['level'] elt 2">
<span class="add-game" game-id="{$vo.id}" promote-type="3" style="cursor: pointer;margin-right: 10px;"><u>添加组长游戏</u></span>
</if>
<if condition="$loginPromote['level'] elt 3">
<span class="add-game" game-id="{$vo.id}" promote-type="4" style="cursor: pointer;margin-right: 10px;"><u>添加推广员游戏</u></span>
</if>
<span class="add-game" game-id="{$vo.id}" promote-type="3" style="cursor: pointer;margin-right: 10px;"><u>添加推广员游戏</u></span>
</if>
<?php $downloadUrl = get_apply_dow_url($vo['id'],$vo['promote_id']);?>
<span class="game-link" data-qrcode="{:U('Apply/qrcode',['url'=>base64_encode(base64_encode($downloadUrl)),'logo'=>$qrcode])}" data-url="{$downloadUrl}" data-clipboard-text="{$downloadUrl}" data-apply-id="{$vo.applyid}" style="cursor: pointer;margin-right: 10px;"><u>复制下载链接</u></span>
@ -542,7 +563,7 @@
if (data.length > 0) {
$.each(data, function (index, item) {
var promoteTitle = item['account'] + '(' + item['nickname'] + ')';
var promoteTitle = item['account'] + '(' + item['real_name'] + ')';
html += '<option value="' + item['id'] + '" title="' + promoteTitle + '">';
html += promoteTitle;

Loading…
Cancel
Save