功能优化

master
ELF 4 years ago
parent 9f0c56d753
commit 5a184bbee1

@ -217,104 +217,42 @@ class ApplyController extends BaseController
//查看游戏资料专区
public function feature($p = 0, $type = 0)
{
$promoteId = empty(I('promote_id')) ? PID : I('promote_id');//搜索的渠道ID
$promoteRole = empty(I('promote_role')) ? 1 : I('promote_role');//渠道角色
//$parentPromoteId = getParentPromoteId($promoteId);//上级渠道ID
$thisParentPromoteId = getParentPromoteId(PID);//本账号上级渠道ID
// $addPermission = 1;//是否有添加游戏权限
// if ($thisParentPromoteId == 0 && $promoteRole == 3) {
// $addPermission = 0;
// }
$map['tab_game.online_status'] = 1;//开发者游戏上线状态
$map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请
$map['tab_game.game_status'] = 1;//游戏状态
$map['tab_game.developers'] = 0; //平台游戏(官网游戏,非开发者游戏)
$map = ['_string' => '1=1'];
$map['online_status'] = 1;//开发者游戏上线状态
$map['down_port'] = 1;//游戏端口 第三方接口不能申请
$map['game_status'] = 1;//游戏状态
$map['developers'] = 0; //平台游戏(官网游戏,非开发者游戏)
$applyPromote = M('apply', 'tab_')->field('game_id')->where(['promote_id' => $promoteId])->select();
$noDeveloperGameArr = array();
foreach ($applyPromote as $key => $value) {
$applyPromoteGameId = $value['game_id'];
$gameInfo = M('Game', 'tab_')
->field('id,icon,game_name,features,sdk_version,game_size,game_type_name,relation_game_name,developers')
->where(['id' => $applyPromoteGameId])->select();
if ($gameInfo[0]['developers'] > 0) {
unset($gameInfo[0]['developers']);
$noDeveloperGameArr[] = $gameInfo[0]['id']; //非开发者游戏
}
}
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
$promote = $this->getLoginPromote();
$promoteService = new PromoteService();
$gameIds = $promoteService->getVisibleGameIds($promote);
if (count($gameIds) > 0) {
$map['id'] = ['in', $gameIds];
} else {
$row = 10;
$map['_string'] .= ' and 1<>1';
}
$map['_logic'] = 'and';
if (!empty(I('game_id'))) {
$thisRelationGameName = M('Game', 'tab_')->where(array('id' => I('game_id')))->getField('relation_game_name');
$map['tab_game.relation_game_name'] = ['like', $thisRelationGameName];
$where['_complex'] = $map;
// $where['tab_game.id'] = ['in',$noDeveloperGameArr];
// $where['_logic']='or';
} else {
$where['_complex'] = $map;
if (empty($noDeveloperGameArr)) {
$where['tab_game.id'] = ['in', '-100'];
if (!empty(I('game_id'))) {
$relationGameId = M('game', 'tab_')->where(array('id' => I('game_id')))->getField('relation_game_id');
if ($relationGameId) {
$map['_string'] .= ' and relation_game_id=' . $relationGameId;
} else {
$where['tab_game.id'] = ['in', $noDeveloperGameArr];
$map['_string'] .= ' and 1<>1';
}
$where['_logic'] = 'or';
}
$data = M('Game', 'tab_')
->field('tab_game.id,tab_game.icon,tab_game.game_name,tab_game.features,tab_game.sdk_version,tab_game.game_size,tab_game.game_type_name,tab_game.relation_game_name,ta_1.id as apply_id_1')
->join('left join tab_apply as ta_1 on tab_game.id = ta_1.game_id and ta_1.offline_status = 0 and ta_1.promote_id = ' . $promoteId)//查询是否拥有该游戏
->where($where)
->order('tab_game.developers desc,tab_game.sort desc,tab_game.id desc')
->page($page, $row)
->select();
//$AllData = array_merge($noDeveloperGameArr,$data);
/* 查询记录总数 */
$count = M("Game", "tab_")
->field('tab_game.id')
$query = M('game', 'tab_')
->field('id,icon,game_name,features,sdk_version,game_size,game_type_name,relation_game_name')
->where($map)
->select();
$count = count($count);
->order('developers desc,sort desc,id desc');
//分页
$parameter['p'] = I('get.p', 1);
$parameter['row'] = I('get.row');
$parameter['type'] = $type;
$parameter['promote_role'] = $promoteRole;
empty(I('promote_id')) || $parameter['promote_id'] = I('promote_id');
$page = set_pagination($count, $row, $parameter);
if ($page) {
$this->assign('_page', $page);
}
$this->assign('list_data', $data);
$this->assign("count", $count);
$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('addPermission', $addPermission);
// $this->assign('type', $type);
$this->meta_title = "申请游戏";
list($records, $pagination, $count) = $this->paginate($query);
$this->assign('pagination', $pagination);
$this->assign('records', $records);
$this->assign('count', $count);
$this->assign('games', $this->getSelectGames());
$this->meta_title = "资料专区";
$this->display();
}

@ -410,4 +410,28 @@ class BaseController extends HomeController
}
return false;
}
public function getSelectGames()
{
$query = M('game', 'tab_');
$map = [];
$map['apply_status'] = 1;
$map['online_status'] = 1;
$map['down_port'] = 1;
$promote = $this->getLoginPromote();
$promoteService = new PromoteService();
$gameIds = $promoteService->getVisibleGameIds($promote);
if (count($gameIds) > 0) {
$map['id'] = ['in', $gameIds];
} else {
$map['_string'] = '1<>1';
}
return M('game', 'tab_')
->field('id,game_name,sdk_version,relation_game_name,icon,relation_game_id')
->where($map)
->group('relation_game_id')
->select();
}
}

@ -146,9 +146,9 @@
<div class="form-group normal_space fr">
<select id="game_id" name="game_id" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="">请选择游戏名称</option>
<volist name=":get_promote_serach_game()" id="vo">
<option value="{$vo.id}" title="{$vo.relation_game_name}">{$vo.relation_game_name}</option>
</volist>
<?php foreach($games as $game):?>
<option value="<?=$game['id']?>" title="<?=$game['relation_game_name']?>"><?=$game['relation_game_name']?></option>
<?php endforeach;?>
</select>
</div>
@ -163,7 +163,7 @@
<div class="trunk-list">
<div class="div_bgtab">
<ul class="game-ul">
<empty name="list_data">
<empty name="records">
<ul class="game-ul">
<li class="game-li" style="text-align: center;">
<img src="__IMG__/20180207/icon_wushujv2.png"/>
@ -171,7 +171,7 @@
</li>
</ul>
<else/>
<volist name="list_data" id="vo">
<volist name="records" id="vo">
<li class="game-li">
<div class="media">
<div class="img-box" onclick="viewGameDetailed({$vo.id})">
@ -186,37 +186,10 @@
</if>
</h5>
<p><span style="color:#76838F">{$vo.features}</span></p>
<!-- <p>
<if condition="$type eq 10">
<span>平台:<span>Android+ios</span>&nbsp;&nbsp;</span>
<else/>
<span>平台:<span>{:getSDKTypeName($vo['sdk_version'])}</span>&nbsp;&nbsp;</span>
</if>
<span>版本:<span>{$vo.version}</span>&nbsp;&nbsp;</span>
<span>大小:<span>{$vo.game_size}</span>&nbsp;&nbsp;</span>
<span>游戏类型:<span>{$vo.game_type_name}</span>&nbsp;&nbsp;</span>
</p>-->
</div>
<div class="game-operating" style="width: 8%;">
<!--<if condition="$type eq 10">
<if condition="addedAboutDoubleSdk($promoteId,$vo['id']) eq 1">
<span class="add-disable" style="cursor: pointer;">已添加</span>
<else/>
<span onclick="commonApply({$vo.id},this,0,10)" style="cursor: pointer;"><u>添加</u></span>
</if>
<else/>
<if condition="$vo.apply_id_1 gt 0">
<span class="add-disable" style="cursor: pointer;">已添加</span>
<else/>
<span onclick="commonApply({$vo.id},this,0,0)" style="cursor: pointer;"><u>添加</u></span>
</if>
</if>-->
<!--<span onclick="commonApply({$vo.id},this,0,0)" style="cursor: pointer;"><u>查看详情</u></span>-->
<!-- <span onclick="lookdetail({$vo.id})" style="cursor: pointer;"><u class="lookdetail">查看详情</u></span>-->
<div class="site-demo-button" id="layerDemo" style="margin-bottom: 0;">
<!-- <button data-method="notice" class="layui-btn">示范一个公告层</button>-->
<span id="detailArr" onclick="lookdetail({$vo.id})" class="layui-btn" style="cursor: pointer;background:#62A8EA"><u>查看详情</u></span>
</div>
</div>
</div>
@ -226,7 +199,7 @@
</ul>
</div>
<div class="pagenation clearfix">
{$_page}
{$pagination}
</div>
</div>
</div>

Loading…
Cancel
Save