服务器列表优化

master
duhui 2021-11-02 17:41:12 +08:00
parent 07b87dd4ff
commit 0622fb56cc
19 changed files with 379 additions and 211 deletions

View File

@ -15,7 +15,6 @@ import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -48,11 +47,14 @@ public class Application extends SpringBootServletInitializer {
minuteTask.setsHotFixManager(sHotFixManager);
scheduledExecutorService.scheduleWithFixedDelay(minuteTask,30,60, TimeUnit.SECONDS);
FileCacheUtils.initData();
// SHotFixManager.main(args);
// FileCacheUtils.initData();
}
@Override//为了打包springboot项目
/**
* springboot
* @param builder
* @return
*/
@Override
protected SpringApplicationBuilder configure(
SpringApplicationBuilder builder) {
return builder.sources(this.getClass());

View File

@ -49,7 +49,7 @@ public class OrderInfoController {
private static final Logger LOGGER = LoggerFactory.getLogger(OrderInfoController.class);
@RequestMapping(value = "/getOrder", method = {RequestMethod.POST, RequestMethod.GET})
public String getOrder(HttpServletRequest request, ModelMap map ) throws Exception {
public String getOrder(HttpServletRequest request, ModelMap map) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
long startTime = DateUtil.timeToStamp(parameterMap.get("startTime").replace("T"," "));
long endTime = DateUtil.timeToStamp(parameterMap.get("endTime").replace("T"," "));

View File

@ -18,16 +18,18 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author hj
*/
@Controller
public class ServerInfoController {
private static final Logger LOGGER = LoggerFactory.getLogger(ServerInfoController.class);
@ -39,6 +41,16 @@ public class ServerInfoController {
@Resource
private AutoServerManager autoServerManager;
/**
*
*/
private static ExpiryMap<String,CServerOpenTime> serverStatus = new ExpiryMap<>();
/**
*
* key: id
* value [0]: [1]:
*/
private static ExpiryMap<String,int[]> portStatusMap = new ExpiryMap<>();
/**
*
* @param map
@ -46,41 +58,83 @@ public class ServerInfoController {
* @throws Exception
*/
@RequestMapping(value = "/findServerInfo", method = {RequestMethod.POST, RequestMethod.GET})
public String loginVerify(ModelMap map) throws Exception {
public String loginVerify(ModelMap map, int quick) throws Exception {
List<ServerInfo> serverInfos = serverInfoDao.getAllServerInfo();
List<ServerInfoVo> serverInfoVos = new ArrayList<>();
// 端口验证
if (quick == 1){
// 更新端口状态
ThreadPoolManager.getInstance().execute(this::portListenHandler);
}
for (ServerInfo serverInfo : serverInfos) {
if (null == serverInfo.getServer_id()) {
continue;
}
// LOGGER.info("==============服务器信息:{}",serverInfo.toString());
ServerInfoVo serverInfoVo = new ServerInfoVo();
serverInfoVo.setServer_id(serverInfo.getServer_id());
serverInfoVo.setName(serverInfo.getName());
serverInfoVo.setStatus(Integer.valueOf(serverInfo.getStatus()));
if(serverInfo.getIs_new()!=null){
serverInfoVo.setIsnew(Integer.valueOf(serverInfo.getIs_new()));
}
CServerOpenTime cServerOpenTime = serverInfoDao.getOpenServerTime(serverInfo.getServer_id());
if (null != cServerOpenTime) {
serverInfoVo.setOpen_time(cServerOpenTime.getOpenTime());
serverInfoVo.setVersion(cServerOpenTime.getVersion());
serverInfoVo.setRestartTime(cServerOpenTime.getRestartTime());
}
serverInfoVo.setIp_port(serverInfo.getIp()+":"+serverInfo.getPort());
String openT = "手动开服";
AutoServerSetting setting = RedisUtil.getInstence().getMapValue(RedisUserKey.AUTO_START_SERVER_SETTING, "1", "1", AutoServerSetting.class, -1);
if (setting != null && "1".equals(setting.getState())){
openT = "1".equals(setting.getChoose())?"按量开服":"自动开服";
}
serverInfoVo.setOpen_type(openT);
ServerInfoVo serverInfoVo = createServerVo(serverInfo,quick);
serverInfoVos.add(serverInfoVo);
}
map.addAttribute("serverInfos", serverInfoVos);
return "findServerInfo";
}
/**
*
* @param serverId
* @param quick 0 1
* @return
* @throws Exception
*/
public CServerOpenTime getServerOpenTime(String serverId,int quick) throws Exception {
CServerOpenTime openTime = serverStatus.get(serverId);
if (openTime != null && quick == 0){
return openTime;
}
CServerOpenTime cServerOpenTime = serverInfoDao.getOpenServerTime(serverId);
if (cServerOpenTime == null){
return null;
}
serverStatus.put(serverId,cServerOpenTime,DateUtil.ONE_HOUR);
return cServerOpenTime;
}
/**
*
* @param serverInfo
* @param quick
* @return
* @throws Exception
*/
private ServerInfoVo createServerVo(ServerInfo serverInfo,int quick) throws Exception {
ServerInfoVo vo = new ServerInfoVo(serverInfo);
// ip+端口
vo.setIpAndPort(serverInfo.getIp()+":"+serverInfo.getPort());
// 服务器配置,开服时间,重启时间,版本号
CServerOpenTime openTime = getServerOpenTime(serverInfo.getServer_id(), quick);
if (openTime != null){
vo.setOpenTime(openTime.getOpenTime());
vo.setRestartTime(openTime.getRestartTime());
vo.setVersion(openTime.getVersion());
}
// 开服方法
String openType = "手动开服";
AutoServerSetting setting = RedisUtil.getInstence().getMapValue(RedisUserKey.AUTO_START_SERVER_SETTING, "1", "1", AutoServerSetting.class, -1);
if (setting != null && "1".equals(setting.getState())){
openType = "1".equals(setting.getChoose())?"按量开服":"自动开服";
}
vo.setOpenType(openType);
int[] ints = portStatusMap.get(serverInfo.getServer_id());
if (ints != null){
// 游戏端口
int gamePort = ints.length>0?ints[0]:-1;
vo.setGamePortState(gamePort);
// 支付端口
int payPort = ints.length>1?ints[1]:-1;
vo.setPayPortState(payPort);
}
return vo;
}
/**
*
* @param map
@ -91,14 +145,17 @@ public class ServerInfoController {
@RequestMapping(value = "/toServerInfoEdit", method = {RequestMethod.POST, RequestMethod.GET})
public String toServerInfoEdit(ModelMap map, int id) throws Exception {
ServerInfo serverInfo = serverInfoDao.getServerinfo(String.valueOf(id));
CServerOpenTime cServerOpenTime = serverInfoDao.getOpenServerTime(serverInfo.getServer_id());
if (null != cServerOpenTime) {
serverInfo.setOpen_time(cServerOpenTime.getOpenTime());
}
map.addAttribute("serverInfo", serverInfo);
ServerInfoVo vo = createServerVo(serverInfo, 0);
map.addAttribute("serverInfo", vo);
return "serverInfoEdit";
}
/**
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/deleteServer", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody
int deleteServer(HttpServletRequest request) throws Exception {
@ -168,17 +225,19 @@ public class ServerInfoController {
*/
@RequestMapping(value = "/serverListEdit", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody int toServerListEdit(HttpServletRequest request) throws Exception {
int status = Integer.parseInt(request.getParameter("status"));
String serverId = request.getParameter("serverId");
// 校验服务器状态
String[] serverIds = serverId.split(",");
for (String str:serverIds){
ServerInfo info = serverInfoDao.getServerinfo(str);
if (info != null && ServerStatusEnum.NOT_OPERATE.getId() == Integer.parseInt(info.getStatus())){
Map<String, ServerInfo> allServerMap = serverInfoDao.getAllServerMap();
for (String id : serverIds) {
ServerInfo info = allServerMap.get(id);
// 存在未运行状态的服务器不能批量修改
if (info != null && Integer.parseInt(info.getStatus()) == ServerStatusEnum.NOT_OPERATE.getId()){
return 0;
}
}
// 修改服务器状态
int status = Integer.parseInt(request.getParameter("status"));
for (String str:serverIds){
serverInfoDao.updateServerInfo(str, status);
}
@ -196,13 +255,17 @@ public class ServerInfoController {
continue;
}
ServerInfoVo serverInfoVo = new ServerInfoVo();
// 服务器id
serverInfoVo.setServer_id(serverInfo.getServer_id());
// 注册人数
long registerNum = serverInfoDao.getRegisterNum(serverInfo.getServer_id());
totalRegisterNum += registerNum;
serverInfoVo.setRegisterNum(registerNum);
// 在线人数
long onlineNum = serverInfoDao.getOnlineNum(serverInfo.getServer_id());
totalOnlineNum += onlineNum;
serverInfoVo.setOnlineNum(onlineNum);
serverInfoVos.add(serverInfoVo);
}
ServerInfoVo serverInfoVo = new ServerInfoVo();
@ -257,4 +320,84 @@ public class ServerInfoController {
RedisUtil.getInstence().putMapEntry(RedisUserKey.AUTO_START_SERVER_SETTING, "1", "1", setting, -1);
return 1;
}
/**
*
* @throws Exception
*/
public void portListenHandler(){
long start = DateUtil.now();
// 脚本
String shell = "sh /data/jieling/port.sh";
Process exec = null;
try {
// 获取全部服务器列表
Map<String, ServerInfo> allServerMap = serverInfoDao.getAllServerMap();
//一台物理机可以配置多个游戏服 keyip valueserverids
HashMap<String, List<String>> map = new HashMap<>();
for (ServerInfo value : allServerMap.values()) {
List<String> list = map.getOrDefault(value.getIp(), new ArrayList<>());
list.add(value.getServer_id());
map.put(value.getIp(),list);
}
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
String ip = entry.getKey();
List<String> serverIds = entry.getValue();
// 游戏端口
exec = Runtime.getRuntime().exec(shell + " " + ip + " 160");
List<String> gamePorts = AutoServerManager.readProcessOutput(exec);
exec = null;
// 支付端口
exec = Runtime.getRuntime().exec(shell + " " + ip + " 180");
List<String> payPorts = AutoServerManager.readProcessOutput(exec);
for (String serverId : serverIds) {
// 端口缓存
int[] ports = portStatusMap.getOrDefault(serverId,new int[2]);
// 游戏端口校验
ServerInfo info = allServerMap.get(serverId);
ports[0] = checkPort(gamePorts, info.getPort())?1:0;
// 支付端口校验
String payPort = getPayPort(info.getPort());
ports[1] = checkPort(payPorts, payPort)?1:0;
// 缓存处理,半小时
portStatusMap.put(serverId,ports,DateUtil.ONE_HOUR/2);
}
}
} catch (Exception e) {
LOGGER.error("服务器端口检测异常:"+e.getMessage());
} finally {
if (exec != null) {
exec.destroy();
}
}
LOGGER.error("检测游戏端口耗时:{}",DateUtil.now()-start);
}
private String getPayPort(String gamePort){
return "180"+gamePort.substring(3);
}
/**
*
* @param strings
* @param port
* @return
*/
private boolean checkPort(List<String> strings, String port){
// 1,第一行日志无用,所以删除
strings.remove(0);
ArrayList<String> list = new ArrayList<>();
for (String string : strings) {
// 2,用【tab】分割
String[] split = string.split("\t");
// 3,用【:】号分割
String[] split1 = split[3].split(":");
// 4,取最后一位,是端口号
String s = split1[split1.length - 1];
list.add(s);
}
return list.contains(port);
}
}

View File

@ -7,10 +7,13 @@ import com.jmfy.model.gameName;
import org.springframework.data.mongodb.core.MongoTemplate;
import java.util.List;
import java.util.Map;
public interface ServerInfoDao {
List<ServerInfo> getAllServerInfo() throws Exception;
Map<String,ServerInfo> getAllServerMap() throws Exception;
List<gameName> getAllGameInfo() throws Exception;
ServerInfo getServerinfo(String id) throws Exception;

View File

@ -15,6 +15,8 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class ServerInfoDaoImpl implements ServerInfoDao {
@ -31,6 +33,14 @@ public class ServerInfoDaoImpl implements ServerInfoDao {
return mongoTemplate.find(query, ServerInfo.class);
}
@Override
public Map<String, ServerInfo> getAllServerMap() throws Exception {
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
Query query = new Query();
List<ServerInfo> serverInfos = mongoTemplate.find(query, ServerInfo.class);
return serverInfos.stream().collect(Collectors.toMap(ServerInfo::getServer_id, v -> v));
}
@Override
public List<gameName> getAllGameInfo() throws Exception {
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);

View File

@ -50,27 +50,15 @@ public class ServerInfo implements Comparable,Cloneable {
@Field(value = "plat")
private String plat;
@Field(value = "open_time")
private String open_time;
@Field(value = "is_new")
private String is_new;
/**
* 0 1 2
*/
@Field(value = "open_type")
private String open_type;
@Field(value = "register_state")
private String register_state;
@Field(value = "coreName")
private String coreName;
@Field(value = "server_version")
private int server_version;
@Field(value = "isWhite")
private String isWhite;
@ -155,14 +143,6 @@ public class ServerInfo implements Comparable,Cloneable {
this.plat = plat;
}
public String getOpen_time() {
return open_time;
}
public void setOpen_time(String open_time) {
this.open_time = open_time;
}
public String getIs_new() {
return is_new==null?"0":is_new;
}
@ -171,14 +151,6 @@ public class ServerInfo implements Comparable,Cloneable {
this.is_new = is_new;
}
public String getOpen_type() {
return open_type==null?"0":open_type;
}
public void setOpen_type(String open_type) {
this.open_type = open_type;
}
public String getRegister_state() { return register_state==null?"1":register_state; }
public void setRegister_state(String register_state) { this.register_state = register_state; }
@ -191,14 +163,6 @@ public class ServerInfo implements Comparable,Cloneable {
this.coreName = coreName;
}
public int getServer_version() {
return server_version;
}
public void setServer_version(int server_version) {
this.server_version = server_version;
}
public String getIsWhite() {
return isWhite;
}
@ -219,12 +183,9 @@ public class ServerInfo implements Comparable,Cloneable {
", sub_channel='" + sub_channel + '\'' +
", status='" + status + '\'' +
", plat='" + plat + '\'' +
", open_time='" + open_time + '\'' +
", is_new='" + is_new + '\'' +
", open_type='" + open_type + '\'' +
", register_state='" + register_state + '\'' +
", coreName='" + coreName + '\'' +
", server_version='" + server_version + '\'' +
", isWhite='" + isWhite + '\'' +
'}';
}

View File

@ -14,7 +14,7 @@ public enum PowersEnum {
// 服务器管理200-299
SERVER_MANAGER(200,"服务器管理",200,1,""),
SERVER_INFO(201,"服务器信息",200,1,"findServerInfo"),
SERVER_INFO(201,"服务器信息",200,1,"findServerInfo?quick=0"),
SERVER_REGISTER(202,"服务器注册查询",200,1,"serverNumberInfo"),
ADD_SERVER(203,"添加服务器",200,1,"/html/addServer.html"),
ALL_SERVER_SETTING(204,"全服配置",200,1,"serverCfgInfo"),

View File

@ -1,72 +1,79 @@
package com.jmfy.model.vo;
public class ServerInfoVo{
import com.jmfy.model.ServerInfo;
public String server_id;
public String ip_port;
public String name;
public String open_time;
public String open_type;
public int status;
public int is_new;
public long registerNum;
public long onlineNum;
private int version;
public class ServerInfoVo extends ServerInfo {
/**
* ip
*/
private String ipAndPort;
/**
*
*/
private String openTime;
/**
*
*/
private String restartTime;
/**
*
*/
private int version;
/**
*
*/
private String openType;
/**
*
*/
private long registerNum;
/**
* 线
*/
private long onlineNum;
/**
*
*/
private int gamePortState = -1;
/**
*
*/
private int payPortState = -1;
public ServerInfoVo(){
public void setIsnew(int isnew) {
this.is_new = isnew;
}
public void setServer_id(String server_id) {
this.server_id = server_id;
public ServerInfoVo(ServerInfo serverInfo){
this.setName(serverInfo.getName());
this.setIp(serverInfo.getIp());
this.setPort(serverInfo.getPort());
this.setServer_id(serverInfo.getServer_id());
this.setChannel(serverInfo.getChannel());
this.setSub_channel(serverInfo.getSub_channel());
this.setStatus(serverInfo.getStatus());
this.setPlat(serverInfo.getPlat());
this.setIs_new(serverInfo.getIs_new());
this.setRegister_state(serverInfo.getRegister_state());
this.setCoreName(serverInfo.getCoreName());
this.setIsWhite(serverInfo.getIsWhite());
}
public void setName(String name) {
this.name = name;
public String getIpAndPort() {
return ipAndPort;
}
public void setOpen_time(String open_time) {
this.open_time = open_time;
public void setIpAndPort(String ipAndPort) {
this.ipAndPort = ipAndPort;
}
public void setStatus(int status) {
this.status = status;
public String getOpenTime() {
return openTime;
}
public void setRegisterNum(long registerNum) {
this.registerNum = registerNum;
}
public void setOnlineNum(long onlineNum) {
this.onlineNum = onlineNum;
}
public String getOpen_type() {
return open_type;
}
public void setOpen_type(String open_type) {
this.open_type = open_type;
}
public String getIp_port() {
return ip_port;
}
public long getOnlineNum(){
return onlineNum;
}
public void setIp_port(String ip_port) {
this.ip_port = ip_port;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
public void setOpenTime(String openTime) {
this.openTime = openTime;
}
public String getRestartTime() {
@ -77,20 +84,66 @@ public class ServerInfoVo{
this.restartTime = restartTime;
}
public String getOpenType() {
return openType;
}
public void setOpenType(String openType) {
this.openType = openType;
}
public long getRegisterNum() {
return registerNum;
}
public void setRegisterNum(long registerNum) {
this.registerNum = registerNum;
}
public long getOnlineNum() {
return onlineNum;
}
public void setOnlineNum(long onlineNum) {
this.onlineNum = onlineNum;
}
public int getGamePortState() {
return gamePortState;
}
public void setGamePortState(int gamePortState) {
this.gamePortState = gamePortState;
}
public int getPayPortState() {
return payPortState;
}
public void setPayPortState(int payPortState) {
this.payPortState = payPortState;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
@Override
public String toString() {
return "ServerInfoVo{" +
"server_id='" + server_id + '\'' +
", ip_port='" + ip_port + '\'' +
", name='" + name + '\'' +
", open_time='" + open_time + '\'' +
", open_type='" + open_type + '\'' +
", status=" + status +
", is_new=" + is_new +
"ipAndPort='" + ipAndPort + '\'' +
", openTime='" + openTime + '\'' +
", restartTime='" + restartTime + '\'' +
", version=" + version +
", openType='" + openType + '\'' +
", registerNum=" + registerNum +
", onlineNum=" + onlineNum +
", version='" + version + '\'' +
", restartTime='" + restartTime + '\'' +
", gamePortState=" + gamePortState +
", payPortState=" + payPortState +
'}';
}
}

View File

@ -35,7 +35,10 @@ public class RedisUserKey {
* 线 updata/min
*/
public static final String ONLINE_NUM = "ONLINE_NUM";
/**
*
*/
public static final String GAME_PAY_URL = "GAME_PAY_URL:";
public static String getKey(String type, String key, int serverId) {
if (serverId!=0) {

View File

@ -14,6 +14,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
@ -271,11 +272,11 @@ public class AutoServerManager {
*
* @param process
*/
private static void readProcessOutput(final Process process) {
public static List<String> readProcessOutput(final Process process) {
// 将进程的正常输出在 System.out 中打印,进程的错误输出在 System.err 中打印
read(process.getInputStream(), System.out);
List<String> read = read(process.getInputStream(), System.out);
read(process.getErrorStream(), System.err);
return read;
}
/**
@ -284,11 +285,13 @@ public class AutoServerManager {
* @param inputStream
* @param out
*/
private static void read(InputStream inputStream, PrintStream out) {
private static List<String> read(InputStream inputStream, PrintStream out) {
ArrayList<String> strings = new ArrayList<>();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = reader.readLine()) != null) {
strings.add(line);
out.println(line);
}
} catch (IOException e) {
@ -300,5 +303,6 @@ public class AutoServerManager {
e.printStackTrace();
}
}
return strings;
}
}

View File

@ -122,24 +122,6 @@
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
开启时间:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" name="open_time" style="width: 200px;" value="0" class="input-text"/>
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
开启类型:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="number" name="open_type" style="width: 200px;" value="0" class="input-text"/>
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
@ -170,15 +152,6 @@
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
版本号:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="number" name="server_version" style="width: 200px;" value="0" class="input-text"/>
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>

View File

@ -78,7 +78,7 @@
<div class="row cl">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button class="btn btn-primary radius" type="button" onclick="keepSetting()"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
<button class="btn btn-default radius" type="button"><a href="/findServerInfo">&nbsp;&nbsp;取消&nbsp;&nbsp;</a></button>
<button class="btn btn-default radius" type="button"><a href="/findServerInfo?quick=0">&nbsp;&nbsp;取消&nbsp;&nbsp;</a></button>
</div>
</div>
</form>

View File

@ -48,7 +48,7 @@
<span class="c-red">*</span>
开始时间:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="datetime-local" name="startTime" class="input-text" style="width: 210px" step="1">
<input type="datetime-local" name="startTime" class="input-text" style="width: 210px" min="1970-01-01T000000" step="1">
</div>
</div>
<div class="row cl">
@ -56,7 +56,7 @@
<span class="c-red">*</span>
结束时间:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="datetime-local" name="endTime" class="input-text" style="width: 210px" step="1">
<input type="datetime-local" name="endTime" class="input-text" style="width: 210px" min="1970-01-01T000000" step="1">
</div>
</div>
<div class="row cl">

View File

@ -25,13 +25,15 @@
<title>服务器列表信息</title>
</head>
<body>
<nav class="breadcrumb">
<nav class="breadcrumb" style="padding-bottom: 45px;">
<i class="Hui-iconfont">&#xe67f;</i> 首页
<span class="c-gray en">&gt;</span> 服务器管理
<span class="c-gray en">&gt;</span> 服务器信息
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
href="javascript:location.replace('/findServerInfo');" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<a class="btn btn-success radius r" style="margin-top:3px;padding-bottom: 3px;"
href="javascript:location.replace('/findServerInfo?quick=1');" title="刷新缓存">
<i class="Hui-iconfont">&#xe68f;</i>
</a>
</nav>
<div class="page-container" style="text-align: center">
<h2><span style="color:red;">服务器信息</span></h2>
<div class="text-c">
@ -61,41 +63,52 @@
<th width="200">ip:port</th>
<th width="200">开启类型</th>
<th width="200">服务器名字</th>
<th width="200">时间</th>
<th width="200">时间</th>
<th width="200">服务器状态</th>
<th width="200">新服推荐</th>
<th width="200">版本号</th>
<th width="200">上次重启时间</th>
<th width="200">游戏端口状态(160*)</th>
<th width="200">支付端口状态(180*)</th>
<th width="200">操作</th>
</tr>
</thead>
<tbody>
<tr th:each="obj:${serverInfos}">
<td th:text="${obj.server_id}" style="text-align: center;"></td>
<td th:text="${obj.ip_port}" style="text-align: center;"></td>
<td th:text="${obj.open_type}" style="text-align: center;"></td>
<td th:text="${obj.name}" style="text-align: center;"></td>
<td th:text="${obj.open_time}" style="text-align: center;"></td>
<th th:switch="${obj.status}" style="text-align: center;">
<td th:text="${obj.getServer_id()}" style="text-align: center;"></td>
<td th:text="${obj.getIpAndPort()}" style="text-align: center;"></td>
<td th:text="${obj.getOpenType()}" style="text-align: center;"></td>
<td th:text="${obj.getName()}" style="text-align: center;"></td>
<td th:text="${obj.getOpenTime()}" style="text-align: center;"></td>
<th th:switch="${obj.getStatus()}" style="text-align: center;">
<span th:case="-2" class="Hui-iconfont" style="color: #8b0000;">未运营 </span>
<span th:case="0" class="label label-defaunt radius">已关闭</span>
<span th:case="1" class="Hui-iconfont" style="color: #2f332a">维护</span>
<span th:case="2" class="Hui-iconfont" style="color: #00B83F">流畅</span>
<span th:case="3" class="Hui-iconfont" style="color: #9cb945">拥挤</span>
<span th:case="4" class="Hui-iconfont" style="color: #8b0000;">爆满 </span>
<span th:case="4" class="Hui-iconfont" style="color: #8b0000;">爆满</span>
</th>
<th th:switch="${obj.is_new}" style="text-align: center;">
<th th:switch="${obj.getIs_new()}" style="text-align: center;">
<span th:case="0" class="label label-defaunt radius">普通</span>
<span th:case="1" class="Hui-iconfont" style="color: #2f332a">新服推荐</span>
</th>
<td th:text="${obj.version}" style="text-align: center;"></td>
<td th:text="${obj.restartTime}" style="text-align: center;"></td>
<td th:text="${obj.getVersion()}" style="text-align: center;"></td>
<td th:text="${obj.getRestartTime()}" style="text-align: center;"></td>
<th th:switch="${obj.getGamePortState()}" style="text-align: center;">
<span th:case="-1" class="Hui-iconfont" style="color:red;">检测失败 </span>
<span th:case="0" class="Hui-iconfont" style="color:grey;">关闭 </span>
<span th:case="1" class="Hui-iconfont" style="color:green">开启</span>
</th>
<th th:switch="${obj.getPayPortState()}" style="text-align: center;">
<span th:case="-1" class="Hui-iconfont" style="color:red;">检测失败 </span>
<span th:case="0" class="Hui-iconfont" style="color:grey;">关闭 </span>
<span th:case="1" class="Hui-iconfont" style="color:green">开启</span>
</th>
<td class="td-manage" style="text-align: center;">
<a href="#" class="btn btn-primary radius" th:id="${obj.server_id}" onclick="return editServer(this)">
<a href="#" class="btn btn-primary radius" th:id="${obj.getServer_id()}" onclick="return editServer(this)">
<i class="Hui-iconfont"></i> 修改
</a>
<button type="button" th:id="${obj.server_id}" class="btn btn-danger" onclick="return deleteServer(this)">
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-danger" onclick="return deleteServer(this)">
<i class="Hui-iconfont"></i> 删除
</button>
<!--<a title="" href="javascript:;" th:href="@{/toSetOpenServerTime(id =${obj.server_id})}" class="ml-5" style="text-decoration:none">-->
@ -132,11 +145,13 @@
]
});
// 单个修改服务器
function editServer(obj) {
var serverId = $(obj).attr("id");
window.location = "/toServerInfoEdit?id=" + serverId;
}
// 删除服务器列表
function deleteServer(obj) {
var serverId = $(obj).attr("id");
var msg = "请问是否要删除该服务器:{"+serverId+"},\n\n请确认";
@ -150,7 +165,7 @@
success: function (data) {
if (data === 1) {
alert("操作成功");
window.location.href = '/findServerInfo';
window.location.href = '/findServerInfo?quick=0';
}
if (data === 0) {
alert("删除失败");
@ -165,6 +180,7 @@
}
}
// 批量修改服务器状态
function updateServers() {
var serverId = $("#serverId").val().toString();
var status2 = $("#status2").val().toString();
@ -178,7 +194,7 @@
success: function (data) {
if (data === 1) {
alert("操作成功");
window.location.href = '/findServerInfo';
window.location.href = '/findServerInfo?quick=0';
}
if (data === 0) {
alert("服务器存在未运营状态,操作失败");

View File

@ -25,7 +25,7 @@
<span class="c-gray en">&gt;</span> 白名单信息
<span class="c-gray en">&gt;</span> 白名单信息
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
href="javascript:location.replace('/findServerInfo');" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
href="javascript:location.replace('/findServerInfo?quick=0');" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container" style="text-align: center">
<h2><span style="color:red;">删除白名单</span></h2>
<div class="text-c">

View File

@ -34,7 +34,7 @@
太初密卷
<span class="c-gray en">&gt;</span>
太初密卷信息
<!--<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/findServerInfo');" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>-->
<!--<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/findServerInfo?quick=0');" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>-->
</nav>
<div class="page-container">
<form class="form form-horizontal" th:object="${secretVolumeInfo}" action="/secretVolumeEdit" method="post">

View File

@ -33,7 +33,7 @@
服务器管理
<span class="c-gray en">&gt;</span>
服务器列表信息
<!--<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/findServerInfo');" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>-->
<!--<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/findServerInfo?quick=0');" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>-->
</nav>
<div class="page-container">
<form class="form form-horizontal" th:object="${serverInfo}" action="*" method="post">
@ -47,7 +47,7 @@
<span class="c-red">*</span>
服务器id</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" name="server_id" placeholder="" th:value="*{server_id}" class="input-text"/>
<input type="text" name="server_id" placeholder="" th:value="*{getServer_id()}" class="input-text"/>
</div>
</div>
<div class="row cl">
@ -55,7 +55,7 @@
<span class="c-red">*</span>
服务器name</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" name="name" placeholder="" th:value="*{name}" class="input-text"/>
<input type="text" name="name" placeholder="" th:value="*{getName()}" class="input-text"/>
</div>
</div>
<div class="row cl">
@ -64,7 +64,7 @@
服务器状态:</label>
<div class="formControls col-xs-8 col-sm-9">
<select th:name="status" class="input-text" id="status"><!--下拉列表-->
<div th:switch="*{status}">
<div th:switch="*{getStatus()}">
<option th:value="0">关闭</option>
<option th:value="1">维护</option>
<option th:value="2">流畅</option>
@ -83,7 +83,7 @@
服务器推荐:</label>
<div class="formControls col-xs-8 col-sm-9">
<select th:name="is_new" class="input-text" id="is_new"><!--下拉列表-->
<div th:switch="*{is_new}">
<div th:switch="*{getIs_new()}">
<option th:value="0">普通</option>
<option th:value="1">新服</option>
</div>
@ -97,7 +97,7 @@
服务器注册:</label>
<div class="formControls col-xs-8 col-sm-9">
<select th:name="register_state" class="input-text" id="register_state"><!--下拉列表-->
<div th:switch="*{register_state}">
<div th:switch="*{getRegister_state()}">
<option th:value="1">开启</option>
<option th:value="0">关闭</option>
</div>
@ -109,7 +109,7 @@
<div class="row cl">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button class="btn btn-primary radius" type="button" onclick="updateServerInfo()"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
<button class="btn btn-default radius" type="button"><a href="/findServerInfo">&nbsp;&nbsp;取消&nbsp;&nbsp;</a>
<button class="btn btn-default radius" type="button"><a href="/findServerInfo?quick=0">&nbsp;&nbsp;取消&nbsp;&nbsp;</a>
</button>
</div>
</div>
@ -167,7 +167,7 @@
success: function (data) {
if (data === 1) {
alert("修改完成,信息会在一分钟后刷新,请于一分钟后刷新界面查看数据是否正常");
window.location.href="/findServerInfo";
window.location.href="/findServerInfo?quick=0";
}
if (data === 0) {
alert("修改失败");

View File

@ -96,7 +96,7 @@
<div class="row cl">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button class="btn btn-primary radius" type="submit" ><i class="Hui-iconfont">&#xe632;</i> 保存</button>
<button class="btn btn-default radius" type="button"><a href="/findServerInfo">&nbsp;&nbsp;取消&nbsp;&nbsp;</a></button>
<button class="btn btn-default radius" type="button"><a href="/findServerInfo?quick=0">&nbsp;&nbsp;取消&nbsp;&nbsp;</a></button>
</div>
</div>
</form>

View File

@ -33,7 +33,7 @@
渠道管理
<span class="c-gray en">&gt;</span>
渠道信息
<!--<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/findServerInfo');" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>-->
<!--<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/findServerInfo?quick=0');" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>-->
</nav>
<div class="page-container">
<form class="form form-horizontal" th:object="${info}" action="*" method="post">