tablePrefix ='tab_'; /* 执行构造方法 */ parent::__construct($name, $tablePrefix, $connection); } /** * 获取开服表 * @param $game_id * @return mixed * author: xmy 280564871@qq.com */ public function getOpenServer($game_id){ $map['game_id'] = $game_id; $map['show_status'] = 1; $data = $this->field('*')->order("start_time desc")->where($map)->select(); return $data; } /** * 获取区服表 * @param $map * @param int $p * @return mixed * author: xmy 280564871@qq.com */ public function getServerLists($map,$p=1){ $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 $row = 10; $map['show_status'] = 1; $data = $this->table("tab_server as ser") ->field('server_name,start_time,ser.game_name,sor.pack_name,ser.game_id') ->join("left join tab_game_source as sor on sor.game_id = ser.game_id") ->where($map) ->order("start_time") ->page($page,$row) ->select(); foreach ($data as $key => $val){ $data[$key]['down_url'] = GameModel::generateDownUrl($val['game_id']); } return $data; } /** * 获取区服列表通过游戏 * @param integer $game_id 游戏编号 * @author 鹿文学 */ public function get_server_list_by_game($game_id=0) { if(is_numeric($game_id) && $game_id > 0) { $lists = $this->field('id as server_id,server_name')->where(['game_id'=>$game_id,'show_status'=>1])->select(); return $lists; } else { return ''; } } }