From 5a184bbee19279ef673791e88a6b97753a86d78a Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Fri, 4 Sep 2020 13:39:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/ApplyController.class.php | 112 ++++-------------- .../Home/Controller/BaseController.class.php | 24 ++++ .../Home/View/default/Apply/feature.html | 39 +----- 3 files changed, 55 insertions(+), 120 deletions(-) diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index 1fd33a97a..a45c9fbc6 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -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 + $map = ['_string' => '1=1']; + $map['online_status'] = 1;//开发者游戏上线状态 + $map['down_port'] = 1;//游戏端口 第三方接口不能申请 + $map['game_status'] = 1;//游戏状态 + $map['developers'] = 0; //平台游戏(官网游戏,非开发者游戏) -// $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; //平台游戏(官网游戏,非开发者游戏) - - $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']; + $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); - - //分页 - $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); + ->order('developers desc,sort desc,id desc'); - $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(); } diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php index fa876e441..fae35173b 100644 --- a/Application/Home/Controller/BaseController.class.php +++ b/Application/Home/Controller/BaseController.class.php @@ -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(); + } } diff --git a/Application/Home/View/default/Apply/feature.html b/Application/Home/View/default/Apply/feature.html index 86e5dd89c..024d4d6fb 100644 --- a/Application/Home/View/default/Apply/feature.html +++ b/Application/Home/View/default/Apply/feature.html @@ -146,9 +146,9 @@
{$vo.features}
-