You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.4 KiB
PHTML

5 years ago
<?php
/**
* Created by PhpStorm.
* User: xmy 280564871@qq.com
* Date: 2017/3/28
* Time: 16:41
*/
namespace App\Model;
class ServerModel extends BaseModel {
/**
* 获取开服表
* @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('server_name,start_time')->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,$order="start_time"){
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row = 10;
$map['show_status'] = 1;
$map['g.display_site'] = ['like','%'.DISPLAY_SITE.'%'];
$data = $this->table("tab_server as ser")
->field('server_name,start_time,ser.game_name,sor.pack_name,ser.game_id,g.ratio,g.icon,g.marking,g.features,g.dow_num,game_score')
->join("left join tab_game_source as sor on sor.game_id = ser.game_id")
->join("left join tab_game as g on g.id = ser.game_id")
->where($map)
->order($order)
->page($page,$row)
->select();
foreach ($data as $key => $val){
$data[$key]['down_url'] = GameModel::generateDownUrl($val['game_id']);
$data[$key]['xia_status']=check_game_sorue($val['game_id']);
$data[$key]['icon'] = get_img_url($val['icon']);
}
return $data;
}
}