diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index ef77192dc..50bcb86e1 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -1123,15 +1123,15 @@ class PromoteController extends ThinkController { 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; //获取推广员信息 $promote_info = M('promote', 'tab_')->field('id,account,game_ids')->where(['id'=>I('id', 0, 'intval')])->find(); if (!empty($promote_info['game_ids'])) { + $this->changeGameidToRelationGameid($promote_info['game_ids']); $promote_info['game_ids'] = explode(',', $promote_info['game_ids']); } $data['data']['promote_info'] = empty($promote_info) ? '' : $promote_info; - $data['msg'] = '请求成功'; $data['code'] = 1; @@ -1139,6 +1139,14 @@ class PromoteController extends ThinkController 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', ''); if (!empty($game_ids)) { $game_ids = implode(',', $game_ids); + $this->changeRelationGameidToGameid($game_ids); } else { $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) { diff --git a/Application/Admin/View/Promote/lists.html b/Application/Admin/View/Promote/lists.html index 014df7416..9f973fa42 100644 --- a/Application/Admin/View/Promote/lists.html +++ b/Application/Admin/View/Promote/lists.html @@ -422,7 +422,7 @@ 全选 -