diff --git a/src/main/java/com/jmfy/controller/ServerInfoController.java b/src/main/java/com/jmfy/controller/ServerInfoController.java index da7454d..184437f 100644 --- a/src/main/java/com/jmfy/controller/ServerInfoController.java +++ b/src/main/java/com/jmfy/controller/ServerInfoController.java @@ -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 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(); diff --git a/src/main/java/com/jmfy/utils/StringUtil.java b/src/main/java/com/jmfy/utils/StringUtil.java index 9782e78..8506663 100644 --- a/src/main/java/com/jmfy/utils/StringUtil.java +++ b/src/main/java/com/jmfy/utils/StringUtil.java @@ -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) { diff --git a/src/main/resources/templates/serverListEdit.html b/src/main/resources/templates/serverListEdit.html index c8c41ba..e0ad7de 100644 --- a/src/main/resources/templates/serverListEdit.html +++ b/src/main/resources/templates/serverListEdit.html @@ -47,6 +47,11 @@ +
+ 子渠道修改: + + +
@@ -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("操作成功");