master
duhui 2023-01-05 15:26:12 +08:00
parent b8651bce8c
commit af392ab184
11 changed files with 124 additions and 66 deletions

View File

@ -336,25 +336,26 @@ public class LoginController {
public String findMemberList(ModelMap map,HttpSession session) throws Exception {
List<CAdmin> adminList = new ArrayList<>();
String account = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
CAdmin admin = cUserDao.findAdmin(account);
if (admin == null){
throw new Exception("当前账户无法在数据库中查到,请联系管理员");
}
// root账号可以查看全部用户
if (ROOT.equals(account)){
if (admin.getIdentity() == IdentityEnum.SYSTEM_ADMIN.getId()){
adminList = cUserDao.findAdminList();
}
else {
CAdmin admin = cUserDao.findAdmin(account);
if (admin != null){
// 查找账号,获取子账号列表
Iterator<String> iterator = admin.getSubAccount().iterator();
while (iterator.hasNext()){
String next = iterator.next();
CAdmin admin1 = cUserDao.findAdmin(next);
// 找不到的删除,可能是被root账号删掉了
if (admin1 == null){
iterator.remove();
continue;
}
adminList.add(admin1);
// 查找账号,获取子账号列表
Iterator<String> iterator = admin.getSubAccount().iterator();
while (iterator.hasNext()){
String next = iterator.next();
CAdmin admin1 = cUserDao.findAdmin(next);
// 找不到的删除,可能是被root账号删掉了
if (admin1 == null){
iterator.remove();
continue;
}
adminList.add(admin1);
}
}
map.addAttribute("adminList",adminList);
@ -388,7 +389,7 @@ public class LoginController {
return 2;
}
// 非root账号操作
if (!ROOT.equals(userName)){
if (cAdmin.getIdentity() != IdentityEnum.SYSTEM_ADMIN.getId()){
if (!cAdmin.getSubAccount().contains(adminById.getUserName())){
return 2;
}
@ -422,7 +423,7 @@ public class LoginController {
}
// 系统管理员账号不允许修改权限,默认拥有全部权限
if (cAdmin.getUserName().equals(ROOT)){
if (cAdmin.getIdentity() == IdentityEnum.SYSTEM_ADMIN.getId()){
return 2;
}
@ -457,7 +458,7 @@ public class LoginController {
return 0;
}
// 系统管理员账号不允许修改权限,默认拥有全部权限
if (cAdmin.getUserName().equals(ROOT)){
if (cAdmin.getIdentity() == IdentityEnum.SYSTEM_ADMIN.getId()){
return 2;
}
TreeSet<String> set = new TreeSet<>();
@ -534,8 +535,33 @@ public class LoginController {
public @ResponseBody int resetPassword(HttpServletRequest request) throws Exception{
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String id = parameterMap.get("id");
String pwd = parameterMap.get("pwd");
CAdmin admin = cUserDao.findAdminById(id);
admin.setPassword("123456");
if (admin.getIdentity() == IdentityEnum.SYSTEM_ADMIN.getId()){
return 0;
}
admin.setPassword(pwd);
cUserDao.updateUser(admin);
return 1;
}
/**
*
* @param request
* @return
* 1:
* @throws Exception
*/
@RequestMapping(value = "/resetMyPwd",method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody int resetMyPwd(HttpSession session, HttpServletRequest request) throws Exception{
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String pwd = parameterMap.get("pwd");
String account = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
CAdmin admin = cUserDao.findAdmin(account);
if (admin.getIdentity() == IdentityEnum.SYSTEM_ADMIN.getId()){
return 0;
}
admin.setPassword(pwd);
cUserDao.updateUser(admin);
return 1;
}

View File

@ -25,7 +25,6 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@ -235,28 +234,24 @@ public class ServerInfoController {
if (info == null){
return 0;
}
// 验证时间格式
boolean format = DateUtil.verifyDateStrFormat(vo.getOpenTime());
if (!format){
return 0;
}
// boolean format = DateUtil.verifyDateStrFormat(vo.getOpenTime());
// if (!format){
// return 0;
// }
// 1. 修改服务器信息
serverInfoDao.updateServerInfo(vo);
// 未运营
int notOperateState = ServerStatusEnum.NOT_OPERATE.getId();
int notState = ServerStatusEnum.NOT_OPERATE.getId();
// 2. 当前服务器状态是未运营状态时,会进行敏感数据修正
if (info.getStatusInt() == notOperateState){
if (info.getStatusInt() == notState){
// 2.1 修改跨服信息
RedisLogic.updateGameGroupId(vo.getServer_id(),vo.getCrossGroupId());
// 2.2 修改开服时间
serverInfoDao.updateOpenServerTime(vo.getServer_id(),vo.getOpenTime());
// 重启服务器
GMHandler.sendGm(info.getServer_id(),"reloadserverconfig");
autoServerManager.restartServer2(info.getServer_id());
// serverInfoDao.updateOpenServerTime(vo.getServer_id(),vo.getOpenTime());
// GMHandler.sendGm(info.getServer_id(),"reloadserverconfig");
autoServerManager.rebootServer(info.getServer_id());
}else {
RedisLogic.updateGmGroupId(vo.getServer_id(),vo.getCrossGroupId());
}
@ -511,7 +506,7 @@ public class ServerInfoController {
}
String serverId = request.getParameter("serverId");
return autoServerManager.restartServer2(serverId);
return autoServerManager.rebootServer(serverId);
}
/**

View File

@ -119,7 +119,7 @@ public enum PowersEnum {
*
*/
GAME_MANAGER(1400,"游戏管理",1400,1,""),
PACKAGE_NAME_MANAGER(1401,"频道管理(公告用)",1400,1,"packageInfoList"),
PACKAGE_NAME_MANAGER(1401,"公告频道Id管理",1400,1,"packageInfoList"),
ADD_PACKAGE_NAME(1402,"权限: 添加频道",1400,0,""),
DELETE_PACKAGE_NAME(1403,"权限: 删除频道",1400,0,""),

View File

@ -3,14 +3,12 @@ package com.jmfy.utils;
import com.jmfy.controller.LoginController;
import com.jmfy.dao.ServerInfoDao;
import com.jmfy.handler.DingTalkLogic;
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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@ -18,11 +16,8 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @Author hj
@ -220,12 +215,12 @@ public class AutoServerManager {
boolean serverStatus = verifyServerStatus(serverInfo);
if (serverStatus){
//修改开服时间
if (DateUtil.verifyDateStrFormat(vo.getOpenTime())){
// 修改开服时间
serverInfoDao.updateOpenServerTime(vo.getServer_id(),vo.getOpenTime());
// 重启服务器
restartServer2(serverInfo.getServer_id());
}
// if (DateUtil.verifyDateStrFormat(vo.getOpenTime())){
// // 修改开服时间
//// serverInfoDao.updateOpenServerTime(vo.getServer_id(),vo.getOpenTime());
// }
// 重启服务器
rebootServer(serverInfo.getServer_id());
}else {
// 服务器状态校验失败后将状态改回未运营
serverInfoDao.updateServerInfo(vo.getServer_id(),ServerStatusEnum.NOT_OPERATE.getIdStr());
@ -241,7 +236,7 @@ public class AutoServerManager {
* @return
* @throws Exception
*/
public int restartServer2(String serverId) throws Exception {
public int rebootServer(String serverId) throws Exception {
ServerInfo serverInfo = serverInfoDao.getServerInfo(serverId);
if (serverInfo == null){
return 0;

View File

@ -101,10 +101,10 @@
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-warning radius" onclick="return deleteServer(this)">
删除
</button>
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-warning radius" onclick="return restartServer(this)">
<button type="button" th:id="${obj.getServer_id()}" th:attr="status=${obj.getStatusInt()}" onclick="return restartServer(this)" class="btn btn-warning radius">
重启
</button>
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-danger radius" onclick="return cleanupServer(this)">
<button type="button" th:id="${obj.getServer_id()}" th:attr="status=${obj.getStatusInt()}" onclick="return cleanupServer(this)" class="btn btn-danger radius">
清库
</button>
</td>
@ -243,6 +243,11 @@
// 重启服务器列表
function restartServer(obj) {
var serverId = $(obj).attr("id");
var status = $(obj).attr("status");
if (status > 1){
alert("服务器处于对外状态,不能重启");
return false;
}
var msg = "请问是否要重启该服务器:{"+serverId+"},\n\n请确认";
if (confirm(msg) === true) {
$.ajax({
@ -271,7 +276,12 @@
// 删除服务器列表
function cleanupServer(obj) {
var serverId = $(obj).attr("id");
var msg = "只有处于未运营状态的服务器才会执行清库操作,请问是否要清库该服务器:{"+serverId+"},\n\n请确认";
var status = $(obj).attr("status");
if (status != -2){
alert("服务器未处于未运营状态,不能清库");
return false;
}
var msg = "请问是否要清库该服务器:{"+serverId+"},\n\n请确认";
if (confirm(msg) === false) {
return false;
}

View File

@ -18,7 +18,7 @@
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
<script>DD_belatedPNG.fix('*');</script>
<title>游戏管理</title>
<title>游戏协议管理</title>
</head>
<body>
<nav class="breadcrumb">
@ -29,7 +29,7 @@
href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container" style="text-align: center">
<h2><span style="color:red;">游戏管理</span></h2>
<h2><span style="color:red;">游戏协议管理</span></h2>
<div style="text-align: left">
<button class="btn btn-primary" type="button" id="batch" onclick="updates()">
<i class="Hui-iconfont">&#xe600;</i>新增
@ -43,6 +43,7 @@
<th width="200">包名</th>
<th width="300">使用说明</th>
<th width="300">隐私协议</th>
<th width="300">操作</th>
</tr>
</thead>
<tbody>

View File

@ -50,6 +50,7 @@
<ul class="dropDown-menu menu radius box-shadow">
<!--<li><a href="javascript:;" onClick="myselfinfo()">个人信息</a></li>-->
<li><a href="/logout">切换账户</a></li>
<li><a href="" onclick="resetMyPwd()">修改密码</a></li>
<li><a href="/logout">退出</a></li>
</ul>
</li>
@ -198,6 +199,30 @@
)
}
function resetMyPwd() {
var ret = prompt('请输入新的密码', 123456);
if (ret !== null && ret != '') {
$.ajax({
type: 'POST',
url: "/resetMyPwd",
data: {
"pwd": ret
},
dataType: 'json',
success: function (data) {
if (data === 1) {
alert('修改成功!');
location.reload();
} else {
alert('修改失败!');
}
}
});
} else {
return false;
}
}
</script>
</body>

View File

@ -103,13 +103,14 @@
// 修改密码
function resetPassword(obj) {
var id = $(obj).attr("id");
var msg = "您真的确定要重置密码为123456吗\n\n请确认";
if (confirm(msg) === true) {
var ret = prompt('请输入新的密码', 123456);
if (ret !== null && ret != '') {
$.ajax({
type: 'POST',
url: "/resetPassword",
data: {
"id": id
"id": id,
"pwd": ret
},
dataType: 'json',
success: function (data) {

View File

@ -31,7 +31,7 @@
<div class="page-container" style="text-align: center">
<h2><span style="color:red;">频道管理</span></h2>
<div style="text-align: left">
<input type="text" name="packageName" id="packageName" placeholder="多个包名用#号分割" value="" class="input-text"
<input type="text" name="packageName" id="packageName" placeholder="多个pid用#号分割" value="" class="input-text"
style="width: 300px;"/>
<button class="btn btn-primary" type="button" id="batch" onclick="addPackageName()">添加频道</button>
</div>
@ -40,7 +40,7 @@
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
<thead>
<tr class="text-c" style="width: 300px;">
<th width="200">包名</th>
<th width="200">频道id</th>
<th width="100">操作</th>
</tr>
</thead>

View File

@ -134,15 +134,15 @@
<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" title="未运营状态下修改立刻生效,其他状态修改不生效">
<span class="c-red">* 开服时间:</span>
</label>
<div class="formControls col-xs-8 col-sm-9">
<input th:if="*{getStatus().equals('-2')}" type="text" name="openTime" placeholder="格式必须为yyyy-MM-dd HH:mm:ss" th:value="*{getOpenTime()}" class="input-text" />
<input th:if="*{!getStatus().equals('-2')}" type="text" name="openTime" placeholder="格式必须为yyyy-MM-dd HH:mm:ss" th:value="*{getOpenTime()}" class="input-text" readonly style="background-color: #c3c3c3" />
</div>
</div>
<!-- <div class="row cl">-->
<!-- <label class="form-label col-xs-4 col-sm-2" title="未运营状态下修改立刻生效,其他状态修改不生效">-->
<!-- <span class="c-red">* 开服时间:</span>-->
<!-- </label>-->
<!-- <div class="formControls col-xs-8 col-sm-9">-->
<!-- <input th:if="*{getStatus().equals('-2')}" type="text" name="openTime" placeholder="格式必须为yyyy-MM-dd HH:mm:ss" th:value="*{getOpenTime()}" class="input-text" />-->
<!-- <input th:if="*{!getStatus().equals('-2')}" type="text" name="openTime" placeholder="格式必须为yyyy-MM-dd HH:mm:ss" th:value="*{getOpenTime()}" class="input-text" readonly style="background-color: #c3c3c3" />-->
<!-- </div>-->
<!-- </div>-->
</div>
<div class="row cl">
@ -200,7 +200,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();
var openTime = "";
$.ajax({
type: "POST",
data:

View File

@ -1,5 +1,10 @@
## 更新日志
+ ### 2023-1-5
1. 添加用户修改自定义密码功能
2. 修改部分页签标题
3. 服务器信息不再允许修改开服时间
+ ### 2022-12-8
1. 返利活动新增开服累充类型活动
2. 活动返利添加界面:服务器类型新增”全部“类型,选中后全部服务器可用,包括之后开启得服务器