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.

78 lines
1.8 KiB
PHTML

5 years ago
<?php
/**
* Created by PhpStorm.
* User: cy 707670631@qq.com
* Date: 2017/4/27
* Time: 8:21
*/
namespace Open\Controller;
use Open\Model\ServerModel;
class ServerController extends CenterController {
public function _initialize()
{
$this->title = "开服管理";
$this->p_title = "管理中心";
$this->p_url = U('Stats/overview');
parent::_initialize(); // TODO: Change the autogenerated stub
}
public function index($p=1)
{
if(isset($_REQUEST['gameId'])&&$_REQUEST['gameId']!=""){
$map['game_id']=$_REQUEST['gameId'];
}
if(isset($_REQUEST['systems'])&&$_REQUEST['systems']!=""){
$map['server_version']=$_REQUEST['systems'];
}
if(isset($_REQUEST['status'])&&$_REQUEST['status']!=""){
$map['show_status']=$_REQUEST['status'];
}
if(isset($_REQUEST['server_name'])&&$_REQUEST['server_name']!=""){
$map['server_name']=array('like','%'.$_REQUEST['server_name'].'%');
}
$model = new ServerModel();
$map['developers'] = UID;
$result = $model->getDataLists($map,$p);
$this->showPage($result['count']);
$this->assign("data",$result['data']);
$this->display();
}
/**
* 添加区服
* author: xmy 280564871@qq.com
*/
public function add(){
$model = new ServerModel();
if(IS_POST){
$result = $model->upDate(UID);
if($result !== false){
$this->success("保存成功",U('index'));
}else{
$this->error("保存失败:".$model->getError());
}
}else{
$this->display();
}
}
/**
* 删除区服
* author:cy 707670631
*/
public function del($model = null, $ids=null){
$model=new ServerModel();
$result=$model->del($ids);
if($result){
echo json_encode(array('status'=>1,'info'=>'删除成功'));exit;
}else{
echo json_encode(array('status'=>0,'info'=>'删除失败'));exit;
}
}
}