master
duhui 2021-11-09 14:57:54 +08:00
parent 20e9346d4f
commit 0d63b09da6
6 changed files with 70 additions and 47 deletions

View File

@ -40,7 +40,6 @@ public class WebSecurityConfig extends WebMvcConfigurerAdapter{
addInterceptor.excludePathPatterns("/error");
addInterceptor.excludePathPatterns("/login**");
addInterceptor.excludePathPatterns("/req/**");
addInterceptor.excludePathPatterns("/webGetChannelInfo**");
addInterceptor.addPathPatterns("/**");
}

View File

@ -22,6 +22,7 @@ import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
@ -38,6 +39,8 @@ public class ServerInfoController {
@Resource
private AutoServerManager autoServerManager;
private static int state = 0;
/**
*
*/
@ -48,6 +51,7 @@ public class ServerInfoController {
* value [0]: [1]:
*/
private static ExpiryMap<String,int[]> portStatusMap = new ExpiryMap<>();
/**
*
* @param map
@ -55,14 +59,9 @@ public class ServerInfoController {
* @throws Exception
*/
@RequestMapping(value = "/findServerInfo", method = {RequestMethod.POST, RequestMethod.GET})
public String loginVerify(ModelMap map, int quick) throws Exception {
List<ServerInfo> serverInfos = serverInfoDao.getAllServerInfo();
public String findServerInfo(ModelMap map, int quick) throws Exception {
List<ServerInfoVo> serverInfoVos = new ArrayList<>();
// 端口验证
if (quick == 1){
// 更新端口状态
portListenHandler();
}
List<ServerInfo> serverInfos = serverInfoDao.getAllServerInfo();
for (ServerInfo serverInfo : serverInfos) {
if (null == serverInfo.getServer_id()) {
continue;
@ -71,12 +70,44 @@ public class ServerInfoController {
serverInfoVos.add(serverInfoVo);
}
map.addAttribute("serverInfos", serverInfoVos);
map.addAttribute("state", state);
return "findServerInfo";
}
/**
*
* @param map
* @return
*/
@RequestMapping(value = "/findServerInfoNotCache", method = {RequestMethod.POST, RequestMethod.GET})
public String findServerInfoNotCache(ModelMap map) throws Exception {
TaskKit.scheduleWithFixedOne(this::refreshCache,0);
return findServerInfo(map,0);
}
/**
*
*/
private void refreshCache(){
state = 1;
try {
// 更新全部服务器得信息
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
for (ServerInfo info : allServerInfo) {
getServerOpenTime(info.getServer_id(),1);
}
// 更新端口信息
portListenHandler();
} catch (Exception e) {
e.printStackTrace();
}
state = 0;
}
@PostConstruct
public void onstart(){
TaskKit.scheduleAtFixedRate(this::portListenHandler,60*30);
// 定时任务延迟1分钟执行每隔俩小时执行一次
TaskKit.scheduleAtFixedRate(this::refreshCache,60,7200,TimeUnit.SECONDS);
}
/**

View File

@ -67,12 +67,7 @@ public class GMHandler extends BaseHandler {
/**
*
*/
public static final int SKYEYE_BAN = 7;
/**
*
*/
public static final int CANCEL_SKYEYE_BAN = 8;
public static final int SKYEYE_BAN = 11;
/**
*
*/
@ -182,23 +177,19 @@ public class GMHandler extends BaseHandler {
/**
*
* 91011
* @param channel
* @return
*/
private int getSkyEyeType(int channel){
int result = 0;
int result;
switch (channel){
case 1:
case 2:
case 3:
case 4:
result = 7;
break;
case 9:
case 10:
case GMHandler.RESET_GUILD_NAME:
case GMHandler.RESET_GUILD_ANNOUNCEMENT:
result = channel;
break;
default:
result = GMHandler.SKYEYE_BAN;
break;
}
return result;
@ -240,18 +231,18 @@ public class GMHandler extends BaseHandler {
}
break;
case SKYEYE_BAN:
// 天眼用户禁言
String banTime = Optional.ofNullable(jsonObject.getString("banTime")).orElse("0");
cmd = getCmdContent("skyeye",coreUserInfo.getUserId(),SKYEYE_BAN,banTime);
break;
case CANCEL_SKYEYE_BAN:
cmd = getCmdContent("skyeye",coreUserInfo.getUserId(),CANCEL_SKYEYE_BAN,0);
break;
case RESET_GUILD_NAME:
// 天眼,公会名重置
String banTime1 = jsonObject.getString("banTime");
String guildId = jsonObject.getString("guildId");
cmd = getCmdContent("skyeye",coreUserInfo.getUserId(),RESET_GUILD_NAME,banTime1,guildId);
break;
case RESET_GUILD_ANNOUNCEMENT:
// 天眼 公会宣言重置
String banTime2 = jsonObject.getString("banTime");
String guildId2 = jsonObject.getString("guildId");
cmd = getCmdContent("skyeye",coreUserInfo.getUserId(),RESET_GUILD_ANNOUNCEMENT,banTime2,guildId2);
@ -290,12 +281,6 @@ public class GMHandler extends BaseHandler {
private void updateUserBanner(CUserInfo cUser,HttpSession session,JSONObject jsonObject) throws Exception {
int type = jsonObject.getIntValue("treat_type");
switch (type) {
case GMHandler.SKYEYE_BAN:
UserBanned skyeyebanned = userBannedDao.getUserBannedByBannedType(cUser.getUserId(),type);
if(skyeyebanned != null){
return;
}
break;
case GMHandler.BANNED_TO_POST:
case GMHandler.BANNED_LOGIN:
// 封禁用户
@ -308,7 +293,6 @@ public class GMHandler extends BaseHandler {
throw new Exception("该用户已经处于封禁状态,请删除后重新操作");
}
break;
case GMHandler.CANCEL_SKYEYE_BAN:
case GMHandler.CANCEL_BANNED_TO_POST:
case GMHandler.CANCEL_BANNED_LOGIN:
// 封禁用户
@ -386,9 +370,6 @@ public class GMHandler extends BaseHandler {
case GMHandler.BANNED_LOGIN:
resultType = GMHandler.CANCEL_BANNED_LOGIN;
break;
case GMHandler.SKYEYE_BAN:
resultType = GMHandler.CANCEL_SKYEYE_BAN;
break;
default:break;
}
return resultType;

View File

@ -30,7 +30,7 @@
<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;"
href="javascript:location.replace('/findServerInfo?quick=1');" title="刷新缓存">
href="javascript:location.replace('/findServerInfo?quick=0');" title="刷新">
<i class="Hui-iconfont">&#xe68f;</i>
</a>
</nav>
@ -54,6 +54,11 @@
<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>
</div>
</div>
<div class="mt-20">
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">

View File

@ -23,14 +23,21 @@
</head>
<body>
<div class="page-container">
<h1><p class="f-20 text-success">太初行管理后台</p></h1>
<h1 class="f-20 text-success">太初行管理后台</h1>
</div>
<div style="margin-left: 20px;font-size: 18px">
<p style="color: red">更新日志[2021-11-02]</p>
<p>1、渠道管理添加是否和谐参数</p>
<p>2、天眼公会监控</p>
<p>3、服务器列表使用缓存功能可以使用列表右上角的刷新按钮更新最新数据快速刷新响应较慢勿重复点击请耐心等待</p>
<p>4、订单功能无法使用0秒参数bug修改</p>
<h2 style="color: red" class="f-18">更新日志[2021-11-09]</h2>
<p class="f-16"> 1、天眼封禁优化</p>
<p class="f-16"> 2、服务器列表优化新增缓存刷新按钮</p>
<p class="f-16">
ps{ 开服时间、版本号、上次重启时间、游戏端口状态、支付端口状态 }为缓存数据,可以通过刷新缓存获取最新数据,其他数据没有缓存
<br>
ps缓存刷新为后台执行点击刷新后缓存状态会更改为
<span style="color: red">检测中</span>,前端无法立即获得结果,刷新结果需要重新获取界面信息
<br>
ps想要快速获得数据可以在点击刷新按钮后间隔1-2分钟后点击右上角绿色刷新按钮缓存状态变为
<span style="color: green">检测完成</span>代表是数据刷新成功,为目前最新数据
</p>
</div>
<footer class="footer mt-20">
</footer>