优化推广员申请游戏名称及选择样式

master
chenzhi 5 years ago
parent f0a19cfc99
commit d6e44d32dc

@ -1123,15 +1123,15 @@ class PromoteController extends ThinkController
{ {
if (IS_AJAX) { if (IS_AJAX) {
//获取所有游戏 //获取所有游戏
$game_list = M('game', 'tab_')->field('id,game_name,short')->where(['game_status'=>1,'down_port'=>1])->select(); $game_list = M('game', 'tab_')->field('relation_game_id id,relation_game_name game_name,short')->where(['game_status'=>1,'down_port'=>1])->group("relation_game_id")->select();
$data['data']['game_list'] = empty($game_list) ? '' : $game_list; $data['data']['game_list'] = empty($game_list) ? '' : $game_list;
//获取推广员信息 //获取推广员信息
$promote_info = M('promote', 'tab_')->field('id,account,game_ids')->where(['id'=>I('id', 0, 'intval')])->find(); $promote_info = M('promote', 'tab_')->field('id,account,game_ids')->where(['id'=>I('id', 0, 'intval')])->find();
if (!empty($promote_info['game_ids'])) { if (!empty($promote_info['game_ids'])) {
$this->changeGameidToRelationGameid($promote_info['game_ids']);
$promote_info['game_ids'] = explode(',', $promote_info['game_ids']); $promote_info['game_ids'] = explode(',', $promote_info['game_ids']);
} }
$data['data']['promote_info'] = empty($promote_info) ? '' : $promote_info; $data['data']['promote_info'] = empty($promote_info) ? '' : $promote_info;
$data['msg'] = '请求成功'; $data['msg'] = '请求成功';
$data['code'] = 1; $data['code'] = 1;
@ -1139,6 +1139,14 @@ class PromoteController extends ThinkController
exit; exit;
} }
} }
//普通游戏id转唯一游戏id
protected function changeGameidToRelationGameid(&$ids)
{
$rid = M('game', 'tab_')->field('relation_game_id')->where(["id"=>["in",$ids]])->group("relation_game_id")->select();
if($rid){
$ids = implode(",",array_column($rid,'relation_game_id'));
}
}
//更新推广员可推广游戏 //更新推广员可推广游戏
@ -1152,6 +1160,7 @@ class PromoteController extends ThinkController
$game_ids = I('game_ids', ''); $game_ids = I('game_ids', '');
if (!empty($game_ids)) { if (!empty($game_ids)) {
$game_ids = implode(',', $game_ids); $game_ids = implode(',', $game_ids);
$this->changeRelationGameidToGameid($game_ids);
} else { } else {
$game_ids = 0; $game_ids = 0;
} }
@ -1163,6 +1172,14 @@ class PromoteController extends ThinkController
} }
} }
} }
//唯一游戏id转普通游戏id
protected function changeRelationGameidToGameid(&$ids)
{
$rid = M('game', 'tab_')->field('id')->where(["relation_game_id"=>["in",$ids]])->select();
if($rid){
$ids = implode(",",array_column($rid,'id'));
}
}
public function shortCutMenu($p = 1) public function shortCutMenu($p = 1)
{ {

@ -422,7 +422,7 @@
<i class="label_icon"></i> <i class="label_icon"></i>
<span class="label_text">全选</span></label> <span class="label_text">全选</span></label>
</div> </div>
<ul id="game_list" class="z_clearfix game_list"> <ul id="game_list" class="z_clearfix game_list" style="clear: both;">
</ul> </ul>
</div> </div>

Loading…
Cancel
Save