gm内容更新0629

master
duhui 2022-06-29 18:33:31 +08:00
parent e2cd2e3d30
commit 72d13e69bc
4 changed files with 45 additions and 68 deletions

View File

@ -248,10 +248,6 @@ public class ServerInfoController {
if (info == null){ if (info == null){
return 0; return 0;
} }
// 修改服务器状态需要关闭自动开服功能
if (info.getStatus().equals(vo.getStatus()) && AutoServerManager.isOpen()){
return 3;
}
// 1. 修改服务器信息 // 1. 修改服务器信息
serverInfoDao.updateServerInfo(vo); serverInfoDao.updateServerInfo(vo);
@ -288,9 +284,7 @@ public class ServerInfoController {
String[] serverIds = serverId.split(","); String[] serverIds = serverId.split(",");
// 跨服id // 跨服id
String crossIdStr = request.getParameter("crossId"); int crossId = Integer.parseInt(request.getParameter("crossId"));
String patch = "[-]?[0-9]+?";
boolean matches = patch.matches(crossIdStr);
// 状态 // 状态
String status = request.getParameter("status"); String status = request.getParameter("status");
@ -307,17 +301,21 @@ public class ServerInfoController {
LoginController.addQueue("服务器未处于《未运营》状态无法修改服务器id"+id); LoginController.addQueue("服务器未处于《未运营》状态无法修改服务器id"+id);
continue; continue;
} }
// 修改跨服id空或者非整数不做修改
if (crossId >= 0){
updateGmGroupId(id,crossId);
}
if (!status.equals("-999")){
// -5表示维护服务器并踢全部玩家下线一般用于线上停服更新 // -5表示维护服务器并踢全部玩家下线一般用于线上停服更新
if (status.equals("-5")){ if (status.equals("-5")){
serverInfoDao.updateServerInfo(id, "1"); serverInfoDao.updateServerInfo(id, "1");
GMHandler.sendGm(id,"kick 0"); GMHandler.sendGm(id,"kick 0");
}else if (!status.equals("-999")){ }else {
// 修改服务器信息 // 修改服务器信息
serverInfoDao.updateServerInfo(id, status); serverInfoDao.updateServerInfo(id, status);
} }
// 修改跨服id空或者非整数不做修改
if (matches){
updateGmGroupId(id,Integer.parseInt(crossIdStr));
} }
} }
return 1; return 1;

View File

@ -166,52 +166,20 @@ public class AutoServerManager {
// 错误信息 // 错误信息
String cont; String cont;
try { try {
int i = 0;
String content = GMHandler.getCmdContent("serverstatus", serverId);
do {
// 发送rpc到游戏服
Result result1 = RPCClient.sendCmd(Integer.parseInt(serverId),content);
if (result1 == null) {
// result1为空表示rpc发送失败最多重复三次
LOGGER.error("服务器验证状态异常,报null第{}次重试",i+1);
cont = "服务器验证状态异常,三次重试失败,游戏服未启动";
i++;
continue;
}
// rpc通信成功游戏端返回错误码
if (result1.getResultCode() != 0 || StringUtil.isEmpty(result1.getResultMsg())) {
cont = "服务器验证状态异常,code异常,游戏服可能未重启:{"+result1.getResultCode()+"}";
break;
}
// 返回值长度错误
String[] split = result1.getResultMsg().split("_");
if (split.length < 3) {
cont = "服务器验证状态异常,msg异常,游戏服可能未重启:{"+result1.getResultMsg()+"}";
break;
}
// 读库失败 // 读库失败
CServerOpenTime serverTime = serverInfoDao.getOpenServerTime(serverId); CServerOpenTime serverTime = serverInfoDao.getOpenServerTime(serverId);
if (serverTime == null) { if (serverTime == null) {
cont = "服务器验证状态异常,读库失败,游戏服未启动或进程错误:{"+serverId+"}"; cont = "服务器验证状态异常,读库失败,请联系管理员检查服务器id{"+serverId+"}";
break; }else {
} // 开服时间是否同一天
// 返回参数 result1 版本号_开服时间_重启时间 boolean sameDay = DateUtil.isSameDay(DateUtil.now(), DateUtil.timeToStamp(serverTime.getOpenTime()));
String version = split[0]; if (sameDay){
String openTime = split[1];
String restartTime = split[2];
// 验证版本号是否相等,开服时间是否同一天,重启时间是否同一天
boolean ver = version.equals(String.valueOf(serverTime.getVersion()));
boolean open = DateUtil.isSameDay(DateUtil.timeToStamp(openTime), DateUtil.timeToStamp(serverTime.getOpenTime()));
boolean restart = DateUtil.isSameDay(DateUtil.timeToStamp(restartTime), DateUtil.timeToStamp(serverTime.getRestartTime()));
if (ver && open && restart){
return true; return true;
} }
cont = "服务器验证状态异常,参数验证失败:读库参数:{"+serverTime.toString()+"},游戏服参数:{" cont = "服务器验证开服时间错误:服务器信息:{"+serverTime.toString()+"}";
+ Arrays.toString(split)+"}, \n验证结果版本号:{"+ver+"},开服时间:{"+open+"},重启时间:{" }
+ restart+"}";
} while (i < 3);
} catch (Exception e) { } catch (Exception e) {
LoginController.addQueue("检查服务器开启状态报错,服务器"+serverId+",报错:"+e.getMessage()); LoginController.addQueue("检查服务器开启状态报错服务器id"+serverId+",报错:"+e.getMessage());
cont = "服务器验证状态异常:{"+e.getMessage()+"}"; cont = "服务器验证状态异常:{"+e.getMessage()+"}";
e.printStackTrace(); e.printStackTrace();
} }
@ -247,6 +215,8 @@ public class AutoServerManager {
ServerInfo serverInfo = serverInfoDao.getServerInfo(vo.getServer_id()); ServerInfo serverInfo = serverInfoDao.getServerInfo(vo.getServer_id());
// 停服脚本 // 停服脚本
AutoServerManager.getInstance().delUser(serverInfo); AutoServerManager.getInstance().delUser(serverInfo);
// 间隔30秒再获取开服数据
Thread.sleep(DateUtil.ONE_SECOND * 10);
// 验证 // 验证
boolean serverStatus = verifyServerStatus(serverInfo); boolean serverStatus = verifyServerStatus(serverInfo);
if (serverStatus){ if (serverStatus){
@ -290,7 +260,7 @@ public class AutoServerManager {
Process exec = null; Process exec = null;
try { try {
exec = Runtime.getRuntime().exec(command); exec = Runtime.getRuntime().exec(command);
AutoServerManager.readProcessOutput(exec); readProcessOutput(exec);
LOGGER.info("===========================重启脚本执行结果结束"); LOGGER.info("===========================重启脚本执行结果结束");
exec.waitFor(); exec.waitFor();
result = 1; result = 1;
@ -348,7 +318,8 @@ public class AutoServerManager {
public static List<String> readProcessOutput(final Process process) { public static List<String> readProcessOutput(final Process process) {
// 将进程的正常输出在 System.out 中打印,进程的错误输出在 System.err 中打印 // 将进程的正常输出在 System.out 中打印,进程的错误输出在 System.err 中打印
List<String> read = read(process.getInputStream(), System.out); List<String> read = read(process.getInputStream(), System.out);
read(process.getErrorStream(), System.err); read.add("err开始===================================");
read.addAll(read(process.getErrorStream(), System.err));
return read; return read;
} }

View File

@ -30,7 +30,7 @@
<span class="c-gray en">&gt;</span> 服务器管理 <span class="c-gray en">&gt;</span> 服务器管理
<span class="c-gray en">&gt;</span> 服务器信息 <span class="c-gray en">&gt;</span> 服务器信息
<a class="btn btn-success radius r" style="margin-top:3px;padding-bottom: 3px;" <a class="btn btn-success radius r" style="margin-top:3px;padding-bottom: 3px;"
href="javascript:location.replace('/findServerInfo?quick=0');" title="刷新"> href="javascript:location.replace('/findServerInfoNotCache');" title="刷新">
<i class="Hui-iconfont">&#xe68f;</i> <i class="Hui-iconfont">&#xe68f;</i>
</a> </a>
</nav> </nav>
@ -46,7 +46,7 @@
<option th:each="server:${serverInfos}" th:if="${server.getStatus() != '-2'}" th:value="${server.getServer_id()}" <option th:each="server:${serverInfos}" th:if="${server.getStatus() != '-2'}" th:value="${server.getServer_id()}"
th:text="${server.getServer_id()}+'-'+${server.getName()}"></option> th:text="${server.getServer_id()}+'-'+${server.getName()}"></option>
</select> </select>
<select name="status2" class="input-text" id="status2" title="服务器状态,《请选择》不会进行修改" style="width: 80px;"><!--下拉列表--> <select name="status2" class="input-text" id="status2" title="服务器状态,《请选择》状态不做修改" style="width: 150px;"><!--下拉列表-->
<option value="-999">请选择</option> <option value="-999">请选择</option>
<option value="-5">维护并踢全部玩家下线</option> <option value="-5">维护并踢全部玩家下线</option>
<option value="0">关闭</option> <option value="0">关闭</option>
@ -55,11 +55,11 @@
<option value="3">拥挤</option> <option value="3">拥挤</option>
<option value="4">爆满</option> <option value="4">爆满</option>
</select> </select>
<input type="text" id="crossId2" style="width: 55px;" title="跨服id,《空或者非整数》不会进行修改" class="input-text"/> <input type="number" id="crossId2" style="width: 55px;" value="-1" title="跨服id,负数不做修改" class="input-text"/>
<button class="btn btn-primary" type="button" onclick="updateServers()">批量修改</button> <button class="btn btn-primary" type="button" onclick="updateServers()">批量修改</button>
<div style="float: right"> <!-- <div style="float: right">-->
刷新服务器缓存:【<a href="/findServerInfoNotCache">刷新</a> <!-- 刷新服务器缓存:【<a href="/findServerInfoNotCache">刷新</a>】-->
</div> <!-- </div>-->
</div> </div>
<div class="mt-20"> <div class="mt-20">
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive"> <table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
@ -70,6 +70,7 @@
<th width="100">开启类型</th> <th width="100">开启类型</th>
<th width="200">服务器名字</th> <th width="200">服务器名字</th>
<th width="100">渠道</th> <th width="100">渠道</th>
<th width="100">core</th>
<th width="200">开服时间</th> <th width="200">开服时间</th>
<th width="100">跨服分组id当前</th> <th width="100">跨服分组id当前</th>
<th width="120">服务器状态</th> <th width="120">服务器状态</th>
@ -88,6 +89,7 @@
<td th:text="${obj.getOpenType()}" 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.getName()}" style="text-align: center;"></td>
<td th:text="${obj.getChannel()}" style="text-align: center;"></td> <td th:text="${obj.getChannel()}" style="text-align: center;"></td>
<td th:text="${obj.getCoreName()}" style="text-align: center;"></td>
<td th:text="${obj.getOpenTime()}" style="text-align: center;"></td> <td th:text="${obj.getOpenTime()}" style="text-align: center;"></td>
<td th:text="${obj.getGroupShow()}" style="text-align: center;"></td> <td th:text="${obj.getGroupShow()}" style="text-align: center;"></td>
<th th:switch="${obj.getStatus()}" style="text-align: center;"> <th th:switch="${obj.getStatus()}" style="text-align: center;">

View File

@ -27,6 +27,12 @@
</div> </div>
<div style="margin-left: 20px;font-size: 18px"> <div style="margin-left: 20px;font-size: 18px">
<div> <div>
<h2 style="color: red" class="f-36">更新日志[2022-6-29]</h2>
<p class="f-14" style="line-height:32px;">
1、服务器信息页面删除缓存更新文字按钮同时修改右上角绿色修改刷新时会更新缓存<br>
2、部分选框没有注释的可以将鼠标移动到改选框上会有提示。例如服务器信息界面上方批量修改的状态多选框和跨服id输入框
3、服务器批量修改bug处理
</p>
<h2 style="color: red" class="f-18">更新日志[2022-5-26]</h2> <h2 style="color: red" class="f-18">更新日志[2022-5-26]</h2>
<p class="f-14" style="line-height:32px;"> <p class="f-14" style="line-height:32px;">
1、封禁列表显示字段优化<br> 1、封禁列表显示字段优化<br>