5.10号功能优化,主要涉及封禁和服务器两个功能

master
duhui 2022-05-10 18:34:37 +08:00
parent 4f8e1af589
commit 776d7c95e5
26 changed files with 582 additions and 277 deletions

View File

@ -2,14 +2,11 @@ package com.jmfy.controller;
import com.jmfy.dao.CdkInfoDao;
import com.jmfy.dao.ServerInfoDao;
import com.jmfy.dao.UserInfoDao;
import com.jmfy.dao.impl.GSUserDaoImpl;
import com.jmfy.model.*;
import com.jmfy.model.vo.CDKInfoVo;
import com.jmfy.model.vo.UseCDKInfoVo;
import com.jmfy.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@ -19,8 +16,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.*;
import java.util.*;
@ -167,7 +162,7 @@ public class CdkInfoController {
infoVo.setUserName(gsUser.getPlayerManager().getNickName());
infoVo.setOpenId(gsUser.getPlayerManager().getOpenId());
// 服务器信息
ServerInfo serverinfo = serverInfoDao.getServerinfo(String.valueOf(v.getServerId()));
ServerInfo serverinfo = serverInfoDao.getServerInfo(String.valueOf(v.getServerId()));
infoVo.setServerId(v.getServerId());
infoVo.setServerName(v.getServerId()+"-"+serverinfo.getName());
// 礼包码信息

View File

@ -8,12 +8,12 @@ import com.jmfy.redisProperties.RedisUserKey;
import com.jmfy.utils.RedisUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
@ -43,19 +43,14 @@ public class ChatInfoController {
}
@RequestMapping(value = "/chatInfoShowByServerAndChannel",method = RequestMethod.GET)
public String chatInfoShowByServerAndChannel(@RequestParam int serverId,@RequestParam int channelId,
long datemin, long datemax, ModelMap map){
public String chatInfoShowByServerAndChannel(@RequestParam int serverId,@RequestParam int channelId, long datemin, long datemax, ModelMap map) throws Exception {
RedisUtil redisUtil = RedisUtil.getInstence();
String key = RedisUserKey.getKey(RedisUserKey.CHAT_INFO_CACHE, String.valueOf(channelId), serverId);
List<String> list = redisUtil.lGet(key, 0, -1);
ServerInfo serverinfo = null;
try {
serverinfo = serverInfoDao.getServerinfo(String.valueOf(serverId));
} catch (Exception e) {
e.printStackTrace();
}
ServerInfo serverinfo = serverInfoDao.getServerInfo(String.valueOf(serverId));
String serverName = serverinfo.getName();
List<ChatRedisEntity> chatInfoList = new ArrayList<>(list.size());
@ -63,6 +58,7 @@ public class ChatInfoController {
ChatRedisEntity chatRedisEntity = gson.fromJson(str, ChatRedisEntity.class);
chatRedisEntity.setServerName(serverName);
if (chatRedisEntity.getTime() > datemin && chatRedisEntity.getTime() < datemax) {
chatRedisEntity.setServerId(String.valueOf(serverId));
chatInfoList.add(chatRedisEntity);
}
}

View File

@ -54,9 +54,6 @@ public class GameTitleController {
*/
@RequestMapping(value = "/toGameTitle",method = RequestMethod.GET)
public String toGameTitle(ModelMap map,Integer type){
if (type == 3) {
return "gameTitle3";
}
try {
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
allServerInfo.add(0,new ServerInfo(0,"全服"));
@ -67,7 +64,6 @@ public class GameTitleController {
switch (type){
case 1: return "gameTitle";
case 2: return "gameTitle2";
case 3: return "gameTitle3";
default:break;
}
return "";

View File

@ -37,8 +37,6 @@ public class GmController {
private UserInfoDao userInfoDao;
@Resource
private BanFuctionDao banFuctionDao;
@Resource
private SupportController supportController;
@RequestMapping(value = "/sendGm", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody
@ -52,10 +50,10 @@ public class GmController {
recharge();
return 0;
}
// 扶持删除条目
if (cmd.contains("support#remove#")){
// String[] split = cmd.split("#");
// supportController.removeSupportOrderById(Integer.parseInt(split[2]));
// 修改服务器状态 serverstatus#10001#-2
if (cmd.contains("serverstatus")){
String[] split = cmd.split("#");
serverInfoDao.updateServerInfo(split[1],split[2]);
return 0;
}

View File

@ -38,14 +38,12 @@ public class HeFuController {
/**
*
* @param session
* @param map
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/closeServer", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody String closeServer(HttpSession session, ModelMap map, HttpServletRequest request) throws Exception {
public @ResponseBody String closeServer(HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String[] serverIds = parameterMap.get("serverIds").split("#");
List<String> strings = Arrays.asList(serverIds);
@ -339,7 +337,7 @@ public class HeFuController {
String[] serverIds = parameterMap.get("serverIds").split("#");
for (int i = 0; i < serverIds.length; i++) {
String serverId = serverIds[i].trim();
ServerInfo allServerInfo = serverInfoDao.getServerinfo(serverId);
ServerInfo allServerInfo = serverInfoDao.getServerInfo(serverId);
if (allServerInfo == null) {
LOGGER.info("updateServerAdress serverId == null {}", serverId);
continue;

View File

@ -1,6 +1,7 @@
package com.jmfy.controller;
import com.jmfy.dao.UserInfoDao;
import com.jmfy.handler.GMHandler;
import com.jmfy.model.CUserInfo;
import com.jmfy.redisProperties.RedisUserKey;
import com.jmfy.thrift.idl.Result;
@ -82,22 +83,7 @@ public class HttpRequestController {
*/
private String sendGm(String uid, String cmd) throws Exception {
CUserInfo cUserInfo = userInfoDao.findUserInfoById(uid);
String rpcString = RedisUtil.getInstence().getObject(RedisUserKey.LOGIC_SERVER_INFO, String.valueOf(cUserInfo.getServerid()), String.class, -1);
if (null == rpcString) {
return "获取玩家服务器端口失败服务器id错误";
}
String thriftIp = rpcString.split(":")[0];
String thriftPort = rpcString.split(":")[1];
if (thriftIp == null || thriftIp.isEmpty() || null == thriftPort || thriftPort.isEmpty()) {
return "获取玩家服务器端口失败服务器id错误";
}
Result result = RPCClient.gmSend(cmd, thriftIp, thriftPort);
if (result.getResultCode() != 0) {
LOGGER.error("获取战报返回错误,cmd:{},code:{},result:{}",cmd,result.resultCode,result.getResultMsg());
return "游戏服返回战报记录数据结果失败";
}
return result.getResultMsg() == null ? "":result.getResultMsg();
return GMHandler.sendGm(String.valueOf(cUserInfo.getServerid()),cmd);
}
}

View File

@ -1,6 +1,7 @@
package com.jmfy.controller;
import com.jmfy.dao.ServerInfoDao;
import com.jmfy.handler.GMHandler;
import com.jmfy.model.AutoServerSetting;
import com.jmfy.model.CServerOpenTime;
import com.jmfy.model.ServerInfo;
@ -80,10 +81,7 @@ public class ServerInfoController {
*/
@RequestMapping(value = "/findServerInfoNotCache", method = {RequestMethod.POST, RequestMethod.GET})
public String findServerInfoNotCache(ModelMap map) throws Exception {
if (state == 0){
TaskKit.scheduleWithFixedOne(this::refreshCache,0);
}
return findServerInfo(map,0);
return findServerInfo(map,1);
}
/**
@ -109,7 +107,7 @@ public class ServerInfoController {
@PostConstruct
public void onstart(){
// 定时任务延迟1分钟执行每隔俩小时执行一次
TaskKit.scheduleAtFixedRate(this::refreshCache,60,7200,TimeUnit.SECONDS);
TaskKit.scheduleAtFixedRate(this::refreshCache,10,7200,TimeUnit.SECONDS);
}
/**
@ -158,22 +156,10 @@ public class ServerInfoController {
}
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);
// }
// 当前的服务器跨服分组
Integer value = RedisUtil.getInstence().getMapValue(RedisUserKey.SERVER_SPLIT_INFO, "", serverInfo.getServer_id(), Integer.class, -1);
if (value == null){
value = 0;
}
vo.setOldGroupId(value);
// gm跨服分组
vo.setCrossGroupId(getServerGroupId(serverInfo.getServer_id()));
// 游戏服务器跨服分组
vo.setOldGroupId(getGameServerGroupId(serverInfo.getServer_id()));
return vo;
}
@ -187,7 +173,7 @@ 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));
ServerInfo serverInfo = serverInfoDao.getServerInfo(String.valueOf(id));
ServerInfoVo vo = createServerVo(serverInfo, 0);
map.addAttribute("serverInfo", vo);
return "serverInfoEdit";
@ -250,33 +236,47 @@ public class ServerInfoController {
/**
*
* @param serverInfo
* @param vo
* @return
* @throws Exception
*/
@RequestMapping(value = "/serverEdit", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody
int toServerInfoEdit(@RequestBody ServerInfo serverInfo) throws Exception {
ServerInfo info = serverInfoDao.getServerinfo(serverInfo.getServer_id());
// 未运营状态的服务器需要进行清库处理
if (info != null){
// 未运营状态需要清库
int state = ServerStatusEnum.NOT_OPERATE.getId();
if (Integer.parseInt(info.getStatus()) == state && Integer.parseInt(serverInfo.getStatus()) != state){
// 验证自动开服状态
if (AutoServerManager.isOpen()){
return 3;
}
// 清库操作
TaskKit.scheduleWithFixedOne(()->autoServerManager.manualStartServer(info,serverInfo),0);
}else {
// 修改服务器状态
serverInfoDao.updateServerInfo(serverInfo);
}
return 1;
}else {
int serverEdit(@RequestBody ServerInfoVo vo) throws Exception {
ServerInfo info = serverInfoDao.getServerInfo(vo.getServer_id());
// 服务器信息不存在
if (info == null){
return 0;
}
// 修改服务器状态需要关闭自动开服功能
if (info.getStatus().equals(vo.getStatus()) && AutoServerManager.isOpen()){
return 3;
}
// 1. 修改服务器信息
serverInfoDao.updateServerInfo(vo);
// 未运营
int notOperateState = ServerStatusEnum.NOT_OPERATE.getId();
// 2. 当前服务器状态是未运营状态时,会进行敏感数据修正
if (info.getStatusInt() == notOperateState){
// 2.1 修改跨服信息
updateGameGroupId(vo.getServer_id(),vo.getCrossGroupId());
// 2.3 从未运营修改为其他状态时,执行清库操作
if (vo.getStatusInt() != notOperateState){
TaskKit.scheduleWithFixedOne(()->autoServerManager.manualStartServer(vo),0);
}else {
// 修改开服时间
serverInfoDao.updateOpenServerTime(vo.getServer_id(),vo.getOpenTime());
// 重启服务器
GMHandler.sendGm(info.getServer_id(),"reloadserverconfig");
}
}else {
updateGmGroupId(vo.getServer_id(),vo.getCrossGroupId());
}
return 1;
}
/**
@ -286,22 +286,33 @@ public class ServerInfoController {
* @throws Exception
*/
@RequestMapping(value = "/serverListEdit", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody int toServerListEdit(HttpServletRequest request) throws Exception {
public @ResponseBody int serverListEdit(HttpServletRequest request) throws Exception {
// f服务器列表
String serverId = request.getParameter("serverId");
// 校验服务器状态
String[] serverIds = serverId.split(",");
String status = request.getParameter("status");
int crossId = Integer.parseInt(request.getParameter("crossId"));
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;
if (info == null){
LOGGER.error("存在");
LoginController.addQueue("无法在数据库内找到对应的服务器id操作失败服务器id"+id);
continue;
}
// 存在未运行状态的服务器不能批量修改
if (Integer.parseInt(info.getStatus()) == ServerStatusEnum.NOT_OPERATE.getId()){
LoginController.addQueue("无法在数据库内找到对应的服务器id操作失败服务器id"+id);
continue;
}
// 修改服务器信息
serverInfoDao.updateServerInfo(id, status);
// 修改跨服id小于0不做修改
if (crossId > 0){
updateGmGroupId(id,crossId);
}
}
// 修改服务器状态
int status = Integer.parseInt(request.getParameter("status"));
for (String str:serverIds){
serverInfoDao.updateServerInfo(str, status);
}
return 1;
}
@ -342,24 +353,25 @@ public class ServerInfoController {
/**
*
* @param serverInfo
* @param vo
* @return
* @throws Exception
*/
@RequestMapping(value = "/addServer", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody int addServer(@RequestBody ServerInfo serverInfo) throws Exception {
public @ResponseBody int addServer(@RequestBody ServerInfoVo vo) throws Exception {
Map<String, ServerInfo> serverMap = serverInfoDao.getAllServerMap();
int count = serverInfo.getCount();
int count = vo.getCount();
// 批量添加,参数需要做特殊处理
if (count > 0){
// 需要修改的参数
int serverId = Integer.parseInt(serverInfo.getServer_id());
int serverId = Integer.parseInt(vo.getServer_id());
// name模板太初%d服
String named = serverInfo.getName().split("#")[0];
String named = vo.getName().split("#")[0];
// name数值23
int nameNum = Integer.parseInt(serverInfo.getName().split("#")[1]);
int port = Integer.parseInt(serverInfo.getPort());
int coreNum = Integer.parseInt(serverInfo.getCoreName());
int nameNum = Integer.parseInt(vo.getName().split("#")[1]);
int port = Integer.parseInt(vo.getPort());
int coreNum = Integer.parseInt(vo.getCoreName());
int crossGroupId = vo.getCrossGroupId();
for (int i = 0; i < count; i++) {
int i1 = serverId + i;
if (serverMap.get(String.valueOf(i1)) != null){
@ -367,21 +379,25 @@ public class ServerInfoController {
continue;
}
// 重新赋值
serverInfo.set_id(i1);
serverInfo.setServer_id(String.valueOf(i1));
vo.set_id(i1);
vo.setServer_id(String.valueOf(i1));
String name = named.replace("%d", String.valueOf(nameNum + i));
serverInfo.setName(name);
serverInfo.setPort(String.valueOf(port+i));
serverInfo.setCoreName("core"+(coreNum+i));
serverInfoDao.addServerInfo(serverInfo);
vo.setName(name);
vo.setPort(String.valueOf(port+i));
vo.setCoreName("core"+(coreNum+i));
serverInfoDao.addServerInfo(vo);
// 修改默认跨服id
updateGameGroupId(vo.getServer_id(),crossGroupId);
}
// 单独添加
}else {
ServerInfo info = serverMap.get(serverInfo.getServer_id());
ServerInfo info = serverMap.get(vo.getServer_id());
if (info != null){
return 0;
}
serverInfoDao.addServerInfo(serverInfo);
serverInfoDao.addServerInfo(vo);
// 修改默认跨服id
updateGameGroupId(vo.getServer_id(),vo.getCrossGroupId());
}
return 1;
}
@ -418,6 +434,24 @@ public class ServerInfoController {
return 1;
}
/**
*
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/restartServer", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody
int restartServer(HttpServletRequest request) throws Exception {
boolean power = commonManager.verifyPower(request, PowersEnum.RESTART_SERVER_PERMISSIONS);
if (!power){
return 2;
}
String serverId = request.getParameter("serverId");
return autoServerManager.restartServer2(serverId);
}
/**
*
* @throws Exception
@ -512,6 +546,19 @@ public class ServerInfoController {
return groupId;
}
/**
* id
* @param serverId
* @return
*/
public static int getGameServerGroupId(String serverId){
Integer groupId = RedisUtil.getInstence().getMapValue(RedisUserKey.SERVER_SPLIT_INFO, "", serverId, Integer.class, -1);
if (groupId == null){
groupId = 0;
}
return groupId;
}
/**
* gmgm
*/
@ -523,4 +570,24 @@ public class ServerInfoController {
LOGGER.info("同步跨服id完成");
}
}
/**
* id
* @param serverId
* @param groupId
*/
public static void updateGameGroupId(String serverId, int groupId){
RedisUtil.getInstence().putMapEntry(RedisUserKey.SERVER_SPLIT_INFO,"",serverId,String.valueOf(groupId),-1);
// 更新gm信息
updateGmGroupId(serverId,groupId);
}
/**
* gmid
* @param serverId
* @param groupId
*/
public static void updateGmGroupId(String serverId, int groupId){
RedisUtil.getInstence().putMapEntry(RedisUserKey.CROSS_SERVER_GROUP,"",serverId,String.valueOf(groupId),-1);
}
}

View File

@ -19,7 +19,7 @@ public interface ServerInfoDao {
List<gameName> getAllGameInfo() throws Exception;
ServerInfo getServerinfo(String id) throws Exception;
ServerInfo getServerInfo(String id) throws Exception;
void closeServerWhite(String server_id) throws Exception;
@ -31,10 +31,12 @@ public interface ServerInfoDao {
void updateOpenServerTime(CServerOpenTime cServerOpenTime,String serverId) throws Exception;
void updateServerInfo(String server_id, int status) throws Exception;
void updateServerInfo(String server_id, String status) throws Exception;
CServerOpenTime getOpenServerTime(String serverId) throws Exception;
void updateOpenServerTime(String serverId, String openTime) throws Exception;
long getRegisterNum(String server_id) throws Exception;
long getOnlineNum(String server_id);

View File

@ -48,6 +48,13 @@ public interface UserBannedDao {
*/
void insertBannedUser(UserBanned userBanned) throws Exception;
/**
*
* @param userBanned
* @throws Exception
*/
void updateBannedUser(UserBanned userBanned) throws Exception;
/**
*
* @param userBanned

View File

@ -1,5 +1,6 @@
package com.jmfy.dao.impl;
import com.jmfy.controller.ServerInfoController;
import com.jmfy.dao.ServerInfoDao;
import com.jmfy.model.*;
import com.jmfy.redisProperties.RedisUserKey;
@ -30,12 +31,7 @@ public class ServerInfoDaoImpl implements ServerInfoDao {
@Override
public List<ServerInfo> getAllServerInfo() throws Exception {
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
List<ServerInfo> serverInfos = mongoTemplate.find(new Query(), ServerInfo.class);
Map<String, Integer> splitMap = RedisUtil.getInstence().getMap(RedisUserKey.CROSS_SERVER_GROUP, Integer.class, -1);
for (ServerInfo info : serverInfos) {
info.setCrossGroupId(splitMap.getOrDefault(info.getServer_id(),0));
}
return serverInfos;
return mongoTemplate.find(new Query(), ServerInfo.class);
}
@Override
@ -56,13 +52,10 @@ public class ServerInfoDaoImpl implements ServerInfoDao {
}
@Override
public ServerInfo getServerinfo(String serverId) throws Exception {
public ServerInfo getServerInfo(String serverId) throws Exception {
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
Query query = new Query(Criteria.where("server_id").is(String.valueOf(serverId)));
ServerInfo serverInfo = mongoTemplate.findOne(query, ServerInfo.class);
Map<String, Integer> splitMap = RedisUtil.getInstence().getMap(RedisUserKey.CROSS_SERVER_GROUP, Integer.class, -1);
serverInfo.setCrossGroupId(splitMap.getOrDefault(serverId,0));
return serverInfo;
return mongoTemplate.findOne(query, ServerInfo.class);
}
@Override
@ -122,9 +115,6 @@ public class ServerInfoDaoImpl implements ServerInfoDao {
update.set("coreName",serverInfo.getCoreName());
}
// 跨服分组修改
RedisUtil.getInstence().putMapEntry(RedisUserKey.CROSS_SERVER_GROUP,"",serverInfo.getServer_id(),serverInfo.getCrossGroupId(),-1);
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
Query query = new Query(Criteria.where("server_id").is(serverInfo.getServer_id()));
mongoTemplate.updateMulti(query, update, ServerInfo.class);
@ -175,11 +165,11 @@ public class ServerInfoDaoImpl implements ServerInfoDao {
}
@Override
public void updateServerInfo(String server_id, int status) throws Exception {
public void updateServerInfo(String server_id, String status) throws Exception {
Update update = new Update();
update.set("status",status);
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
Query query = new Query(Criteria.where("server_id").is(String.valueOf(server_id)));
Query query = new Query(Criteria.where("server_id").is(server_id));
mongoTemplate.updateMulti(query, update, ServerInfo.class);
}
@ -190,6 +180,15 @@ public class ServerInfoDaoImpl implements ServerInfoDao {
return mongoTemplate.findById(1, CServerOpenTime.class);
}
@Override
public void updateOpenServerTime(String serverId, String openTime) throws Exception {
String dbName = MongoName.getMongoDBName(Integer.valueOf(serverId));
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
Query query = new Query(Criteria.where("_id").is(1));
Update update = new Update();
update.set("open_time",openTime);
mongoTemplate.updateMulti(query, update, CServerOpenTime.class);
}
@Override
public long getRegisterNum(String server_id) throws Exception {

View File

@ -60,6 +60,19 @@ public class UserBannerDaoImpl implements UserBannedDao {
mongoTemplate.insert(userBanned);
}
@Override
public void updateBannedUser(UserBanned userBanned) throws Exception {
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
Query query = new Query(Criteria.where("_id").is(userBanned.getId()));
Update update = new Update();
update.set("bannedExplain",userBanned.getBannedExplain());
update.set("bannedTime",userBanned.getBannedTime());
update.set("updateTime",userBanned.getUpdateTime());
update.set("bannedLastTime",userBanned.getBannedLastTime());
update.set("adminAccount",userBanned.getAdminAccount());
mongoTemplate.updateMulti(query, update, UserBanned.class);
}
@Override
public void deleteBannedUser(UserBanned userBanned) throws Exception {
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);

View File

@ -16,18 +16,20 @@ import com.jmfy.utils.DateUtil;
import com.jmfy.utils.RPCClient;
import com.jmfy.utils.RedisUtil;
import com.jmfy.utils.SeqUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Component
public class GMHandler extends BaseHandler {
private org.slf4j.Logger LOGGER = LoggerFactory.getLogger(GMHandler.class);
private static final Logger LOGGER = LoggerFactory.getLogger(GMHandler.class);
@Resource
private ServerInfoDao serverListDao;
@ -105,9 +107,14 @@ public class GMHandler extends BaseHandler {
jsonBan.put("uid",json.getString("userId"));
jsonBan.put("banTime",json.getString("time"));
jsonBan.put("dsid",json.getString("zoneId"));
int skyEyeType = getSkyEyeType(Integer.parseInt(json.getString("channel")));
int skyEyeType = getSkyEyeType(json.getIntValue("channel"));
jsonBan.put("treat_type",skyEyeType);
jsonBan.put("banReason",json.getString("time"));
HashMap<String, String> reasonMap = new HashMap<>();
reasonMap.put("source",json.getString("source"));
reasonMap.put("content",json.getString("content"));
jsonBan.put("banReason",reasonMap.toString());
jsonBan.put("channel",json.getString("channel"));
jsonBan.put("url",json.getString("extra[url]"));
jsonBan.put("guildId",json.getString("extra[guildId]"));
@ -137,7 +144,7 @@ public class GMHandler extends BaseHandler {
* @throws Exception
*/
private boolean oneUserBanner(CUserInfo coreUserInfo, int serverId, JSONObject json, int type, HttpSession session) throws Exception {
ServerInfo coreServerList = serverListDao.getServerinfo(String.valueOf(coreUserInfo.getServerid()));
ServerInfo coreServerList = serverListDao.getServerInfo(String.valueOf(coreUserInfo.getServerid()));
if (null == coreServerList) {
LOGGER.error("服务器列表为空,serverId:{}", coreUserInfo.getServerid());
return false;
@ -280,27 +287,30 @@ public class GMHandler extends BaseHandler {
*/
private void updateUserBanner(CUserInfo cUser,HttpSession session,JSONObject jsonObject) throws Exception {
int type = jsonObject.getIntValue("treat_type");
// 封禁用户
UserBanned banned = userBannedDao.getUserBannedByBannedType(cUser.getUserId(),type);
switch (type) {
case GMHandler.BANNED_TO_POST:
case GMHandler.BANNED_LOGIN:
// 封禁用户
UserBanned banned = userBannedDao.getUserBannedByBannedType(cUser.getUserId(),type);
// 封禁操作
if (banned == null && session != null){
// 不存在,创建
createBannedUser(cUser, session, jsonObject);
}else {
throw new Exception("该用户已经处于封禁状态,请删除后重新操作");
if (session == null){
throw new Exception("请求超时,请刷新页面后重新操作!");
}
insertOrUpdateBannedUser(cUser, session, jsonObject, banned);
break;
case GMHandler.CANCEL_BANNED_TO_POST:
case GMHandler.CANCEL_BANNED_LOGIN:
// 封禁用户
UserBanned relieve = userBannedDao.getUserBannedByRelieveType(cUser.getUserId(),type);
if (relieve == null){
throw new Exception("封禁用户不存在,解封操作失败!");
// 解封操作
userBannedDao.deleteBannedUser(banned);
break;
case GMHandler.SKYEYE_BAN:
// 天眼操作
int banTime = jsonObject.getIntValue("banTime");
// 封禁时间小于0就是解封
if (banTime <= 0){
userBannedDao.deleteBannedUser(banned);
}else {
userBannedDao.deleteBannedUser(relieve);
insertOrUpdateBannedUser(cUser, session, jsonObject, banned);
}
break;
default:
@ -316,44 +326,54 @@ public class GMHandler extends BaseHandler {
* @return
* @throws Exception
*/
private void createBannedUser(CUserInfo cUser, HttpSession session,JSONObject jsonObject) throws Exception {
UserBanned userBanned = new UserBanned();
// id
userBanned.setId(seqUtils.getSequence("banned_user_id"));
// 服务器id
userBanned.setServerId(cUser.getServerid());
// 用户id
userBanned.setUserId(cUser.getUserId());
// 用户名称
GSUser gsUser = gsUserDao.findUserInfoQuick(cUser.getServerid(), cUser.getUserId());
if (gsUser != null){
userBanned.setUserName(gsUser.getPlayerManager().getNickName());
private void insertOrUpdateBannedUser(CUserInfo cUser, HttpSession session,JSONObject jsonObject,UserBanned banned) throws Exception {
UserBanned userBanned;
String notTime = DateUtil.nowString();
if (banned == null){
// 初始化信息
userBanned = new UserBanned();
userBanned.setId(seqUtils.getSequence("banned_user_id"));
userBanned.setServerId(cUser.getServerid());
userBanned.setUserId(cUser.getUserId());
// 用户名称
GSUser gsUser = gsUserDao.findUserInfoQuick(cUser.getServerid(), cUser.getUserId());
if (gsUser != null){
userBanned.setUserName(gsUser.getPlayerManager().getNickName());
}
// 账号id
userBanned.setAccountId(cUser.getOpenId());
// 封禁类型
userBanned.setBannedType(jsonObject.getIntValue("treat_type"));
// 解封类型
int relieve = relieve(jsonObject.getIntValue("treat_type"));
userBanned.setRelieveType(relieve);
// 创建时间
userBanned.setCreateTime(notTime);
}else {
userBanned = banned;
}
// 账号id
userBanned.setAccountId(cUser.getOpenId());
// 操作人,gm账号
String useName = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
if (useName != null){
userBanned.setAdminAccount(useName);
String rootName = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
if (rootName != null){
userBanned.setAdminAccount(rootName);
}
// 封禁类型
int type = jsonObject.getIntValue("treat_type");
userBanned.setBannedType(type);
// 封禁说明
String banReason = jsonObject.getString("banReason");
userBanned.setBannedExplain(banReason);
userBanned.setBannedExplain(jsonObject.getString("banReason"));
// 封禁时间,秒
int time = jsonObject.getIntValue("banTime");
userBanned.setBannedTime(time);
// 创建时间
userBanned.setCreateTime(DateUtil.nowString());
// 修改时间
userBanned.setUpdateTime(notTime);
// 封禁结束时间
String last = DateUtil.stampToTime(time*1000 + DateUtil.now());
userBanned.setBannedLastTime(last);
// 解封类型
userBanned.setRelieveType(relieve(type));
// 入库
userBannedDao.insertBannedUser(userBanned);
if (banned == null){
userBannedDao.insertBannedUser(userBanned);
}else {
userBannedDao.updateBannedUser(userBanned);
}
}
/**
@ -375,6 +395,24 @@ public class GMHandler extends BaseHandler {
return resultType;
}
public static String sendGm(String serverId, String cmd){
String rpcString = RedisUtil.getInstence().getObject(RedisUserKey.LOGIC_SERVER_INFO, serverId, String.class, -1);
if (null == rpcString) {
return "获取玩家服务器端口失败服务器id错误";
}
String thriftIp = rpcString.split(":")[0];
String thriftPort = rpcString.split(":")[1];
if (thriftIp == null || thriftIp.isEmpty() || null == thriftPort || thriftPort.isEmpty()) {
return "获取玩家服务器端口失败服务器id错误";
}
Result result = RPCClient.gmSend(cmd, thriftIp, thriftPort);
if (result.getResultCode() != 0) {
LOGGER.error("游戏服返回信息错误,cmd:{},code:{},result:{}",cmd,result.resultCode,result.getResultMsg());
return "游戏服返回信息错误";
}
return result.getResultMsg() == null ? "":result.getResultMsg();
}
@Override
public String getRequestURI() {
return "gm";

View File

@ -1,7 +1,6 @@
package com.jmfy.model;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
@ -77,18 +76,6 @@ public class ServerInfo implements Comparable,Cloneable {
@Field(value = "open_time")
private String open_time;
/**
* idredismongo
*/
@Transient
private int crossGroupId;
/**
* 使
*/
@Transient
private int count;
public ServerInfo(int _id, String name) {
this._id = _id;
this.server_id = String.valueOf(_id);
@ -158,6 +145,10 @@ public class ServerInfo implements Comparable,Cloneable {
return status;
}
public int getStatusInt() {
return Integer.parseInt(status);
}
public void setStatus(String status) {
this.status = status;
}
@ -222,22 +213,6 @@ public class ServerInfo implements Comparable,Cloneable {
this.open_time = open_time;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public int getCrossGroupId() {
return crossGroupId;
}
public void setCrossGroupId(int crossGroupId) {
this.crossGroupId = crossGroupId;
}
@Override
public String toString() {
return "ServerInfo{" +
@ -257,8 +232,6 @@ public class ServerInfo implements Comparable,Cloneable {
", server_version=" + server_version +
", open_type='" + open_type + '\'' +
", open_time='" + open_time + '\'' +
", crossGroupId=" + crossGroupId +
", count=" + count +
'}';
}

View File

@ -39,6 +39,11 @@ public class UserBanned {
*/
@Field(value = "createTime")
private String createTime;
/**
*
*/
@Field(value = "updateTime")
private String updateTime;
/**
*
*/
@ -71,12 +76,8 @@ public class UserBanned {
private int relieveType;
public String getBannedTypeStr(){
return str(bannedType);
}
public String str(int type){
String string = "";
switch (type){
switch (bannedType){
case GMHandler.BANNED_TO_POST:
string = "禁言";
break;
@ -86,7 +87,19 @@ public class UserBanned {
case GMHandler.SKYEYE_BAN:
string = "天眼禁言";
break;
default:break;
default:break;
}
return string;
}
public String getLastTimeVo(){
String string = bannedLastTime;
switch (bannedType){
case GMHandler.BANNED_TO_POST:
case GMHandler.BANNED_LOGIN:
string = "永久";
break;
default:break;
}
return string;
}
@ -96,21 +109,6 @@ public class UserBanned {
public UserBanned() {
}
public UserBanned(int id, int serverId, int userId, String accountId, String userName, String createTime, Integer bannedType, Integer bannedTime, String bannedLastTime, String bannedExplain, String adminAccount,int relieveType) {
this.id = id;
this.serverId = serverId;
this.userId = userId;
this.accountId = accountId;
this.userName = userName;
this.createTime = createTime;
this.bannedType = bannedType;
this.bannedTime = bannedTime;
this.bannedLastTime = bannedLastTime;
this.bannedExplain = bannedExplain;
this.adminAccount = adminAccount;
this.relieveType = relieveType;
}
public int getId() {
return id;
}
@ -206,4 +204,12 @@ public class UserBanned {
public void setRelieveType(int relieveType) {
this.relieveType = relieveType;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -21,17 +21,9 @@ public class ChatRedisEntity {
private String serverName;
public ChatRedisEntity(){};
private String serverId;
public ChatRedisEntity(int uid, String name, int type, String message, Long time, int status, String serverName) {
this.uid = uid;
this.name = name;
this.type = type;
this.message = message;
this.time = time;
this.status = status;
this.serverName = serverName;
}
private String openId;
public int getUid() {
return uid;
@ -88,4 +80,44 @@ public class ChatRedisEntity {
public void setServerName(String serverName) {
this.serverName = serverName;
}
public String getServerId() {
return serverId;
}
public void setServerId(String serverId) {
this.serverId = serverId;
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getTypeStr(){
String result = type+"";
switch (type){
case 0:
result = "系统";
break;
case 1:
result = "世界";
break;
case 2:
result = "公会";
break;
case 3:
result = "好友";
break;
case 4:
result = "跨服";
break;
default:
break;
}
return result;
}
}

View File

@ -22,6 +22,7 @@ public enum PowersEnum {
AUTO_START_SERVER_PERMISSIONS(206,"权限:自动开服配置",200,0,""),
DELETE_SERVER_PERMISSIONS(207,"权限:删除服务器",200,0,""),
TRANSFER_SERVER_PERMISSIONS(208,"迁服",200,1,"/html/transferServer.html"),
RESTART_SERVER_PERMISSIONS(209,"权限:重启服务器",200,0,""),
// 序列号管理300-399
SERIAL_NUMBER_MANAGER(300,"序列号管理",300,1,""),

View File

@ -1,54 +1,76 @@
package com.jmfy.model.vo;
import com.jmfy.controller.ServerInfoController;
import com.jmfy.model.ServerInfo;
import org.springframework.data.annotation.Transient;
public class ServerInfoVo extends ServerInfo {
/**
* ip
*/
@Transient
private String ipAndPort;
/**
*
*/
@Transient
private String openTime;
/**
*
*/
@Transient
private String restartTime;
/**
*
*/
@Transient
private int version;
/**
*
*/
@Transient
private String openType;
/**
*
*/
@Transient
private long registerNum;
/**
* 线
*/
@Transient
private long onlineNum;
/**
*
* 2022-04-26
*/
@Transient
private int gamePortState = -1;
/**
*
* 2022-04-26
*/
@Transient
private int payPortState = -1;
/**
* id
*/
@Transient
private int crossGroupId;
/**
* id
*/
@Transient
private int oldGroupId;
/**
* 使
*/
@Transient
private int count;
public ServerInfoVo(){
}
@ -67,7 +89,6 @@ public class ServerInfoVo extends ServerInfo {
this.setCoreName(serverInfo.getCoreName());
this.setIsWhite(serverInfo.getIsWhite());
this.setServer_version(serverInfo.getServer_version());
this.setCrossGroupId(ServerInfoController.getServerGroupId(getServer_id()));
}
public int getOldGroupId() {
@ -150,6 +171,22 @@ public class ServerInfoVo extends ServerInfo {
this.version = version;
}
public int getCrossGroupId() {
return crossGroupId;
}
public void setCrossGroupId(int crossGroupId) {
this.crossGroupId = crossGroupId;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getGroupShow(){
return getCrossGroupId()+"("+getOldGroupId()+")";
}

View File

@ -42,6 +42,10 @@ public enum ServerStatusEnum {
return id;
}
public String getIdStr() {
return String.valueOf(id);
}
public void setId(int id) {
this.id = id;
}

View File

@ -7,6 +7,7 @@ import com.jmfy.handler.GMHandler;
import com.jmfy.model.AutoServerSetting;
import com.jmfy.model.CServerOpenTime;
import com.jmfy.model.ServerInfo;
import com.jmfy.model.vo.ServerInfoVo;
import com.jmfy.model.vo.ServerStatusEnum;
import com.jmfy.redisProperties.RedisUserKey;
import com.jmfy.thrift.idl.Result;
@ -132,7 +133,7 @@ public class AutoServerManager {
if (serverStatus){
// 旧服务器状态更新
String serverId = String.valueOf(Integer.parseInt(serverInfo.getServer_id()) - 1);
ServerInfo oldServer = serverInfoDao.getServerinfo(serverId);
ServerInfo oldServer = serverInfoDao.getServerInfo(serverId);
updateServer(oldServer, ServerStatusEnum.CROWDING.getId(), 0, serverId);
// 新服务器状态更新
updateServer(serverInfo, ServerStatusEnum.FLUENT.getId(), 1, serverInfo.getServer_id());
@ -200,7 +201,7 @@ public class AutoServerManager {
e.printStackTrace();
}
// 发送钉钉
dingTalkLogic.sendDingTalk(serverInfo,cont,false);
// dingTalkLogic.sendDingTalk(serverInfo,cont,false);
return false;
}
@ -223,25 +224,70 @@ public class AutoServerManager {
/**
*
* @param serverInfo
* @param clone
* @param vo
*/
public void manualStartServer(ServerInfo serverInfo, ServerInfo clone){
public void manualStartServer(ServerInfoVo vo){
try {
ServerInfo serverInfo = serverInfoDao.getServerInfo(vo.getServer_id());
// 停服脚本
AutoServerManager.getInstance().delUser(serverInfo);
// 验证
boolean serverStatus = verifyServerStatus(serverInfo);
if (serverStatus){
// 入库
serverInfoDao.updateServerInfo(clone);
LoginController.addQueue("手动开服,服务器:" + clone.getServer_id() +"清库重启完毕");
//修改开服时间
if (DateUtil.verifyDateStrFormat(vo.getOpenTime())){
// 修改开服时间
serverInfoDao.updateOpenServerTime(vo.getServer_id(),vo.getOpenTime());
// 重启服务器
restartServer2(serverInfo.getServer_id());
}
}else {
// 服务器状态校验失败后将状态改回未运营
serverInfoDao.updateServerInfo(vo.getServer_id(),ServerStatusEnum.NOT_OPERATE.getIdStr());
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*
* @param serverId
* @return
* @throws Exception
*/
public int restartServer2(String serverId) throws Exception {
ServerInfo serverInfo = serverInfoDao.getServerInfo(serverId);
if (serverInfo == null){
return 0;
}
if (StringUtil.isEmpty(serverInfo.getIp()) || StringUtil.isEmpty(serverInfo.getCoreName())) {
LOGGER.error("重启命令操作参数不全,执行失败:参数:{}", serverInfo.toString());
return 0;
}
String command = "ansible "+ serverInfo.getIp() +" -m shell -a \"supervisorctl restart "+ serverInfo.getCoreName() +"\"";
LOGGER.info("重启命令:{}", command);
int result = 0;
Process exec = null;
try {
exec = Runtime.getRuntime().exec(command);
AutoServerManager.readProcessOutput(exec);
LOGGER.info("===========================重启脚本执行结果结束");
exec.waitFor();
result = 1;
} catch (Exception e) {
e.printStackTrace();
} finally {
if (exec != null) {
exec.destroy();
}
}
return result;
}
/**
*
*

View File

@ -1,5 +1,8 @@
package com.jmfy.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@ -12,7 +15,7 @@ import java.util.Date;
* @author hj
*/
public class DateUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(DateUtil.class);
/**
*
*/
@ -39,6 +42,18 @@ public class DateUtil {
return format1.parse(time);
}
public static boolean verifyDateStrFormat(String time){
boolean result = false;
try {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
format.parse(time);
result = true;
}catch (Exception e){
LOGGER.error("时间格式校验失败:{}",e.getMessage());
}
return result;
}
/**
*
* @param stamp

View File

@ -167,6 +167,15 @@
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2" title="跨服id" style="cursor:pointer">
<span class="c-green">跨服id</span>
</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="number" name="crossId" style="width: 200px;" value="0" class="input-text"/>
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2" title="非批量添加不要修改" style="cursor:pointer">
<span class="c-green">数量:</span>
@ -229,6 +238,7 @@
var coreName = $("input[name='coreName']").val();
var server_version = $("input[name='server_version']").val();
var isWhite = $("input[name='isWhite']").val();
var crossId = $("input[name='crossId']").val();
var count = $("input[name='count']").val();
var reg = new RegExp(/[\s\S]/i);
@ -260,6 +270,7 @@
"isWhite":isWhite,
"open_time":"0",
"open_type":"0",
"crossGroupId":crossId,
"count":count
}),
url: "/addServer",

View File

@ -39,7 +39,7 @@
<th width="100">角色id</th>
<th width="100">账号id</th>
<th width="100">封禁类型</th>
<th width="100">封禁时间(秒)</th>
<th width="100">封禁结束时间</th>
<th width="100">封禁说明</th>
<th width="100">操作人员</th>
<th width="100">操作</th>
@ -53,7 +53,7 @@
<td th:text="${obj.userId}" style="text-align: center;"></td>
<td th:text="${obj.accountId}" style="text-align: center;"></td>
<td th:text="${obj.getBannedTypeStr()}" style="text-align: center;"></td>
<td th:text="${obj.bannedTime}" style="text-align: center;"></td>
<td th:text="${obj.getLastTimeVo()}" style="text-align: center;"></td>
<td th:text="${obj.bannedExplain}" style="text-align: center;"></td>
<td th:text="${obj.adminAccount}" style="text-align: center;"></td>
<th style="text-align: center;">

View File

@ -63,8 +63,10 @@
<tr class="text-c">
<!--<th width="25"><input type="checkbox" name="" value=""/></th>-->
<th width="40">玩家角色id</th>
<th width="60">玩家账号id</th>
<th width="60">玩家名称</th>
<th width="40">服务器</th>
<th width="40">服务器ID</th>
<th width="40">服务器名称</th>
<th width="20">聊天类型</th>
<th width="100">聊天内容</th>
<th width="25">发送时间</th>
@ -76,9 +78,11 @@
<tr th:each="obj:${chatInfoList}">
<!--<td><input type="checkbox" value="" name=""/></td>-->
<td th:text="${obj.uid}" style="text-align: center;"></td>
<td th:text="${obj.getOpenId()}" style="text-align: center;"></td>
<td th:text="${obj.name}" style="text-align: center;"></td>
<td th:text="${obj.serverId}" style="text-align: center;"></td>
<td th:text="${obj.serverName}" style="text-align: center;"></td>
<td th:text="${obj.type}" style="text-align: center;"></td>
<td th:text="${obj.getTypeStr()}" style="text-align: center;"></td>
<td th:text="${obj.message}" style="text-align: center;"></td>
<td th:text="${#dates.format(obj.time,'yyyy-MM-dd HH:mm:ss')}" style="text-align: center;"></td>
<th th:switch="${obj.status}" style="text-align: center;">
@ -86,10 +90,8 @@
<span th:case="1" >被禁言</span>
</th>
<td class="cat-not" style="text-align: center;">
<button style="margin-left: 5px;padding: 3px 5px 3px 5px;" type="button" onclick="jinyan()">删除</button>
<button style="margin-left: 5px;padding: 3px 5px 3px 5px;" type="button" onclick="jinyan()">禁言</button>
<button style="margin-left: 5px;padding: 3px 5px 3px 5px;" type="button" onclick="jinyan()">封禁</button>
<button style="margin-left: 5px;padding: 3px 5px 3px 5px;" type="button" onclick="jinyan()">设备封禁</button>
<button style="margin-left: 5px;padding: 3px 5px 3px 5px;" type="button" onclick="no2()">删除</button>
<button style="margin-left: 5px;padding: 3px 5px 3px 5px;" th:attr="serverId=${obj.serverId}, openId=${obj.getOpenId()}, message=${obj.message}" type="button" onclick="dontTalk(this)">禁言</button>
</td>
</tr>
</tbody>
@ -109,7 +111,40 @@
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
function jinyan(){
function isNumber(num) {
return /^[0-9]+.?[0-9]*$/.test(num)
}
// 禁言
function dontTalk(obj) {
var serverId = $(obj).attr("serverId");
var openId = $(obj).attr("openId");
var message = $(obj).attr("message");
$.ajax({
type: "POST",
data: {
"dsid": serverId,
"uid": openId,
"treat_type": 1,
"banTime": 1,
"banReason": message
},
url: "/backC",
success: function (data) {
if (data === 1) {
alert("操作成功");
}
if (data === 0) {
alert("操作失败");
}
}
}
)
}
function no2(){
alert("暂未开发,尽情期待!")
}

View File

@ -41,23 +41,23 @@
<!--多选服务器-->
<select name="serverId" class="selectpicker" id="serverId" multiple
data-live-search="true"
data-width="300px"
data-width="260px"
data-actions-box="true">
<option th:each="server:${serverInfos}" th:if="${server.getStatus() != '-2'}" th:value="${server.getServer_id()}"
th:text="${server.getServer_id()}+'-'+${server.getName()}"></option>
</select>
<select name="status2" class="input-text" id="status2" style="width: 200px;"><!--下拉列表-->
<select name="status2" class="input-text" id="status2" title="服务器状态" style="width: 80px;"><!--下拉列表-->
<option value="-999">请选择</option>
<option value="0">关闭</option>
<option value="1">维护</option>
<option value="2">流畅</option>
<option value="3">拥挤</option>
<option value="4">爆满</option>
</select>
<button class="btn btn-primary" type="button" onclick="updateServers()">批量修改服务器状态</button>
<div th:switch="${state}" style="float: right">
缓存状态【<a href="/findServerInfoNotCache" title="缓存状态刷新后不会自动修改,需要重新获取界面">刷新</a>】:
<span th:case="0" class="Hui-iconfont" style="color:green;">检测完成 </span>
<span th:case="1" class="Hui-iconfont" style="color:red">检测中</span>
<input type="number" id="crossId2" style="width: 55px;" title="跨服id" value="0" class="input-text"/>
<button class="btn btn-primary" type="button" onclick="updateServers()">批量修改</button>
<div style="float: right">
刷新服务器缓存:【<a href="/findServerInfoNotCache">刷新</a>
</div>
</div>
<div class="mt-20">
@ -120,8 +120,9 @@
<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">-->
<!--<span class="btn btn-primary radius">设置开服时间</span></i></a>-->
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-secondary" onclick="return restartServer(this)">
<i class="Hui-iconfont"></i> 重启
</button>
</td>
</tr>
</tbody>
@ -177,10 +178,38 @@
window.location.href = '/findServerInfo?quick=0';
}
if (data === 0) {
alert("删除失败");
alert("操作失败");
}
if (data === 2) {
alert("权限不足,无法删除!");
alert("权限不足,操作失败!");
}
}
})
}else {
return false;
}
}
// 删除服务器列表
function restartServer(obj) {
var serverId = $(obj).attr("id");
var msg = "请问是否要重启该服务器:{"+serverId+"},\n\n请确认";
if (confirm(msg) === true) {
$.ajax({
type: "POST",
data: {
"serverId": serverId
},
url: "/restartServer",
success: function (data) {
if (data === 1) {
alert("操作成功");
}
if (data === 0) {
alert("操作失败");
}
if (data === 2) {
alert("权限不足,操作失败!");
}
}
})
@ -193,11 +222,13 @@
function updateServers() {
var serverId = $("#serverId").val().toString();
var status2 = $("#status2").val().toString();
var crossId2 = $("#crossId2").val().toString();
$.ajax({
type: "POST",
data: {
"serverId": serverId,
"status": status2
"serverId" : serverId,
"status": status2,
"crossId" : crossId2
},
url: "/serverListEdit",
success: function (data) {

View File

@ -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="*{getServer_id()}" class="input-text"/>
<input type="text" name="server_id" placeholder="" th:value="*{getServer_id()}" class="input-text" readonly />
</div>
</div>
<div class="row cl">
@ -112,7 +112,6 @@
<option th:value="0">普通</option>
<option th:value="1">新服</option>
</div>
</select>
</div>
</div>
@ -137,6 +136,14 @@
<input type="number" name="groupId" placeholder="<=0表示不进行分组" th:value="*{getCrossGroupId()}" 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="text" name="openTime" placeholder="格式必须为yyyy-MM-dd HH:mm:ss" th:value="*{getOpenTime()}" class="input-text"/>
</div>
</div>
</div>
<div class="row cl">
@ -194,6 +201,7 @@
var is_new = $("#is_new option:selected").val();
var register_state = $("#register_state option:selected").val();
var groupId = $("input[name='groupId']").val();
var openTime = $("input[name='openTime']").val();;
$.ajax({
type: "POST",
data:
@ -206,8 +214,8 @@
"status": status,
"is_new": is_new,
"register_state": register_state,
"crossGroupId": groupId
"crossGroupId": groupId,
"openTime" : openTime
}),
url: "/serverEdit",
dataType: "json",
@ -215,7 +223,7 @@
success: function (data) {
if (data === 1) {
layer.msg('修改成功!', {icon: 6, time: 1000});
window.location.href="/findServerInfo?quick=0";
window.location.href="/findServerInfo?quick=1";
}
if (data === 0) {
alert("修改失败");

View File

@ -27,9 +27,20 @@
</div>
<div style="margin-left: 20px;font-size: 18px">
<div>
<h2 style="color: red" class="f-18">更新日志[2022-4-26]</h2>
<h2 style="color: red" class="f-18">更新日志[2022-5-10]</h2>
<p class="f-14" style="line-height:32px;">
1、服务器列表小优化删除部分无用列表
1、封禁列表显示字段优化<br>
2、封禁列表添加天眼封禁显示<br>
3、服务器列表添加重启按钮<br>
4、服务器修改信息添加开服时间字段<br>
5、<span style="color: red">必看</span>:服务器处于<span style="color: red">未运营</span>状态时修改服务器的跨服id和开服时间会立刻生效其他状态时修改会延迟生效具体生效时间根据功能不同来定<br>
ps跨服id每周一零点更新开服时间于服务器重启后更新<br>
6、聊天管理界面添加封禁功能删除功能暂未完成需注意封禁功能对于没有显示账号id的玩家无法封禁请前往封禁列表自行操作更新后的内容都会包含有账号id<br>
7、添加重启服务器功能权限
</p>
<h2 style="color: red" class="f-18">更新日志[2022-5-7]</h2>
<p class="f-14" style="line-height:32px;">
1、优化封禁列表显示功能添加天眼功能的封禁信息
</p>
</div>
</div>