自动开服功能修改

master
PC-202302260912\Administrator 2023-08-15 16:15:37 +08:00
parent 8c3b8a48a9
commit 79f78aa5b0
3 changed files with 46 additions and 13 deletions

View File

@ -310,14 +310,15 @@ public class ServerInfoController {
/**
*
*/
@RequestMapping(value = "/updateServerListCrossId", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody int updateServerListCrossId(HttpServletRequest request) throws Exception {
// f服务器列表
@RequestMapping(value = "/updateServerList", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody int updateServerList(HttpServletRequest request) throws Exception {
// 服务器列表
String serverId = request.getParameter("serverId");
String[] serverIds = serverId.split(",");
// 跨服id
int crossId = Integer.parseInt(request.getParameter("crossId"));
String crossId = request.getParameter("crossId");
String subChannel = request.getParameter("subChannel");
Map<String, ServerInfo> allServerMap = serverInfoDao.getAllServerMap();
for (String id : serverIds) {
@ -327,10 +328,19 @@ public class ServerInfoController {
continue;
}
if (info.getStatusInt() == ServerStatusEnum.NOT_OPERATE.getId()){
RedisLogic.updateGameGroupId(id,crossId);
}else {
RedisLogic.updateGmGroupId(id,crossId);
// 修改跨服id
if (!StringUtil.isEmpty(crossId)){
int cross = Integer.parseInt(crossId);
if (info.getStatusInt() == ServerStatusEnum.NOT_OPERATE.getId()){
RedisLogic.updateGameGroupId(id,cross);
}else {
RedisLogic.updateGmGroupId(id,cross);
}
}
// 修改子渠道
if (!StringUtil.isEmpty(subChannel)){
info.setSub_channel(subChannel);
serverInfoDao.updateServerInfo(info);
}
}
AutoServerManager.initServerInfoMap();

View File

@ -151,10 +151,7 @@ public class StringUtil {
}
public static boolean isEmpty(String source){
if(source == null || source.isEmpty()){
return true;
}
return false;
return source == null || source.isEmpty();
}
public static String parseArrayToString(int[][] source) {

View File

@ -47,6 +47,11 @@
<input type="number" name="crossId" style="height: 36px;line-height: 36px;width: 260px; margin: 0 0 0 10px;" placeholder="跨服id输入数字" class="input-text"/>
<button class="btn btn-primary radius" style="font-size: 15px; margin-left: 10px;" onclick="updateCrossId()"> 提交</button>
</div>
<div style="margin: 0 0 0 80px;padding-top: 50px;">
<span style="color: red;font-size: 15px;">子渠道修改:</span>
<input type="number" name="subChannel" style="height: 36px;line-height: 36px;width: 260px; margin: 0 0 0 10px;" placeholder="子渠道id请找前端确认" class="input-text"/>
<button class="btn btn-primary radius" style="font-size: 15px; margin-left: 10px;" onclick="updateSubChannel()"> 提交</button>
</div>
</div>
</div>
@ -98,6 +103,27 @@
data: [[${serverInfos}]],
});
// 批量修改服务器状态
function updateSubChannel() {
var serverId = serverInfos.getValue('valueStr');
var subChannel = $("input[name='subChannel']").val();
$.ajax({
type: "POST",
data: {
"serverId" : serverId,
"subChannel" : subChannel
},
url: "/updateServerList",
success: function (data) {
if (data === 1) {
alert("操作成功");
}else {
alert("操作失败");
}
}
})
}
// 批量修改服务器状态
function updateCrossId() {
var serverId = serverInfos.getValue('valueStr');
@ -108,7 +134,7 @@
"serverId" : serverId,
"crossId" : crossId
},
url: "/updateServerListCrossId",
url: "/updateServerList",
success: function (data) {
if (data === 1) {
alert("操作成功");