generated from root/miduo_server
gm功能优化和自动开服添加
parent
3215238959
commit
23c33ba8d8
|
|
@ -46,7 +46,7 @@ public class Application extends SpringBootServletInitializer {
|
|||
SHotFixManager sHotFixManager = configurableApplicationContext.getBean(SHotFixManager.class);
|
||||
MinuteTask minuteTask = configurableApplicationContext.getBean(MinuteTask.class);
|
||||
minuteTask.setsHotFixManager(sHotFixManager);
|
||||
scheduledExecutorService.scheduleWithFixedDelay(minuteTask,30,10, TimeUnit.SECONDS);
|
||||
scheduledExecutorService.scheduleWithFixedDelay(minuteTask,30,60, TimeUnit.SECONDS);
|
||||
FileCacheUtils.initData();
|
||||
// SHotFixManager.main(args);
|
||||
// FileCacheUtils.initData();
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ public class ChannelInfoController {
|
|||
@Resource
|
||||
private CUserDao cUserDao;
|
||||
@Resource
|
||||
private CommonManager commonManager;
|
||||
@Resource
|
||||
private SeqUtils seqUtils;
|
||||
|
||||
/**
|
||||
|
|
@ -60,7 +62,7 @@ public class ChannelInfoController {
|
|||
int insertChannelInfo(HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> map = JsonUtil.getInstence().getParameterMap(request);
|
||||
// 验证权限
|
||||
boolean verifyPower = verifyPower(request, PowersEnum.ADD_CHANNEL_PERMISSIONS);
|
||||
boolean verifyPower = commonManager.verifyPower(request, PowersEnum.ADD_CHANNEL_PERMISSIONS);
|
||||
if (!verifyPower){
|
||||
return 2;
|
||||
}
|
||||
|
|
@ -97,7 +99,7 @@ public class ChannelInfoController {
|
|||
int deleteChannelInfo(HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> map = JsonUtil.getInstence().getParameterMap(request);
|
||||
// 验证权限
|
||||
boolean verifyPower = verifyPower(request, PowersEnum.DELETE_CHANNEL_PERMISSIONS);
|
||||
boolean verifyPower = commonManager.verifyPower(request, PowersEnum.DELETE_CHANNEL_PERMISSIONS);
|
||||
if (!verifyPower){
|
||||
return 2;
|
||||
}
|
||||
|
|
@ -115,27 +117,4 @@ public class ChannelInfoController {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证权限
|
||||
* @param request
|
||||
* @param powersEnum
|
||||
* @return
|
||||
*/
|
||||
private boolean verifyPower(HttpServletRequest request, PowersEnum... powersEnum) throws Exception {
|
||||
String username = (String) request.getSession().getAttribute("username");
|
||||
if (username == null){
|
||||
return false;
|
||||
}
|
||||
CAdmin admin = cUserDao.findAdmin(username);
|
||||
if (admin == null){
|
||||
return false;
|
||||
}
|
||||
for (PowersEnum anEnum : powersEnum) {
|
||||
if (!admin.getPowers().contains(anEnum.getId())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.jmfy.controller;
|
||||
|
||||
import com.jmfy.dao.CUserDao;
|
||||
import com.jmfy.model.CAdmin;
|
||||
import com.jmfy.model.vo.PowersEnum;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/8/12 16:34:22
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class CommonManager {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CommonManager.class);
|
||||
|
||||
@Resource
|
||||
private CUserDao cUserDao;
|
||||
|
||||
/**
|
||||
* 验证权限
|
||||
* @param request
|
||||
* @param powersEnum
|
||||
* @return
|
||||
*/
|
||||
public boolean verifyPower(HttpServletRequest request, PowersEnum... powersEnum) throws Exception {
|
||||
String username = (String) request.getSession().getAttribute("username");
|
||||
if (username == null){
|
||||
LOGGER.error("用户不存在,操作失败");
|
||||
return false;
|
||||
}
|
||||
CAdmin admin = cUserDao.findAdmin(username);
|
||||
if (admin == null){
|
||||
LOGGER.error("用户不存在,操作失败");
|
||||
return false;
|
||||
}
|
||||
for (PowersEnum anEnum : powersEnum) {
|
||||
if (!admin.getPowers().contains(anEnum.getId())){
|
||||
LOGGER.error("{}用户没有该项权限:{},操作失败",username,anEnum.getName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
package com.jmfy.controller;
|
||||
|
||||
import com.jmfy.dao.CUserDao;
|
||||
import com.jmfy.dao.GameAgreementDao;
|
||||
import com.jmfy.model.CAdmin;
|
||||
import com.jmfy.model.GameAgreement;
|
||||
import com.jmfy.model.vo.PowersEnum;
|
||||
import com.jmfy.utils.JsonUtil;
|
||||
|
|
@ -31,9 +29,9 @@ public class GameAgreementController {
|
|||
@Resource
|
||||
private GameAgreementDao agreementDao;
|
||||
@Resource
|
||||
private CUserDao cUserDao;
|
||||
@Resource
|
||||
private SeqUtils seqUtils;
|
||||
@Resource
|
||||
private CommonManager commonManager;
|
||||
|
||||
/**
|
||||
* 获取全部列表
|
||||
|
|
@ -62,7 +60,7 @@ public class GameAgreementController {
|
|||
@RequestMapping(value = "/gameAgreementToUpdate", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String gameAgreementToUpdate(ModelMap map, String id, HttpServletRequest request) throws Exception {
|
||||
// 验证权限
|
||||
boolean verifyPower = verifyPower(request, PowersEnum.ADD_GAME_AGREEMENT_PERMISSIONS);
|
||||
boolean verifyPower = commonManager.verifyPower(request, PowersEnum.ADD_GAME_AGREEMENT_PERMISSIONS);
|
||||
if (!verifyPower){
|
||||
throw new Exception("not permissions...");
|
||||
}
|
||||
|
|
@ -83,7 +81,7 @@ public class GameAgreementController {
|
|||
int updateGameAgreement(@RequestBody GameAgreement agreement, HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> map = JsonUtil.getInstence().getParameterMap(request);
|
||||
// 验证权限
|
||||
boolean verifyPower = verifyPower(request, PowersEnum.ADD_PACKAGE_NAME);
|
||||
boolean verifyPower = commonManager.verifyPower(request, PowersEnum.ADD_PACKAGE_NAME);
|
||||
if (!verifyPower){
|
||||
return 2;
|
||||
}
|
||||
|
|
@ -108,7 +106,7 @@ public class GameAgreementController {
|
|||
int deleteGameAgreement(HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> map = JsonUtil.getInstence().getParameterMap(request);
|
||||
// 验证权限
|
||||
boolean verifyPower = verifyPower(request, PowersEnum.DELETE_PACKAGE_NAME);
|
||||
boolean verifyPower = commonManager.verifyPower(request, PowersEnum.DELETE_PACKAGE_NAME);
|
||||
if (!verifyPower){
|
||||
return 2;
|
||||
}
|
||||
|
|
@ -123,27 +121,4 @@ public class GameAgreementController {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证权限
|
||||
* @param request
|
||||
* @param powersEnum
|
||||
* @return
|
||||
*/
|
||||
private boolean verifyPower(HttpServletRequest request, PowersEnum... powersEnum) throws Exception {
|
||||
String username = (String) request.getSession().getAttribute("username");
|
||||
if (username == null){
|
||||
return false;
|
||||
}
|
||||
CAdmin admin = cUserDao.findAdmin(username);
|
||||
if (admin == null){
|
||||
return false;
|
||||
}
|
||||
for (PowersEnum anEnum : powersEnum) {
|
||||
if (!admin.getPowers().contains(anEnum.getId())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public class MailController {
|
|||
Map<Integer, String> itemNameMap = FileCacheUtils.itemNameMap;
|
||||
try {
|
||||
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
|
||||
allServerInfo.removeIf(v->Integer.parseInt(v.getStatus()) <= 0);
|
||||
map.addAttribute("serverInfo",allServerInfo);
|
||||
map.addAttribute("itemNameMap",itemNameMap);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class PackageInfoController {
|
|||
@Resource
|
||||
private PackageInfoDao packageInfoDao;
|
||||
@Resource
|
||||
private CUserDao cUserDao;
|
||||
private CommonManager commonManager;
|
||||
@Resource
|
||||
private SeqUtils seqUtils;
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ public class PackageInfoController {
|
|||
int insertPackageInfo(HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> map = JsonUtil.getInstence().getParameterMap(request);
|
||||
// 验证权限
|
||||
boolean verifyPower = verifyPower(request, PowersEnum.ADD_PACKAGE_NAME);
|
||||
boolean verifyPower = commonManager.verifyPower(request, PowersEnum.ADD_PACKAGE_NAME);
|
||||
if (!verifyPower){
|
||||
return 2;
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ public class PackageInfoController {
|
|||
int deletePackageInfo(HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> map = JsonUtil.getInstence().getParameterMap(request);
|
||||
// 验证权限
|
||||
boolean verifyPower = verifyPower(request, PowersEnum.DELETE_PACKAGE_NAME);
|
||||
boolean verifyPower = commonManager.verifyPower(request, PowersEnum.DELETE_PACKAGE_NAME);
|
||||
if (!verifyPower){
|
||||
return 2;
|
||||
}
|
||||
|
|
@ -123,27 +123,4 @@ public class PackageInfoController {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证权限
|
||||
* @param request
|
||||
* @param powersEnum
|
||||
* @return
|
||||
*/
|
||||
private boolean verifyPower(HttpServletRequest request, PowersEnum... powersEnum) throws Exception {
|
||||
String username = (String) request.getSession().getAttribute("username");
|
||||
if (username == null){
|
||||
return false;
|
||||
}
|
||||
CAdmin admin = cUserDao.findAdmin(username);
|
||||
if (admin == null){
|
||||
return false;
|
||||
}
|
||||
for (PowersEnum anEnum : powersEnum) {
|
||||
if (!admin.getPowers().contains(anEnum.getId())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package com.jmfy.controller;
|
||||
|
||||
import com.jmfy.dao.ServerInfoDao;
|
||||
import com.jmfy.model.AutoServerSetting;
|
||||
import com.jmfy.model.CServerOpenTime;
|
||||
import com.jmfy.model.ServerInfo;
|
||||
import com.jmfy.model.vo.PowersEnum;
|
||||
import com.jmfy.model.vo.ServerInfoVo;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
import com.jmfy.utils.*;
|
||||
|
|
@ -31,7 +33,8 @@ public class ServerInfoController {
|
|||
|
||||
@Resource
|
||||
private ServerInfoDao serverInfoDao;
|
||||
|
||||
@Resource
|
||||
private CommonManager commonManager;
|
||||
@Resource
|
||||
private SeqUtils seqUtils;
|
||||
|
||||
|
|
@ -109,60 +112,36 @@ public class ServerInfoController {
|
|||
|
||||
/**
|
||||
* 修改服务器信息
|
||||
* @param map
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/serverEdit", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String toServerInfoEdit(ModelMap map, HttpServletRequest request) throws Exception {
|
||||
List<ServerInfoVo> serverInfoVos = new ArrayList<>();
|
||||
// 服务器状态
|
||||
int status = Integer.parseInt(request.getParameter("status"));
|
||||
// 名字
|
||||
String name = request.getParameter("name");
|
||||
public @ResponseBody
|
||||
int toServerInfoEdit(HttpServletRequest request) throws Exception {
|
||||
boolean open = AutoServerManager.getInstance().isOpen();
|
||||
if (open){
|
||||
return 3;
|
||||
}
|
||||
// 服务器id
|
||||
String server_id = request.getParameter("server_id");
|
||||
// 名字
|
||||
String name = request.getParameter("name");
|
||||
// 服务器状态
|
||||
int status = Integer.parseInt(request.getParameter("status"));
|
||||
// 新服
|
||||
int isnew = Integer.parseInt(request.getParameter("is_new"));
|
||||
// 开启时间
|
||||
String opentime = request.getParameter("startTime");
|
||||
// 注册状态
|
||||
String register_state = request.getParameter("register_state");
|
||||
|
||||
ServerInfo info = serverInfoDao.getServerinfo(server_id);
|
||||
|
||||
// 未运营状态的服务器需要进行清库处理
|
||||
if (info != null && "-2".equals(info.getStatus())){
|
||||
ThreadPoolManager.getInstance().execute(() -> delUser(info));
|
||||
ThreadPoolManager.getInstance().execute(() -> AutoServerManager.getInstance().delUser(info));
|
||||
}
|
||||
|
||||
// 修改服务器状态
|
||||
serverInfoDao.updateServerInfo(server_id, status, 0, isnew, name,register_state);
|
||||
if(status==-1){
|
||||
//自动开服修改开服时间
|
||||
RedisUtil.getInstence().putObject(server_id + RedisUserKey.Delimiter_colon + RedisUserKey.AUTOOPENTIME, "", opentime, -1);
|
||||
}else {
|
||||
CServerOpenTime cServerOpenTime = serverInfoDao.getOpenServerTime(server_id);
|
||||
if (null != cServerOpenTime) {
|
||||
cServerOpenTime.setOpenTime(opentime);
|
||||
serverInfoDao.updateOpenServerTime(cServerOpenTime, server_id);
|
||||
}
|
||||
}
|
||||
|
||||
ServerInfo serverInfo = serverInfoDao.getServerinfo(server_id);
|
||||
if (serverInfo != null) {
|
||||
ServerInfoVo serverInfoVo = new ServerInfoVo();
|
||||
serverInfoVo.setServer_id(String.valueOf(serverInfo.getServer_id()));
|
||||
serverInfoVo.setName(serverInfo.getName());
|
||||
serverInfoVo.setStatus(Integer.valueOf(serverInfo.getStatus()));
|
||||
serverInfoVo.setIsnew(isnew);
|
||||
serverInfoVo.setOpen_time(opentime);
|
||||
serverInfoVos.add(serverInfoVo);
|
||||
} else {
|
||||
return "404";
|
||||
}
|
||||
map.addAttribute("serverInfos", serverInfoVos);
|
||||
return "findServerInfo";
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -173,24 +152,29 @@ public class ServerInfoController {
|
|||
*/
|
||||
@RequestMapping(value = "/serverListEdit", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody int toServerListEdit(HttpServletRequest request) throws Exception {
|
||||
boolean open = AutoServerManager.getInstance().isOpen();
|
||||
if (open){
|
||||
return 3;
|
||||
}
|
||||
int status = Integer.parseInt(request.getParameter("status"));
|
||||
String[] serverId = request.getParameterValues("serverId[]");
|
||||
String serverId = request.getParameter("serverId");
|
||||
// 校验服务器状态
|
||||
for (String str:serverId){
|
||||
String[] serverIds = serverId.split(",");
|
||||
for (String str:serverIds){
|
||||
ServerInfo info = serverInfoDao.getServerinfo(str);
|
||||
if (info != null && "-2".equals(info.getStatus())){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// 修改服务器状态
|
||||
for (String str:serverId){
|
||||
for (String str:serverIds){
|
||||
serverInfoDao.updateServerInfo(str, status);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/serverNumberInfo", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String serverNumberInfo(HttpSession session, ModelMap map) throws Exception {
|
||||
public String serverNumberInfo(ModelMap map) throws Exception {
|
||||
List<ServerInfo> serverInfos = serverInfoDao.getAllServerInfo();
|
||||
List<ServerInfoVo> serverInfoVos = new ArrayList<>();
|
||||
int totalRegisterNum = 0;
|
||||
|
|
@ -241,7 +225,7 @@ public class ServerInfoController {
|
|||
}
|
||||
}
|
||||
if(serverInfo1.getOpen_type().equals(Constants.SERVEROPEN_TIME)){
|
||||
RedisUtil.getInstence().putObject(String.valueOf(server_id) + RedisUserKey.Delimiter_colon + RedisUserKey.AUTOOPENTIME, "", serverInfo1.getOpen_time(), -1);
|
||||
RedisUtil.getInstence().putObject(server_id + RedisUserKey.Delimiter_colon + RedisUserKey.AUTOOPENTIME, "", serverInfo1.getOpen_time(), -1);
|
||||
}
|
||||
String startTime = JsonUtil.date3TimeStamp(serverInfo1.getOpen_time());
|
||||
serverInfo1.setOpen_time(startTime);
|
||||
|
|
@ -250,39 +234,33 @@ public class ServerInfoController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 脚本执行删库操作
|
||||
* @param serverInfo
|
||||
* 获取自动开服配置
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
private void delUser(ServerInfo serverInfo){
|
||||
String path = "/data/jieling/deluser.sh";
|
||||
|
||||
if (serverInfo.getIP() == null || "".equals(serverInfo.getIP())
|
||||
|| serverInfo.getServer_id() == null || "".equals(serverInfo.getServer_id())
|
||||
|| serverInfo.getCoreName() == null || "".equals(serverInfo.getCoreName())){
|
||||
LOGGER.error("删除操作参数不全,执行失败:参数:{}",serverInfo.toString());
|
||||
return;
|
||||
@RequestMapping(value = "/autoStartServerSetting", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String autoStartServerSetting(ModelMap map){
|
||||
AutoServerSetting autoServerSetting = RedisUtil.getInstence().getMapValue(RedisUserKey.AUTO_START_SERVER_SETTING, "1", "1", AutoServerSetting.class, -1);
|
||||
if (autoServerSetting == null){
|
||||
autoServerSetting = new AutoServerSetting();
|
||||
}
|
||||
map.addAttribute("autoServerSetting", autoServerSetting);
|
||||
return "autoStartServerSetting";
|
||||
}
|
||||
|
||||
String command = "sh " + path + " 500 " + serverInfo.getIP() + " " + serverInfo.getServer_id() + " " + serverInfo.getCoreName();
|
||||
LOGGER.info("=================清库命令:{}",command);
|
||||
|
||||
Process exec = null;
|
||||
try {
|
||||
exec = Runtime.getRuntime().exec(command);
|
||||
|
||||
LOGGER.info("========================== 停服脚本执行结果开始 ===========================");
|
||||
new DealProcessSream(exec.getInputStream(),true).start();
|
||||
new DealProcessSream(exec.getErrorStream(),false).start();
|
||||
LOGGER.info("=========================== 停服脚本执行结果结束 ==========================");
|
||||
|
||||
exec.waitFor();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (exec != null) {
|
||||
exec.destroy();
|
||||
}
|
||||
/**
|
||||
* 修改自动开服配置
|
||||
* @param setting
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/updateAutoServerSetting", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody
|
||||
int updateAutoServerSetting(@RequestBody AutoServerSetting setting,HttpServletRequest request) throws Exception {
|
||||
boolean power = commonManager.verifyPower(request, PowersEnum.AUTO_START_SERVER_PERMISSIONS);
|
||||
if (!power){
|
||||
return 2;
|
||||
}
|
||||
RedisUtil.getInstence().putMapEntry(RedisUserKey.AUTO_START_SERVER_SETTING, "1", "1", setting, -1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public interface ServerInfoDao {
|
|||
|
||||
void updateServerInfo(String server_id, int status,int isWhite,int isnew,String name,String register_state) throws Exception;
|
||||
|
||||
void updateServerInfo(ServerInfo serverInfo) throws Exception;
|
||||
|
||||
void updateOpenServerTime(CServerOpenTime cServerOpenTime,String serverId) throws Exception;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,8 +77,17 @@ public class ServerInfoDaoImpl implements ServerInfoDao {
|
|||
mongoTemplate.updateMulti(query, update, ServerInfo.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateServerInfo(ServerInfo serverInfo) throws Exception {
|
||||
Update update = new Update();
|
||||
update.set("name",serverInfo.getName());
|
||||
update.set("status",serverInfo.getStatus());
|
||||
update.set("is_new",serverInfo.getIs_new());
|
||||
update.set("register_state",serverInfo.getRegister_state());
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
Query query = new Query(Criteria.where("server_id").is(serverInfo.getServer_id()));
|
||||
mongoTemplate.updateMulti(query, update, ServerInfo.class);
|
||||
}
|
||||
|
||||
public void updateServerInfoNew(String server_id, String is_new) throws Exception {
|
||||
Update update = new Update();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package com.jmfy.model;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import org.springframework.data.mongodb.core.mapping.Field;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hj
|
||||
* 自动开服配置
|
||||
* @date 2015/8/13
|
||||
*/
|
||||
|
||||
public class AutoServerSetting {
|
||||
/**
|
||||
* 0:关闭,1:开启
|
||||
*/
|
||||
private String state;
|
||||
/**
|
||||
* 1:次数,2:时间
|
||||
*/
|
||||
private String choose;
|
||||
/**
|
||||
* 注册人数
|
||||
*/
|
||||
private String num;
|
||||
/**
|
||||
* 定时开启时间
|
||||
*/
|
||||
private String time;
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getChoose() {
|
||||
return choose;
|
||||
}
|
||||
|
||||
public void setChoose(String choose) {
|
||||
this.choose = choose;
|
||||
}
|
||||
|
||||
public String getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(String num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutoServerSetting{" +
|
||||
"state=" + state +
|
||||
", choose=" + choose +
|
||||
", num=" + num +
|
||||
", time='" + time + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ import org.springframework.data.mongodb.core.mapping.Field;
|
|||
*/
|
||||
|
||||
@Document(collection = "server_info")
|
||||
public class ServerInfo {
|
||||
public class ServerInfo implements Comparable {
|
||||
@Id
|
||||
private int _id;
|
||||
|
||||
|
|
@ -200,4 +200,16 @@ public class ServerInfo {
|
|||
", coreName='" + coreName + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
ServerInfo info = (ServerInfo) o;
|
||||
if (info.get_id() == this.get_id()) {
|
||||
return 0;
|
||||
} else if (this.get_id() > info.get_id()) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ public enum PowersEnum {
|
|||
SERVER_REGISTER(202,"服务器注册查询",200,1,"serverNumberInfo"),
|
||||
ADD_SERVER(203,"添加服务器",200,1,"/html/addServer.html"),
|
||||
ALL_SERVER_SETTING(204,"全服配置",200,1,"serverCfgInfo"),
|
||||
AUTO_START_SERVER(205,"自动开服配置",200,1,"autoStartServerSetting"),
|
||||
AUTO_START_SERVER_PERMISSIONS(206,"权限:自动开服配置",200,0,""),
|
||||
|
||||
// 序列号管理300-399
|
||||
SERIAL_NUMBER_MANAGER(300,"序列号管理",300,1,""),
|
||||
|
|
@ -37,21 +39,8 @@ public enum PowersEnum {
|
|||
DELETE_WHITELIST(408,"删除白名单",400,1,"getAllWhites"),
|
||||
ADD_WHITELIST_ACCOUNT_HERO(409,"添加白名单账号英雄",400,1,"addHeroPage"),
|
||||
|
||||
PACKAGE_NAME_MANAGER(410,"频道管理",400,1,"packageInfoList"),
|
||||
ADD_PACKAGE_NAME(411,"权限: 添加频道",400,0,""),
|
||||
DELETE_PACKAGE_NAME(412,"权限: 删除频道",400,0,""),
|
||||
|
||||
GUILD_LIST_MANAGER(413,"公会列表管理",400,1,"initGuildList"),
|
||||
GUILD_OPERATE_PERMISSIONS(414,"权限: 操作公会",400,1,""),
|
||||
|
||||
CHANNEL_NAME_MANAGER(415,"渠道管理",400,1,"channelInfoList"),
|
||||
ADD_CHANNEL_PERMISSIONS(416,"权限: 添加渠道",400,0,""),
|
||||
DELETE_CHANNEL_PERMISSIONS(417,"权限: 删除渠道",400,0,""),
|
||||
|
||||
HAND_IN_MANAGER(418,"提审服管理",400,1,"tishenInfoList"),
|
||||
|
||||
GAME_AGREEMENT_MANAGER(419,"游戏协议管理",400,1,"gameAgreementList"),
|
||||
ADD_GAME_AGREEMENT_PERMISSIONS(420,"权限: 操作游戏协议(增,删,改)",400,0,""),
|
||||
GUILD_LIST_MANAGER(410,"公会列表管理",400,1,"initGuildList"),
|
||||
GUILD_OPERATE_PERMISSIONS(411,"权限: 操作公会",400,1,""),
|
||||
|
||||
// 流水日志管理500-599
|
||||
BILL_LOG(500,"流水日志管理",500,1,""),
|
||||
|
|
@ -100,6 +89,21 @@ public enum PowersEnum {
|
|||
TAICHU_SECRET_VOLUME(1301,"太初密卷",1301,1,""),
|
||||
TAICHU_SECRET_VOLUME_INFO(1302,"太初密卷信息",1301,1,"getAllSecretVolumeInfo"),
|
||||
TAICHU_SECRET_VOLUME_ADD(1303,"添加太初密卷信息",1301,1,"/html/addSecretVolumeInfo.html"),
|
||||
|
||||
// 游戏管理
|
||||
GAME_MANAGER(1400,"游戏管理",1400,1,""),
|
||||
PACKAGE_NAME_MANAGER(1401,"频道管理",1400,1,"packageInfoList"),
|
||||
ADD_PACKAGE_NAME(1402,"权限: 添加频道",1400,0,""),
|
||||
DELETE_PACKAGE_NAME(1403,"权限: 删除频道",1400,0,""),
|
||||
|
||||
CHANNEL_NAME_MANAGER(1404,"渠道管理",1400,1,"channelInfoList"),
|
||||
ADD_CHANNEL_PERMISSIONS(1405,"权限: 添加渠道",1400,0,""),
|
||||
DELETE_CHANNEL_PERMISSIONS(1406,"权限: 删除渠道",1400,0,""),
|
||||
|
||||
HAND_IN_MANAGER(1407,"提审服管理",1400,1,"tishenInfoList"),
|
||||
|
||||
GAME_AGREEMENT_MANAGER(1408,"游戏协议管理",1400,1,"gameAgreementList"),
|
||||
ADD_GAME_AGREEMENT_PERMISSIONS(1409,"权限: 操作游戏协议(增,删,改)",1400,0,""),
|
||||
;
|
||||
|
||||
private int id;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.jmfy.model.vo;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/8/12 17:40:56
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public enum ServerStatusEnum {
|
||||
// 类型
|
||||
PREPARE(-1,"准备中"),
|
||||
NOT_OPERATE(-2,"未运营"),
|
||||
CLOSE(0,"关闭"),
|
||||
MAINTAIN(1,"维护"),
|
||||
FLUENT(2,"流畅"),
|
||||
CROWDING(3,"拥挤"),
|
||||
FULL(4,"爆满"),
|
||||
;
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
private static Map<Integer,ServerStatusEnum> enumMap = new TreeMap<>();
|
||||
|
||||
static {
|
||||
Arrays.stream(ServerStatusEnum.values()).forEach(v->enumMap.putIfAbsent(v.id,v));
|
||||
}
|
||||
|
||||
public static String getTypeStr(int type){
|
||||
return enumMap.get(type).name;
|
||||
}
|
||||
|
||||
ServerStatusEnum(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,8 @@ public class RedisUserKey {
|
|||
public static final String MAIL_RED_POINT = "MAIL_RED_POINT";
|
||||
public final static String C_PAYORDER = "C_PAYORDER";
|
||||
public final static String C_PAYORDER_MAP = "C_PAYORDER_MAP";
|
||||
|
||||
public static final String AUTO_START_SERVER_SETTING= "AUTO_START_SERVER_SETTING";
|
||||
/**
|
||||
* 在线人数 updata/min
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,170 @@
|
|||
package com.jmfy.utils;
|
||||
|
||||
import com.jmfy.dao.ServerInfoDao;
|
||||
import com.jmfy.model.AutoServerSetting;
|
||||
import com.jmfy.model.ServerInfo;
|
||||
import com.jmfy.model.vo.ServerStatusEnum;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/8/12 16:44:47
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class AutoServerManager {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AutoServerManager.class);
|
||||
|
||||
private AutoServerManager(){}
|
||||
|
||||
public static class Instance {
|
||||
public final static AutoServerManager instance = new AutoServerManager();
|
||||
}
|
||||
|
||||
public static AutoServerManager getInstance() {
|
||||
return AutoServerManager.Instance.instance;
|
||||
}
|
||||
|
||||
private static long date = 0;
|
||||
|
||||
private static final long TIME = DateUtil.ONE_MINUTE*3;
|
||||
|
||||
@Resource
|
||||
private ServerInfoDao serverInfoDao;
|
||||
|
||||
/**
|
||||
* 是否开启自动开服功能
|
||||
* @return
|
||||
*/
|
||||
public boolean isOpen(){
|
||||
AutoServerSetting autoServerSetting = RedisUtil.getInstence().getMapValue(RedisUserKey.AUTO_START_SERVER_SETTING, "1", "1", AutoServerSetting.class, -1);
|
||||
return autoServerSetting != null && "1".equals(autoServerSetting.getState());
|
||||
}
|
||||
|
||||
/**
|
||||
* 开服
|
||||
*/
|
||||
public void startServer() throws Exception {
|
||||
if (isOpen()){
|
||||
LOGGER.info("=======================自动开服进行中=========================");
|
||||
// 当前时间
|
||||
long now = DateUtil.now();
|
||||
// 获取全部服务器列表,排除非未运营和准备中的服务器,正序排列
|
||||
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
|
||||
Stream<ServerInfo> sorted = allServerInfo.stream().filter(v -> Integer.parseInt(v.getStatus()) >= 0).sorted();
|
||||
Optional<ServerInfo> first = sorted.findFirst();
|
||||
if (!first.isPresent()){
|
||||
LOGGER.error("自动开服,服务器列表获取为空");
|
||||
return;
|
||||
}
|
||||
ServerInfo newServer = first.get();
|
||||
// 自动开服配置
|
||||
AutoServerSetting setting = RedisUtil.getInstence().getMapValue(RedisUserKey.AUTO_START_SERVER_SETTING, "1", "1", AutoServerSetting.class, -1);
|
||||
LOGGER.info("自动开服配置:{}",setting.toString());
|
||||
// 注册人数
|
||||
if ("1".equals(setting.getChoose())) {
|
||||
// 注册人数3分钟检查一次
|
||||
if (now >= (date + TIME)){
|
||||
// 获取服务器id
|
||||
String serverId = String.valueOf(Integer.valueOf(newServer.getServer_id())-1);
|
||||
// 注册人数
|
||||
long registerNum = serverInfoDao.getRegisterNum(serverId);
|
||||
LOGGER.info("自动开服,注册人数判断,条件值:{},当前服务器人数:{}-{}",setting.getNum(),serverId,registerNum);
|
||||
if (registerNum >= Integer.parseInt(setting.getNum())){
|
||||
startServers(newServer);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 时间开服,每分钟
|
||||
else if ("2".equals(setting.getChoose())){
|
||||
// 比较时间是否一致,精确到分
|
||||
boolean compareTime = DateUtil.compareTime(setting.getTime());
|
||||
LOGGER.info("自动开服,时间判断,条件值:{},当前时间:{},结果:{}",setting.getTime(),DateUtil.nowString(),compareTime);
|
||||
if (compareTime){
|
||||
startServers(newServer);
|
||||
}
|
||||
}
|
||||
// 更新时间
|
||||
date = now;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开服包装
|
||||
* @param newServer
|
||||
* @throws Exception
|
||||
*/
|
||||
private void startServers(ServerInfo newServer) throws Exception {
|
||||
// 新服务器状态更新
|
||||
updateServer(newServer,ServerStatusEnum.FLUENT.getId(),1,newServer.getServer_id());
|
||||
// 旧服务器状态更新
|
||||
String serverId = String.valueOf(Integer.valueOf(newServer.getServer_id())-1);
|
||||
ServerInfo oldServer = serverInfoDao.getServerinfo(serverId);
|
||||
updateServer(oldServer,ServerStatusEnum.CROWDING.getId(),0,serverId);
|
||||
// 脚本
|
||||
ThreadPoolManager.getInstance().execute(() -> AutoServerManager.getInstance().delUser(newServer));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改服务器
|
||||
* @param serverInfo
|
||||
* @param status
|
||||
* @param news
|
||||
*/
|
||||
private void updateServer(ServerInfo serverInfo, int status, int news, String serverId) throws Exception {
|
||||
if (serverInfo == null){
|
||||
LOGGER.error("自动开服,服务器不存在:{}",serverId);
|
||||
return;
|
||||
}
|
||||
serverInfo.setStatus(String.valueOf(status));
|
||||
serverInfo.setIs_new(String.valueOf(news));
|
||||
serverInfoDao.updateServerInfo(serverInfo);
|
||||
LOGGER.info("自动开服,修改服务器信息:{}",serverInfo.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 脚本执行删库操作
|
||||
* @param serverInfo
|
||||
* @return
|
||||
*/
|
||||
public void delUser(ServerInfo serverInfo){
|
||||
String path = "/data/jieling/deluser.sh";
|
||||
|
||||
if (serverInfo.getIP() == null || "".equals(serverInfo.getIP())
|
||||
|| serverInfo.getServer_id() == null || "".equals(serverInfo.getServer_id())
|
||||
|| serverInfo.getCoreName() == null || "".equals(serverInfo.getCoreName())){
|
||||
LOGGER.error("删除操作参数不全,执行失败:参数:{}",serverInfo.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
String command = "sh " + path + " 500 " + serverInfo.getIP() + " " + serverInfo.getServer_id() + " " + serverInfo.getCoreName();
|
||||
LOGGER.info("=================清库命令:{}",command);
|
||||
|
||||
Process exec = null;
|
||||
try {
|
||||
exec = Runtime.getRuntime().exec(command);
|
||||
|
||||
LOGGER.info("========================== 停服脚本执行结果开始 ===========================");
|
||||
new DealProcessSream(exec.getInputStream(),true).start();
|
||||
new DealProcessSream(exec.getErrorStream(),false).start();
|
||||
LOGGER.info("=========================== 停服脚本执行结果结束 ==========================");
|
||||
|
||||
exec.waitFor();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (exec != null) {
|
||||
exec.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.jmfy.utils;
|
|||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -66,6 +67,50 @@ public class DateUtil {
|
|||
return d.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期转换为时间戳
|
||||
* @param timers
|
||||
* @return
|
||||
*/
|
||||
public static boolean compareTime(String timers) {
|
||||
SimpleDateFormat sf = new SimpleDateFormat("HH:mm:ss");
|
||||
try {
|
||||
Date now = sf.parse(sf.format(new Date()));
|
||||
Date time = sf.parse(timers);
|
||||
return isSameDay(now.getTime(),time.getTime());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个日期是否同一天的同一分钟
|
||||
* @param r1
|
||||
* @param r2
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("Duplicates")
|
||||
public static boolean isSameDay(long r1, long r2) {
|
||||
Calendar c1 = Calendar.getInstance();
|
||||
c1.setTimeInMillis(r1);
|
||||
int y1 = c1.get(Calendar.YEAR);
|
||||
int m1 = c1.get(Calendar.MONTH) + 1;
|
||||
int d1 = c1.get(Calendar.DAY_OF_MONTH);
|
||||
int h1 = c1.get(Calendar.HOUR_OF_DAY);
|
||||
int min1 = c1.get(Calendar.MINUTE);
|
||||
|
||||
Calendar c2 = Calendar.getInstance();
|
||||
c2.setTimeInMillis(r2);
|
||||
int y2 = c2.get(Calendar.YEAR);
|
||||
int m2 = c2.get(Calendar.MONTH) + 1;
|
||||
int d2 = c2.get(Calendar.DAY_OF_MONTH);
|
||||
int h2 = c2.get(Calendar.HOUR_OF_DAY);
|
||||
int min2 = c2.get(Calendar.MINUTE);
|
||||
|
||||
return (y1 == y2) && (m1 == m2) && (d1 == d2) && (h1 == h2) && (min1 == min2) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import java.util.*;
|
|||
@Controller
|
||||
public class MinuteTask implements Runnable {
|
||||
@Resource
|
||||
private ServerInfoDaoImpl serverInfoDao;
|
||||
private AutoServerManager autoServerManager;
|
||||
|
||||
SHotFixManager sHotFixManager;
|
||||
|
||||
|
|
@ -41,108 +41,17 @@ public class MinuteTask implements Runnable {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
List<ServerInfo> serverInfos = serverInfoDao.getAllServerInfo();
|
||||
|
||||
SortedSet<ServerInfo> toStartMap = new TreeSet<>((o1, o2) ->
|
||||
Integer.valueOf(o1.getServer_id()).equals(Integer.valueOf(o2.getServer_id())) ? 0 : (Integer.valueOf(o1.getServer_id()) > Integer.valueOf(o1.getServer_id()) ? 1 : -1)
|
||||
);
|
||||
int lastServerID = 0;
|
||||
for (ServerInfo serverInfo : serverInfos) {
|
||||
if (null == serverInfo.getServer_id()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
if (!serverInfo.getStatus().equals(Constants.SERVERSTATE_UNSTART)){
|
||||
//获取现有服务器状态 进行开服处理
|
||||
int serverId = Integer.valueOf(serverInfo.getServer_id());
|
||||
if(serverId>lastServerID){
|
||||
lastServerID =serverId;
|
||||
}
|
||||
//check new
|
||||
String registnum = GlobalSysController.getPro("newday");
|
||||
if (serverInfo.getIs_new().equals("1") && serverInfoDao.getRegisterNum(String.valueOf(serverInfo.getServer_id())) > Integer.valueOf(registnum)) {
|
||||
serverInfoDao.updateServerInfoNew(serverInfo.getServer_id(), "0");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//check state |start
|
||||
if (serverInfo.getOpen_type().equals(Constants.SERVEROPEN_TIME)) {
|
||||
//修改按时开服服务器状态
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String openT = RedisUtil.getInstence().getObject(String.valueOf(serverInfo.getServer_id()) + RedisUserKey.Delimiter_colon + RedisUserKey.AUTOOPENTIME, "", String.class, -1);
|
||||
if (openT == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() > simpleDateFormat.parse(openT).getTime()) {
|
||||
serverInfo.setStatus("5");
|
||||
serverInfoDao.updateServerInfo(serverInfo.getServer_id(), 5);
|
||||
}
|
||||
|
||||
|
||||
} else if (serverInfo.getOpen_type().equals(Constants.SERVEROPEN_NUM)) {
|
||||
toStartMap.add(serverInfo);
|
||||
}
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
autoServerManager.startServer();
|
||||
}catch (Exception e){
|
||||
System.err.println("自动开服报错=====================================");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//check opentime
|
||||
String start = GlobalSysController.getPro("newtimelimitstart");
|
||||
String end = GlobalSysController.getPro("newtimelimitend");
|
||||
if (null != start && null != end) {
|
||||
if ("".equals(start) && "".equals(end)) {
|
||||
return;
|
||||
}
|
||||
int hour = getHourOfDay();
|
||||
int intStart = Integer.valueOf(start);
|
||||
int intEnd = Integer.valueOf(end);
|
||||
if (intStart < intEnd && hour >= intStart && hour < intEnd) {
|
||||
return;
|
||||
}
|
||||
if (intStart > intEnd && (hour >= intStart || hour < intEnd)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!toStartMap.isEmpty()) {
|
||||
String registnum = GlobalSysController.getPro("openlimit");
|
||||
if ((serverInfoDao.getRegisterNum(String.valueOf(lastServerID))) > Long.valueOf(registnum)) {
|
||||
ServerInfo server = toStartMap.first();
|
||||
if(null ==server){
|
||||
return;
|
||||
}
|
||||
server.setStatus("5");
|
||||
serverInfoDao.updateServerInfo(server.getServer_id(), 5);
|
||||
|
||||
Date data = new Date();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
//自动开服修改开服时间
|
||||
RedisUtil.getInstence().putObject(server.getServer_id() + RedisUserKey.Delimiter_colon + RedisUserKey.AUTOOPENTIME, "", simpleDateFormat.format(data), -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int getHourOfDay() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||
return hour;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -747,7 +747,7 @@ input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit
|
|||
.w-300{width:300px}
|
||||
.w-200{width:200px}
|
||||
@media (max-width: 1000px) {
|
||||
.Hui-wraper,.wp,{ width:auto!important;padding:0 15px!important}
|
||||
/*.Hui-wraper,.wp,{ width:auto!important;padding:0 15px!important}*/
|
||||
}
|
||||
@media print{
|
||||
.Hui-wraper{width:auto}
|
||||
|
|
@ -3319,7 +3319,7 @@ H-ui采用Font Awesome 3.2.1的整套图标,因为是图标字体,所以可
|
|||
*/
|
||||
.verticalTab{background:#fff url(../images/verticalTab/tab_bg.png) repeat-y 0 0; width:38px}
|
||||
.verticalTab a{position:relative; display:block; width:18px; height:auto; text-align:center; position:relative; padding:26px 10px 6px 10px; background:url(../images/verticalTab/tabNav.png) no-repeat 0 0}
|
||||
.verticalTab a em{position:absolute; left:0; bottom:-20px; width:38px; height:20px; background:url(../images/tabNav_right.png) no-repeat 0 0; z-index:50}
|
||||
.verticalTab a em{position:absolute; left:0; bottom:-20px; width:38px; height:20px; /*background:url(../images/tabNav_right.png) no-repeat 0 0;*/ z-index:50}
|
||||
.verticalTab a.active{background-image:url(../images/verticalTab/tabNav-active.png); color:#fff; z-index:99}
|
||||
.verticalTab a.active em{background-image:url(../images/verticalTab/tabNav_right-active.png)}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
|
||||
<script type="text/javascript">
|
||||
$('.table-sort').dataTable({
|
||||
"aaSorting": [[1, "desc"]],//默认第几个排序
|
||||
"aaSorting": [[0, "desc"]],//默认第几个排序
|
||||
"bStateSave": true,//状态保存
|
||||
"pading": false,
|
||||
"aoColumnDefs": [
|
||||
|
|
@ -90,31 +90,31 @@
|
|||
function batchUpdateStatus() {
|
||||
var account = $("input[name='account']").val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"account": account
|
||||
},
|
||||
url: "/batchUpdateSupportStatus",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
layer.msg('操作成功!', {icon: 6, time: 1000});
|
||||
window.location.reload();
|
||||
}
|
||||
if (data === 0) {
|
||||
layer.msg('操作失败', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data === 2) {
|
||||
layer.msg('订单信息异常,请联系管理员!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data === 3) {
|
||||
layer.msg('没有权限!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data === 4) {
|
||||
layer.msg('游戏服接收异常,请联系管理员!', {icon: 6, time: 1000});
|
||||
}
|
||||
type: "POST",
|
||||
data: {
|
||||
"account": account
|
||||
},
|
||||
url: "/batchUpdateSupportStatus",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
layer.msg('操作成功!', {icon: 6, time: 1000});
|
||||
window.location.reload();
|
||||
}
|
||||
if (data === 0) {
|
||||
layer.msg('操作失败', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data === 2) {
|
||||
layer.msg('订单信息异常,请联系管理员!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data === 3) {
|
||||
layer.msg('没有权限!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data === 4) {
|
||||
layer.msg('游戏服接收异常,请联系管理员!', {icon: 6, time: 1000});
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// 单个审核
|
||||
|
|
|
|||
|
|
@ -0,0 +1,201 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="Bookmark" href="/favicon.ico" />
|
||||
<link rel="Shortcut Icon" href="/favicon.ico" />
|
||||
<!--[if lt IE 9]>
|
||||
<script type="text/javascript" src="lib/html5shiv.js"></script>
|
||||
<script type="text/javascript" src="lib/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" type="text/css" href="h-ui/css/H-ui.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/H-ui.admin.css" />
|
||||
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/skin/default/skin.css" id="skin" />
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/style.css" />
|
||||
<!--[if IE 6]>
|
||||
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
|
||||
<script>DD_belatedPNG.fix('*');</script>
|
||||
<![endif]-->
|
||||
<!--/meta 作为公共模版分离出去-->
|
||||
|
||||
<title>基本设置</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="breadcrumb">
|
||||
<a href="javascript:;" onclick="history.go(-1)"><i class="Hui-iconfont"></i> 首页</a>
|
||||
<span class="c-gray en">></span>
|
||||
自动开服配置
|
||||
</nav>
|
||||
<div class="page-container">
|
||||
<form class="form form-horizontal" th:object="${autoServerSetting}" action="*" method="post">
|
||||
<div id="tab-system" class="HuiTab">
|
||||
<div class="tabBar cl">
|
||||
<span>自动开服配置</span>
|
||||
</div>
|
||||
<div class="tabCon">
|
||||
<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="checkbox" id="state" name="state" th:value="*{state}" class="input-checkbox"/>
|
||||
</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="radio" id="choose1" name="choose" th:value="1"/>
|
||||
<span>注册</span>
|
||||
<input type="radio" id="choose2" name="choose" th:value="2"/>
|
||||
<span>时间</span>
|
||||
</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" style="width: 200px;height: 25px" name="nums" th:value="*{num}"/>
|
||||
</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="time" style="width: 200px;height: 25px" name="time" th:value="*{time}" step="0"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
|
||||
<button class="btn btn-primary radius" type="button" onclick="keepSetting()"><i class="Hui-iconfont"></i> 保存</button>
|
||||
<button class="btn btn-default radius" type="button"><a href="/findServerInfo"> 取消 </a></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<!--_footer 作为公共模版分离出去-->
|
||||
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
|
||||
<script type="text/javascript" src="h-ui/js/H-ui.min.js"></script>
|
||||
<script type="text/javascript" src="h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
|
||||
|
||||
<!--请在下方写此页面业务相关的脚本-->
|
||||
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
|
||||
<script th:inline="javascript">
|
||||
$(function(){
|
||||
$('.skin-minimal input').iCheck({
|
||||
checkboxClass: 'icheckbox-blue',
|
||||
radioClass: 'iradio-blue',
|
||||
increaseArea: '20%'
|
||||
});
|
||||
$("#tab-system").Huitab({
|
||||
index:0
|
||||
});
|
||||
});
|
||||
|
||||
//当页面加载完成的时候,自动调用该方法
|
||||
window.onload = function () {
|
||||
var settings = [[${autoServerSetting}]];
|
||||
if (settings.state == 1){
|
||||
$("#state").prop("checked",true);
|
||||
}else {
|
||||
$("input[name='choose']").attr("disabled",true);
|
||||
$("input[name='nums']").attr("disabled",true);
|
||||
$("input[name='time']").attr("disabled",true);
|
||||
}
|
||||
if (settings.choose == 1){
|
||||
$("#choose1").prop("checked",true);
|
||||
$("input[name='time']").attr("disabled",true);
|
||||
}
|
||||
if (settings.choose == 2) {
|
||||
$("#choose2").prop("checked",true);
|
||||
$("input[name='nums']").attr("disabled",true);
|
||||
}
|
||||
};
|
||||
|
||||
$("#state").click(function () {
|
||||
if ($(this).is(":checked")){
|
||||
$("input[name='choose']").attr("disabled",false);
|
||||
var choose = $("input[name='choose']:checked").val();
|
||||
if (choose == 1){
|
||||
$("input[name='time']").attr("disabled",true);
|
||||
$("input[name='nums']").attr("disabled",false);
|
||||
}else {
|
||||
$("input[name='nums']").attr("disabled",true);
|
||||
$("input[name='time']").attr("disabled",false);
|
||||
}
|
||||
} else {
|
||||
$("input[name='nums']").attr("disabled",true);
|
||||
$("input[name='time']").attr("disabled",true);
|
||||
$("input[name='choose']").attr("disabled",true);
|
||||
}
|
||||
});
|
||||
|
||||
$("input[type='radio']").click(function () {
|
||||
var choose = $("input[name='choose']:checked").val();
|
||||
if (choose == 1){
|
||||
$("input[name='time']").attr("disabled",true);
|
||||
$("input[name='nums']").attr("disabled",false);
|
||||
}else {
|
||||
$("input[name='nums']").attr("disabled",true);
|
||||
$("input[name='time']").attr("disabled",false);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 保存配置
|
||||
*/
|
||||
function keepSetting() {
|
||||
var state = 0;
|
||||
if ($("#state").is(":checked")){
|
||||
state = 1;
|
||||
}
|
||||
var choose = $("input[name='choose']:checked").val();
|
||||
var nums = $("input[name='nums']").val();
|
||||
var time = $("input[name='time']").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data:
|
||||
JSON.stringify({
|
||||
"state": state,
|
||||
"choose": choose,
|
||||
"num": nums,
|
||||
"time": time
|
||||
})
|
||||
,
|
||||
url: "/updateAutoServerSetting",
|
||||
dataType: "json",
|
||||
contentType: 'application/json',
|
||||
|
||||
success: function (data) {
|
||||
if (data == 1) {
|
||||
layer.msg('自动开服配置成功!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data == 2) {
|
||||
layer.msg('自动开服配置失败,没有权限!', {icon: 6, time: 1000});
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
</script>
|
||||
<!--/请在上方写此页面业务相关的脚本-->
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -15,13 +15,14 @@
|
|||
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/skin/default/skin.css" id="skin"/>
|
||||
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/style.css"/>
|
||||
<!-- 多选框 -->
|
||||
<link href="../static/searchableSelect/css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/bootstrap-3.3.4.css">
|
||||
<link href="../static/bootstrap/css/bootstrap-select.css" rel="stylesheet">
|
||||
|
||||
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
|
||||
<script>DD_belatedPNG.fix('*');</script>
|
||||
<title>服务器列表信息</title>
|
||||
<style>
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="breadcrumb">
|
||||
|
|
@ -34,46 +35,29 @@
|
|||
<div class="page-container" style="text-align: center">
|
||||
<h2><span style="color:red;">服务器信息</span></h2>
|
||||
<div class="text-c">
|
||||
<div style="text-align: left;">
|
||||
<!--多选服务器-->
|
||||
<select name="serverId" class="selectpicker" id="serverId" multiple
|
||||
data-live-search="true"
|
||||
data-width="300px"
|
||||
data-actions-box="true">
|
||||
<option th:each="server:${serverInfos}" th:if="${server.status != -2}" th:value="${server.server_id}"
|
||||
th:text="${server.server_id}+'-'+${server.name}"></option>
|
||||
</select>
|
||||
<select name="status2" class="input-text" id="status2" style="width: 200px;"><!--下拉列表-->
|
||||
<option value="-1">服务器准备中</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>
|
||||
<div class="mt-20">
|
||||
<button class="btn btn-primary" type="button" id="btn_add" style="float: right;margin-left: 20px;" >批量修改服务器状态</button>
|
||||
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">批量修改服务器状态</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="form-label col-xs-4 col-sm-2" style="width: 100%; text-align: left">
|
||||
<span class="c-red">*</span>
|
||||
服务器状态</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="hidden" id="status"/>
|
||||
<select name="status" class="input-text" id="status1"><!--下拉列表-->
|
||||
<option value="-1">服务器准备中</option>
|
||||
<option value="0">关闭</option>
|
||||
<option value="1">维护</option>
|
||||
<option value="2">流畅</option>
|
||||
<option value="3">拥挤</option>
|
||||
<option value="4">爆满</option>
|
||||
<option value="5">自动</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
|
||||
<button type="button" id="btn_submit" class="btn btn-primary" data-dismiss="modal"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
|
||||
<thead>
|
||||
<tr class="text-c" >
|
||||
<!--<th width="25"><input type="checkbox" name="" value=""/></th>-->
|
||||
<th width="200"><input type="checkbox" id="allChecks" onclick="ckAll()" /> 全选</th>
|
||||
<th width="200">server_id</th>
|
||||
<th width="200">ip:port</th>
|
||||
<th width="200">开启类型</th>
|
||||
|
|
@ -83,29 +67,24 @@
|
|||
<th width="200">新服推荐</th>
|
||||
<th width="200">版本号</th>
|
||||
<th width="200">上次重启时间</th>
|
||||
<th width="240">操作</th>
|
||||
<th width="200">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="obj:${serverInfos}">
|
||||
<!--<td><input type="checkbox" value="" name=""/></td>-->
|
||||
<td style="text-align: center;">
|
||||
<input type="checkbox" name="check" th:value="${obj.server_id}"/>
|
||||
</td>
|
||||
<td th:text="${obj.server_id}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.ip_port}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.open_type}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.name}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.open_time}" style="text-align: center;"></td>
|
||||
<th th:switch="${obj.status}" style="text-align: center;">
|
||||
<span th:case="-2" class="Hui-iconfont" style="color: #8b0000;">未运营 </span>
|
||||
<span th:case="-1" class="label label-defaunt radius">服务器准备中</span>
|
||||
<span th:case="0" class="label label-defaunt radius">已关闭</span>
|
||||
<span th:case="1" class="Hui-iconfont" style="color: #2f332a">维护</span>
|
||||
<span th:case="2" class="Hui-iconfont" style="color: #00B83F">流畅</span>
|
||||
<span th:case="3" class="Hui-iconfont" style="color: #9cb945">拥挤</span>
|
||||
<span th:case="4" class="Hui-iconfont" style="color: #8b0000;">爆满 </span>
|
||||
<span th:case="5" class="Hui-iconfont" style="color: #8b0000;">自动 </span>
|
||||
<span th:case="-2" class="Hui-iconfont" style="color: #8b0000;">未运营 </span>
|
||||
</th>
|
||||
<th th:switch="${obj.is_new}" style="text-align: center;">
|
||||
<span th:case="0" class="label label-defaunt radius">普通</span>
|
||||
|
|
@ -127,60 +106,56 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!--_footer 作为公共模版分离出去-->
|
||||
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
|
||||
<script type="text/javascript" src="h-ui/js/H-ui.min.js"></script>
|
||||
<script type="text/javascript" src="h-ui.admin/js/H-ui.admin.js"></script>
|
||||
|
||||
<!--请在下方写此页面业务相关的脚本-->
|
||||
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
|
||||
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
|
||||
<script type="text/javascript">
|
||||
$('.table-sort').dataTable({
|
||||
"aaSorting": [[1, "desc"]],//默认第几个排序
|
||||
"bStateSave": true,//状态保存
|
||||
"pading": false,
|
||||
"aoColumnDefs": [
|
||||
]
|
||||
});
|
||||
function ckAll(){
|
||||
var flag=document.getElementById("allChecks").checked;
|
||||
var cks=document.getElementsByName("check");
|
||||
for(var i=0;i<cks.length;i++){
|
||||
cks[i].checked=flag;
|
||||
}
|
||||
}
|
||||
$("#btn_add").click(function () {
|
||||
$("#myModalLabel").text("批量修改服务器状态");
|
||||
$('#myModal').modal();
|
||||
});
|
||||
$("#btn_submit").click(function () {
|
||||
var strSel=[];
|
||||
var status = document.getElementById("status1").value;
|
||||
$("[name='check']:checked").each(function(index, element) {
|
||||
strSel.push($(this).val());
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"serverId[]": strSel,
|
||||
"status":status
|
||||
},
|
||||
url: "/serverListEdit",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
window.location.href = '/findServerInfo'
|
||||
}
|
||||
if (data === 0) {
|
||||
alert("服务器存在未运营状态,操作失败")
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<!--_footer 作为公共模版分离出去-->
|
||||
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
|
||||
<script type="text/javascript" src="h-ui/js/H-ui.min.js"></script>
|
||||
<script type="text/javascript" src="h-ui.admin/js/H-ui.admin.js"></script>
|
||||
|
||||
<!--请在下方写此页面业务相关的脚本-->
|
||||
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
|
||||
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
|
||||
<!-- 多选框 -->
|
||||
<script src="../static/bootstrap/js/bootstrap-select.js"></script>
|
||||
<script type="text/javascript" src="../static/searchableSelect/js/jquery.searchableSelect.js"></script>
|
||||
<script src="../static/searchableSelect/js/initBootstrap.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('.table-sort').dataTable({
|
||||
"aaSorting": [[0, "desc"]],//默认第几个排序
|
||||
"bStateSave": true,//状态保存
|
||||
"pading": false,
|
||||
"aoColumnDefs": [
|
||||
{"orderable": false, "aTargets": [2, 3]}// 不参与排序的列
|
||||
]
|
||||
});
|
||||
|
||||
function updateServers() {
|
||||
var serverId = $("#serverId").val().toString();
|
||||
var status2 = $("#status2").val().toString();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"serverId": serverId,
|
||||
"status": status2
|
||||
},
|
||||
url: "/serverListEdit",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
alert("操作成功");
|
||||
window.location.href = '/findServerInfo';
|
||||
}
|
||||
if (data === 0) {
|
||||
alert("服务器存在未运营状态,操作失败");
|
||||
}
|
||||
if (data === 3){
|
||||
alert("服务器已开启自动开服,无法手动修改,修改请关闭自动开服功能!");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont"></i></a>
|
||||
</nav>
|
||||
<h2 class="mt-20" style="text-align: center"><span style="color:red;">公会列表管理</span></h2>
|
||||
<div class="page-container" style="text-align: center;v">
|
||||
<div class="page-container" style="text-align: center;">
|
||||
<div class="text-c">
|
||||
<div style="text-align: left;">
|
||||
<!--多选服务器-->
|
||||
|
|
@ -159,16 +159,6 @@
|
|||
]
|
||||
});
|
||||
|
||||
$('.table-sort2').dataTable({
|
||||
"aaSorting": [[0, "esc"]],//默认第几个排序
|
||||
"bStateSave": true,//状态保存
|
||||
"pading": false,
|
||||
"aoColumnDefs": [
|
||||
//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
|
||||
{"orderable": false, "aTargets": []}// 不参与排序的列
|
||||
]
|
||||
});
|
||||
|
||||
// 查询公会
|
||||
function selectGuilds() {
|
||||
var serverId = $("#serverId").val().toString();
|
||||
|
|
|
|||
|
|
@ -146,10 +146,10 @@
|
|||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">有效时间:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9" onclick="showInput()">
|
||||
<input type="radio" name="effectTime" value="2592000" checked="true"> <span>30天</span>
|
||||
<input type="radio" name="effectTime" value="604800" checked="true"> <span>7天</span>
|
||||
<input type="radio" style="margin-left: 30px;" name="effectTime" value="0"> <span>永久</span>
|
||||
<input type="radio" style="margin-left: 30px;" name="effectTime" value="TheCustom"> <span>自定义</span>
|
||||
<input type="text" style="display: none;width: 360px;line-height: 32px; margin-top: 13px;border: 1px solid #c6c6c6;" id="effectTime_input" placeholder=" 单位:秒,0:永久" value="" />
|
||||
<input type="text" style="display: none;width: 360px;line-height: 32px; margin-top: 13px;border: 1px solid #c6c6c6;" id="effectTime_input" placeholder=" 单位:天,0:永久" value="" />
|
||||
<span class="EFFECTTIME"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -290,35 +290,24 @@
|
|||
function sendSysMail() {
|
||||
//特殊字符验证
|
||||
var reg = new RegExp("[|#]",'g');
|
||||
|
||||
var mailTitle1 = $("input[name='mailTitle1']").val();
|
||||
if (reg.test(mailTitle1)){
|
||||
alert("中文标题不能有特殊字符")
|
||||
}
|
||||
var mailTitle2 = $("input[name='mailTitle2']").val();
|
||||
if (reg.test(mailTitle2)){
|
||||
alert("英文标题不能有特殊字符")
|
||||
}
|
||||
var mailTitle3 = $("input[name='mailTitle3']").val();
|
||||
if (reg.test(mailTitle3)){
|
||||
alert("越南文标题不能有特殊字符")
|
||||
}
|
||||
|
||||
var mailContent1 = $("textarea[name='mailContent1']").val();
|
||||
if (reg.test(mailContent1)){
|
||||
alert("中文正文不能有特殊字符")
|
||||
}
|
||||
var mailContent2 = $("textarea[name='mailContent2']").val();
|
||||
if (reg.test(mailContent2)){
|
||||
alert("英文正文不能有特殊字符")
|
||||
}
|
||||
var mailContent3 = $("textarea[name='mailContent3']").val();
|
||||
if (reg.test(mailContent3)){
|
||||
alert("越南文正文不能有特殊字符")
|
||||
|
||||
if (reg.test(mailTitle1) || reg.test(mailTitle2) || reg.test(mailTitle3)){
|
||||
alert("邮件标题不能含有特殊字符");
|
||||
return false;
|
||||
}
|
||||
if (reg.test(mailContent1) || reg.test(mailContent2) || reg.test(mailContent3)){
|
||||
alert("邮件正文不能有特殊字符");
|
||||
return false;
|
||||
}
|
||||
|
||||
var mailTitle = mailTitle1+"|"+mailTitle2+"|"+mailTitle3;
|
||||
|
||||
var mailContent = mailContent1+"|"+mailContent2+"|"+mailContent3;
|
||||
|
||||
var erroCode = $('.SERVERID');
|
||||
|
|
@ -329,7 +318,8 @@
|
|||
var sendTime = $("input[name='sendTime']").val();
|
||||
var effectTime = $("input[name='effectTime']:checked").val();
|
||||
if (effectTime === "TheCustom"){
|
||||
effectTime = document.getElementById("effectTime_input").value;
|
||||
var seconds = document.getElementById("effectTime_input").value;
|
||||
effectTime = seconds*24*60*60;
|
||||
}
|
||||
var version = new Date().getTime() / 1000;
|
||||
var itemIds = [];
|
||||
|
|
@ -348,6 +338,7 @@
|
|||
}
|
||||
if(itemNums.length!==itemIds.length){
|
||||
erroCode.html('<span style="color: red; ">物品id或物品数量不匹配</span>');
|
||||
return false;
|
||||
}
|
||||
if (serverId === '' || serverId == null) {
|
||||
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
|
||||
|
|
@ -370,9 +361,8 @@
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (version === '' || version == null) {
|
||||
erroCode = $('.VERSION');
|
||||
erroCode.html('<span style="color: red; ">版本号不能为空!</span>');
|
||||
if (sendTime === "" || sendTime < 0){
|
||||
alert("奖励发送时间不能为空!");
|
||||
return false;
|
||||
}
|
||||
if (effectTime === "" || effectTime < 0){
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
<span class="c-red">*</span>
|
||||
区服id:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<!-- 多选服务器-->
|
||||
<!--多选服务器-->
|
||||
<select name="serverId" class="selectpicker" id="serverId" multiple
|
||||
data-live-search="true"
|
||||
data-width="300px"
|
||||
|
|
@ -94,23 +94,15 @@
|
|||
</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">
|
||||
<select name="isAttach" class="input-text" id="isAttach" onclick="itemShow()">
|
||||
<option value="1" selected="selected">有</option>
|
||||
<option value="0">无</option>
|
||||
<option value="1">有</option>
|
||||
<option value="0" selected="selected">无</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="row cl">-->
|
||||
<!--<label class="form-label col-xs-4 col-sm-2">附件:</label>-->
|
||||
<!--<div class="formControls col-xs-8 col-sm-9">-->
|
||||
<!--<input type="text" name="attach" placeholder="itemId#num#type|itemId#num#type" value="" class="input-text"/>-->
|
||||
<!--<span class="ATTACH"></span>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="row cl" id="items">
|
||||
<div class="row cl" id="items" style="display: none">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
附件:</label>
|
||||
|
|
@ -157,22 +149,15 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">有效时间:</label>
|
||||
<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" onclick="showInput()">
|
||||
<input type="radio" name="effectTime" value="2592000" checked="true"> <span>30天</span>
|
||||
<input type="radio" name="effectTime" value="604800" checked="true"> <span>7天</span>
|
||||
<input type="radio" style="margin-left: 30px;" name="effectTime" value="0"> <span>永久</span>
|
||||
<input type="radio" style="margin-left: 30px;" name="effectTime" value="TheCustom"> <span>自定义</span>
|
||||
<input type="text" style="display: none;width: 360px;line-height: 32px; margin-top: 13px;border: 1px solid #c6c6c6;" id="effectTime_input" placeholder=" 单位:秒,0:永久" value="" />
|
||||
<span class="EFFECTTIME"></span>
|
||||
<input type="text" style="display: none;width: 360px;line-height: 32px; margin-top: 13px;border: 1px solid #c6c6c6;" id="effectTime_input" placeholder=" 单位:天,0:永久" value="" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="row cl">-->
|
||||
<!-- <label class="form-label col-xs-4 col-sm-2">版本号:</label>-->
|
||||
<!-- <div class="formControls col-xs-8 col-sm-9">-->
|
||||
<!-- <input type="text" name="version" placeholder="0:所有版本号, 其他客户端版本号" value="" class="input-text"/>-->
|
||||
<!-- <span class="VERSION"></span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
|
|
@ -301,42 +286,27 @@
|
|||
var mailContent2 = $("textarea[name='mailContent2']").val();
|
||||
var mailContent3 = $("textarea[name='mailContent3']").val();
|
||||
|
||||
if (reg.test(mailTitle1)){
|
||||
alert("中文标题不能有特殊字符")
|
||||
if (reg.test(mailTitle1) || reg.test(mailTitle2) || reg.test(mailTitle3)){
|
||||
alert("邮件标题不能含有特殊字符");
|
||||
return false;
|
||||
}
|
||||
if (reg.test(mailTitle2)){
|
||||
alert("英文标题不能有特殊字符")
|
||||
}
|
||||
if (reg.test(mailTitle3)){
|
||||
alert("越南文标题不能有特殊字符")
|
||||
}
|
||||
if (reg.test(mailContent1)){
|
||||
alert("中文正文不能有特殊字符")
|
||||
}
|
||||
|
||||
if (reg.test(mailContent2)){
|
||||
alert("英文正文不能有特殊字符")
|
||||
}
|
||||
if (reg.test(mailContent3)){
|
||||
alert("越南文正文不能有特殊字符")
|
||||
if (reg.test(mailContent1) || reg.test(mailContent2) || reg.test(mailContent3)){
|
||||
alert("邮件正文不能有特殊字符");
|
||||
return false;
|
||||
}
|
||||
|
||||
var mailTitle = mailTitle1+"|"+mailTitle2+"|"+mailTitle3;
|
||||
|
||||
var mailContent = mailContent1+"|"+mailContent2+"|"+mailContent3;
|
||||
|
||||
|
||||
var erroCode = $('.SERVERID');
|
||||
var serverId = $("#serverId").val().toString();
|
||||
|
||||
|
||||
// var attach = $("input[name='attach']").val();
|
||||
var isAttach = document.getElementById("isAttach").value;
|
||||
var sendTime = $("input[name='sendTime']").val();
|
||||
var playerRTime = $("#PlayerRTime").val();
|
||||
var effectTime = $("input[name='effectTime']:checked").val();
|
||||
if (effectTime === "TheCustom"){
|
||||
effectTime = document.getElementById("effectTime_input").value;
|
||||
var seconds = document.getElementById("effectTime_input").value;
|
||||
effectTime = seconds*24*60*60;
|
||||
}
|
||||
var version = new Date().getTime() / 1000;
|
||||
var itemIds = [];
|
||||
|
|
@ -354,34 +324,36 @@
|
|||
});
|
||||
}
|
||||
if (serverId === '' || serverId == null) {
|
||||
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
|
||||
alert("服务器id不能为空!");
|
||||
return false;
|
||||
}
|
||||
if (mailTitle === '' || mailTitle == null) {
|
||||
erroCode = $('.MAILTITLE');
|
||||
erroCode.html('<span style="color: red; ">邮件标题不能为空!</span>');
|
||||
if (mailTitle == '' || mailTitle == null) {
|
||||
alert("邮件标题不能为空!");
|
||||
return false;
|
||||
}
|
||||
if (mailContent === '' || mailContent == null) {
|
||||
erroCode = $('.MAILCONTENT');
|
||||
erroCode.html('<span style="color: red; ">邮件内容不能为空!</span>');
|
||||
if (mailContent == '' || mailContent == null) {
|
||||
alert("邮件内容不能为空!");
|
||||
return false;
|
||||
}
|
||||
if (isAttach === "1") {
|
||||
if (isAttach == "1") {
|
||||
if (itemIds.length < 1) {
|
||||
erroCode = $('.ATTACH');
|
||||
erroCode.html('<span style="color: red; ">附件不能为空!</span>');
|
||||
alert("带有附件状态,附件不能为空!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (version === '' || version == null) {
|
||||
erroCode = $('.VERSION');
|
||||
erroCode.html('<span style="color: red; ">版本号不能为空!</span>');
|
||||
|
||||
if (sendTime === "" || sendTime < 0){
|
||||
alert("奖励发送时间不能为空!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (playerRTime === "" || playerRTime < 0){
|
||||
alert("用户注册时间不能为空!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (effectTime === "" || effectTime < 0){
|
||||
erroCode = $('.EFFECTTIME');
|
||||
erroCode.html('<span style="color: red; ">有效时间不能为空或小于0!</span>');
|
||||
alert("有效时间不能为空或小于0!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
|
||||
|
|
@ -37,7 +36,7 @@
|
|||
<!--<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/findServerInfo');" title="刷新" ><i class="Hui-iconfont"></i></a>-->
|
||||
</nav>
|
||||
<div class="page-container">
|
||||
<form class="form form-horizontal" th:object="${serverInfo}" action="/serverEdit" method="post">
|
||||
<form class="form form-horizontal" th:object="${serverInfo}" action="*" method="post">
|
||||
<div id="tab-system" class="HuiTab">
|
||||
<div class="tabBar cl">
|
||||
<span>修改服务器状态</span>
|
||||
|
|
@ -64,19 +63,14 @@
|
|||
<span class="c-red">*</span>
|
||||
服务器状态:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="hidden" id="status" th:value="*{status}"/>
|
||||
|
||||
<select th:name="status" class="input-text" id="status1"><!--下拉列表-->
|
||||
<div th: th:switch="*{status}">
|
||||
<div th:case="-1">
|
||||
<option th:value="-1">服务器准备中</option>
|
||||
</div>
|
||||
<select th:name="status" class="input-text" id="status"><!--下拉列表-->
|
||||
<div th:switch="*{status}">
|
||||
<option th:value="-1">服务器准备中</option>
|
||||
<option th:value="0">关闭</option>
|
||||
<option th:value="1">维护</option>
|
||||
<option th:value="2">流畅</option>
|
||||
<option th:value="3">拥挤</option>
|
||||
<option th:value="4">爆满</option>
|
||||
<option th:value="5">自动</option>
|
||||
</div>
|
||||
</select>
|
||||
|
||||
|
|
@ -89,9 +83,8 @@
|
|||
<span class="c-red">*</span>
|
||||
服务器推荐:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="hidden" id="is_new" th:value="*{is_new}"/>
|
||||
<select th:name="is_new" class="input-text" id="is_new1"><!--下拉列表-->
|
||||
<div th: th:switch="*{is_new}">
|
||||
<select th:name="is_new" class="input-text" id="is_new"><!--下拉列表-->
|
||||
<div th:switch="*{is_new}">
|
||||
<option th:value="0">普通</option>
|
||||
<option th:value="1">新服</option>
|
||||
</div>
|
||||
|
|
@ -104,10 +97,8 @@
|
|||
<span class="c-red">*</span>
|
||||
服务器注册:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="hidden" id="register_state" th:value="*{register_state}"/>
|
||||
|
||||
<select th:name="register_state" class="input-text" id="register_state1"><!--下拉列表-->
|
||||
<div th: th:switch="*{register_state}">
|
||||
<select th:name="register_state" class="input-text" id="register_state"><!--下拉列表-->
|
||||
<div th:switch="*{register_state}">
|
||||
<option th:value="1">开启</option>
|
||||
<option th:value="0">关闭</option>
|
||||
</div>
|
||||
|
|
@ -115,19 +106,10 @@
|
|||
</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="startTime" placeholder="" th:value="*{open_time}" class="input-text"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
|
||||
<button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont"></i> 保存</button>
|
||||
<button class="btn btn-primary radius" type="button" onclick="updateServerInfo()"><i class="Hui-iconfont"></i> 保存</button>
|
||||
<button class="btn btn-default radius" type="button"><a href="/findServerInfo"> 取消 </a>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -147,7 +129,7 @@
|
|||
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
|
||||
<script type="text/javascript">
|
||||
<script th:inline="javascript">
|
||||
$(function () {
|
||||
$('.skin-minimal input').iCheck({
|
||||
checkboxClass: 'icheckbox-blue',
|
||||
|
|
@ -159,35 +141,45 @@
|
|||
});
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
var flag = $("#status").val();
|
||||
var register_state=$("#register_state").val();
|
||||
var is_new=$("#is_new").val();
|
||||
if (register_state === "1"){
|
||||
$("#register_state1 option[value='" + register_state + "']").attr("selected", "selected");
|
||||
} else if(register_state === "0"){
|
||||
$("#register_state1 option[value='" + register_state + "']").attr("selected", "selected");
|
||||
}
|
||||
|
||||
if (is_new === "1"){
|
||||
$("#is_new1 option[value='" + is_new + "']").attr("selected", "selected");
|
||||
} else if(register_state === "0"){
|
||||
$("#is_new1 option[value='" + is_new + "']").attr("selected", "selected");
|
||||
}
|
||||
|
||||
|
||||
//根据值让option选中
|
||||
if (flag === "4") {
|
||||
$("#status1 option[value='" + flag + "']").attr("selected", "selected");
|
||||
} else if (flag === "3") {
|
||||
$("#status1 option[value='" + flag + "']").attr("selected", "selected");
|
||||
} else if (flag === "2") {
|
||||
$("#status1 option[value='" + flag + "']").attr("selected", "selected");
|
||||
} else if (flag === "1") {
|
||||
$("#status1 option[value='" + flag + "']").attr("selected", "selected");
|
||||
}
|
||||
|
||||
});
|
||||
//当页面加载完成的时候,自动调用该方法
|
||||
window.onload = function () {
|
||||
var serverInfo = [[${serverInfo}]];
|
||||
$("#status option[value='" + serverInfo.status + "']").attr("selected", "selected");
|
||||
$("#is_new option[value='" + serverInfo.is_new + "']").attr("selected", "selected");
|
||||
$("#register_state option[value='" + serverInfo.register_state + "']").attr("selected", "selected");
|
||||
};
|
||||
|
||||
function updateServerInfo() {
|
||||
var server_id = $("input[name='server_id']").val();
|
||||
var name = $("input[name='name']").val();
|
||||
var status = $("#status option:selected").val();
|
||||
var is_new = $("#is_new option:selected").val();
|
||||
var register_state = $("#register_state option:selected").val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"server_id": server_id,
|
||||
"name": name,
|
||||
"status": status,
|
||||
"is_new": is_new,
|
||||
"register_state": register_state
|
||||
},
|
||||
url: "/serverEdit",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
alert("修改成功");
|
||||
window.location.href="/findServerInfo";
|
||||
}
|
||||
if (data === 0) {
|
||||
alert("修改失败");
|
||||
}
|
||||
if (data === 3) {
|
||||
alert("服务器已开启自动开服,无法手动修改,修改请关闭自动开服功能!");
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
</script>
|
||||
<!--/请在上方写此页面业务相关的脚本-->
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Reference in New Issue