Merge branch 'jieling' of http://60.1.1.230/backend/gm_tw_admin into jieling

master
duhui 2022-03-07 15:14:06 +08:00
commit 84f334a056
7 changed files with 951 additions and 0 deletions

View File

@ -0,0 +1,354 @@
package com.jmfy.controller;
import com.jmfy.dao.MailDao;
import com.jmfy.dao.ServerInfoDao;
import com.jmfy.model.ServerAreaInfo;
import com.jmfy.model.ServerAreaInfoManager;
import com.jmfy.model.ServerInfo;
import com.jmfy.redisProperties.RedisUserKey;
import com.jmfy.utils.JsonUtil;
import com.jmfy.utils.RedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.*;
@Controller
public class HeFuController {
private static final Logger LOGGER = LoggerFactory.getLogger(HeFuController.class);
@Resource
private ServerInfoDao serverInfoDao;
@Resource
private MailDao mailDao;
/**
*
* @param session
* @param map
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/closeServer", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody String closeServer(HttpSession session, ModelMap map, HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String[] serverIds = parameterMap.get("serverIds").split("#");
List<String> strings = Arrays.asList(serverIds);
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
for (ServerInfo serverInfo : allServerInfo) {
if (strings.contains(serverInfo.getServer_id())) {
serverInfo.setStatus("1");
serverInfo.setIsWhite("1");
// serverInfoDao.updateServerInfo(serverInfo.getServer_id(), 1, 1, 0, 0);
}
}
return "服务器:" + parameterMap.get("serverIds").replace("#",",") + " 关服成功";
}
/**
*
* @param session
* @param map
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/openServer", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody String openServer(HttpSession session, ModelMap map, HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String[] serverIds = parameterMap.get("serverIds").split("#");
List<String> strings = Arrays.asList(serverIds);
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
// for (ServerInfo serverInfo : allServerInfo) {
// if (strings.contains(Integer.toString(serverInfo.getServer_id()))) {
// serverInfo.setStatus(2);
// serverInfo.setIsWhite(0);
// serverInfoDao.updateServerInfo(serverInfo.getServer_id(), 2, 0, 0, 0);
// }
// }
return "服务器:"+ parameterMap.get("serverIds").replace("#",",") + ",开服成功";
}
/**
*
* @param session
* @param map
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/addHefuManager", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody String addHefuManager(HttpSession session, ModelMap map, HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
int type = Integer.parseInt(parameterMap.get("type"));
int areaId = Integer.parseInt(parameterMap.get("areaId"));
String serverIds = parameterMap.get("serverIds");
ServerAreaInfoManager serverAreaInfoManager = serverInfoDao.findServerArenaInfoManager();
if (type ==0){ //服务器合并
bulidJsInfo(serverIds,"",serverAreaInfoManager,areaId);
}else { //大区吞并
//10001|10002#10003
bulidJsInfo("",serverIds,serverAreaInfoManager,areaId);
}
String info = "";
if (type == 0){
info = "服务器:" + parameterMap.get("serverIds").replace("#",",") +"合并为大区:" + areaId;
}else {
info = "大区:" + serverIds.split("\\|")[0] + "吞并了" + serverIds.split("\\|")[1].replace("#",",");
}
return info;
}
private void bulidJsInfo(String serverIds, String areaIds,ServerAreaInfoManager serverAreaInfoManager,int areaId) throws Exception {
if (!serverIds.isEmpty()){
mergeServer(serverIds,serverAreaInfoManager,areaId);
}
if (!areaIds.isEmpty()){
mergeAreaId(areaIds,serverAreaInfoManager);
}
}
/**
* |
* @param areaIds
*/
private void mergeAreaId(String areaIds, ServerAreaInfoManager serverAreaInfoManager) throws Exception {
String preDate = "2019-03-04 03:00:00";
String execDate= "2019-03-04 03:00:00";
Map<Integer, ServerAreaInfo> serverAreaInfoMap = serverAreaInfoManager.getServerAreaInfoMap();
String[] split = areaIds.split("\\|");
int areaId = Integer.parseInt(split[0]);
String[] split1 = split[1].split("#");
List<Integer> serverIdList = new ArrayList<>();
Map<Integer,Integer> addServerOrAreaIds = new HashMap<>();
addServerOrAreaIds.put(areaId,2);
for (String aredId :split1){
ServerAreaInfo serverAreaInfo = serverAreaInfoMap.get(Integer.parseInt(aredId));
if (serverAreaInfo == null){
continue;
}
serverAreaInfo.setFlag(true);
addServerOrAreaIds.put(Integer.parseInt(aredId),2);
serverIdList.add(serverAreaInfo.getMasterServerId());
serverIdList.addAll(serverAreaInfo.getSlaveAreaIds());
}
ServerAreaInfo serverAreaInfo = serverAreaInfoManager.getServerAreaInfoMap().get(areaId);
serverAreaInfo.setVersion(serverAreaInfo.getVersion() +1);
List<Integer> slaveAreaIds = serverAreaInfo.getSlaveAreaIds();
slaveAreaIds.addAll(new HashSet<>(serverIdList));
serverAreaInfo.setAddServerOrAreaIds(addServerOrAreaIds);
serverAreaInfo.setExecDate(execDate);
serverAreaInfo.setPreDate(preDate);
Map<Integer, Integer> areaIdByServerIdMap = serverAreaInfoManager.getAreaIdByServerIdMap();
for (Integer serverId :serverIdList){
areaIdByServerIdMap.put(serverId,areaId);
}
serverAreaInfoManager.setVersion(serverAreaInfoManager.getVersion() + 1);
update(serverAreaInfoManager, serverAreaInfoMap, areaIdByServerIdMap);
}
/**
*
* @param serverIds
*/
private void mergeServer(String serverIds,ServerAreaInfoManager serverAreaInfoManager,int areaId) throws Exception {
String preDate = "2019-03-04 03:00:00";
String execDate= "2019-03-04 03:00:00";
boolean isInsert = false;
Map<Integer, Integer> server_area_id;
if (serverAreaInfoManager == null){
isInsert = true;
serverAreaInfoManager = new ServerAreaInfoManager();
server_area_id =new HashMap<>();
serverAreaInfoManager.setId(1);
serverAreaInfoManager.setVersion(1);
}else{
serverAreaInfoManager.setVersion(serverAreaInfoManager.getVersion() +1);
server_area_id = serverAreaInfoManager.getAreaIdByServerIdMap();
}
Map<Integer, ServerAreaInfo> serverAreaInfoMap = serverAreaInfoManager.getServerAreaInfoMap();
ServerAreaInfo serverAreaInfo = serverAreaInfoMap.get(areaId);
if (serverAreaInfo ==null){
serverAreaInfo = new ServerAreaInfo();
}
String[] split = serverIds.split("#");
List<Integer> serverList = new ArrayList<>();
for (String server : split) {
if (!serverAreaInfoMap.containsKey(areaId) && server_area_id.containsKey(Integer.parseInt(server))){
return;
}
if (server.isEmpty()) {
continue;
}
serverList.add(Integer.parseInt(server));
}
Collections.sort(serverList);
int masterServerId = serverList.get(0);
List<Integer> slave_ids = serverAreaInfo.getSlaveAreaIds();
if (slave_ids ==null){
slave_ids = new ArrayList<>();
}
Map<Integer, Integer> add_serverOrArea_ids =new HashMap<>();
for (Integer serverId :serverList){
add_serverOrArea_ids.put(serverId,1);
server_area_id.put(serverId,areaId);
if (serverAreaInfo.getMasterServerId() == 0 && serverId == masterServerId){
continue;
}
slave_ids.add(serverId);
}
serverAreaInfo.setVersion(1);
serverAreaInfo.setPreDate(preDate);
if (serverAreaInfo.getMasterServerId() == 0){
serverAreaInfo.setMasterServerId(masterServerId);
}
serverAreaInfo.setExecDate(execDate);
serverAreaInfo.setSlaveAreaIds(slave_ids);
serverAreaInfo.setAreaId(areaId);
serverAreaInfo.setAddServerOrAreaIds(add_serverOrArea_ids);
serverAreaInfo.setFlag(false);
serverAreaInfoMap.put(areaId,serverAreaInfo);
serverAreaInfoManager.setAreaIdByServerIdMap(server_area_id);
if (isInsert){
serverInfoDao.addServerArenaInfoManager(serverAreaInfoManager);
}else {
update(serverAreaInfoManager, serverAreaInfoMap, server_area_id);
}
}
private void update(ServerAreaInfoManager serverAreaInfoManager, Map<Integer, ServerAreaInfo> serverAreaInfoMap, Map<Integer, Integer> server_area_id) throws Exception {
Query query = new Query(Criteria.where("_id").is(1));
Update update = new Update();
update.set("version",serverAreaInfoManager.getVersion());
update.set("server_area_map",serverAreaInfoMap);
update.set("server_area_id",server_area_id);
serverInfoDao.updateServerArenaInfoManager(query,update);
}
/**
*
* @param session
* @param map
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/delMails", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody String delMails(HttpSession session, ModelMap map, HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String[] serverIds = parameterMap.get("serverIds").split("#");
for (int i = 0; i < serverIds.length; i++) {
String serverId = serverIds[i].trim();
// mailDao.delMails(Integer.parseInt(serverId));
}
return parameterMap.get("serverIds") + ",邮件已删除!";
}
/**
*
* @param session
* @param map
* @param request
* @return
*/
@RequestMapping(value = "/serverMergeRank", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody String serverMergeRank(HttpSession session, ModelMap map, HttpServletRequest request) {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String[] serverIds = parameterMap.get("serverIds").split("#");
String areaId = parameterMap.get("areaId");
String type = parameterMap.get("type");
String activityId = parameterMap.get("activityId");
for (String serverId : serverIds) {
if ("2".equals(type) || "3".equals(type)) {
// RedisUtil.getInstence().addFiestaRank(serverId, activityId, getKey("2"), areaId);
// RedisUtil.getInstence().addFiestaRank(serverId, activityId, getKey("3"), areaId);
} else {
// RedisUtil.getInstence().addRank(serverId, activityId, getKey(type), areaId);
}
}
return "排行榜合并成功";
}
private String getKey(String type) {
switch (type){
case "1" :
return "C_ACTIVITY_RANK";
case "2":
return "FIESTA_SCORE_RANK";
case "3":
return "FIESTA_HURT_RANK";
default:
return "";
}
}
/**
*
* @param session
* @param map
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/fahuojiAdress", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody String fahuojiAdress(HttpSession session, ModelMap map, HttpServletRequest request) {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String mainServerId = parameterMap.get("serverId");
String[] serverIds = parameterMap.get("serverIds").split("#");
String fahuojiAdress = RedisUtil.getInstence().getObject(mainServerId + RedisUserKey.Delimiter_colon + "ThriftIpPort_Key", mainServerId, String.class, -1);
if (fahuojiAdress == null) {
return "发货机地址 为 null";
}
for (int i = 0; i < serverIds.length; i++) {
String serverId = serverIds[i].trim();
RedisUtil.getInstence().putObject(serverId + RedisUserKey.Delimiter_colon + "ThriftIpPort_Key", serverId, fahuojiAdress, -1);
}
return "服务器:"+parameterMap.get("serverIds").replace("#",",") + "发货机地址改为:" + fahuojiAdress;
}
/**
* ip
* @param session
* @param map
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/updateServerAdress", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody String updateServerAdress(HttpSession session, ModelMap map, HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String ip = parameterMap.get("ip");
String port = parameterMap.get("port");
String chatPort = parameterMap.get("chatPort");
String[] serverIds = parameterMap.get("serverIds").split("#");
for (int i = 0; i < serverIds.length; i++) {
String serverId = serverIds[i].trim();
ServerInfo allServerInfo = serverInfoDao.getServerinfo(serverId);
if (allServerInfo == null) {
LOGGER.info("updateServerAdress serverId == null {}", serverId);
continue;
}
allServerInfo.setIp(ip);
allServerInfo.setPort(port);
String chatAdress = ip + RedisUserKey.Delimiter_colon + chatPort;
// serverInfoDao.updateServerIPPort(Integer.parseInt(serverId), ip, Integer.parseInt(port), chatAdress);
}
return "服务器:"+ parameterMap.get("serverIds").replace("#",",") +",游戏服IP地址改为"+ ip + ":" + port;
}
}

View File

@ -2,9 +2,12 @@ package com.jmfy.dao;
import com.jmfy.model.CServerOpenTime;
import com.jmfy.model.ServerAreaInfoManager;
import com.jmfy.model.ServerInfo;
import com.jmfy.model.gameName;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import java.util.List;
import java.util.Map;
@ -41,4 +44,8 @@ public interface ServerInfoDao {
String getAllServerName(String server_Ids) throws Exception;
void deleteServer(String serverId) throws Exception;
ServerAreaInfoManager findServerArenaInfoManager() throws Exception;
void addServerArenaInfoManager(ServerAreaInfoManager serverAreaInfoManager) throws Exception;
void updateServerArenaInfoManager(Query query, Update update) throws Exception;
}

View File

@ -206,4 +206,22 @@ public class ServerInfoDaoImpl implements ServerInfoDao {
}
return num;
}
@Override
public void addServerArenaInfoManager(ServerAreaInfoManager serverAreaInfoManager) throws Exception {
MongoTemplate coreMongoTemplate = connect.getMongoTemplete(dbName);
coreMongoTemplate.save(serverAreaInfoManager);
}
@Override
public void updateServerArenaInfoManager(Query query, Update update) throws Exception {
MongoTemplate coreMongoTemplate = connect.getMongoTemplete(dbName);
coreMongoTemplate.upsert(query,update,ServerAreaInfoManager.class);
}
public ServerAreaInfoManager findServerArenaInfoManager() throws Exception {
MongoTemplate coreMongoTemplate = connect.getMongoTemplete(dbName);
return coreMongoTemplate.findById(1,ServerAreaInfoManager.class);
}
}

View File

@ -0,0 +1,96 @@
package com.jmfy.model;
import org.springframework.data.mongodb.core.mapping.Field;
import java.util.List;
import java.util.Map;
public class ServerAreaInfo {
@Field(value = "version")
private int version;
@Field(value = "area_id")
private int areaId;
@Field(value = "mater_serverId")
private int masterServerId;
@Field(value = "slave_area_ids")
private List<Integer> slaveAreaIds; //不入库 只做解析用
@Field(value = "add_serverOrArea_ids")
private Map<Integer,Integer> addServerOrAreaIds; //key: serverid or areaid value: type : 类型 1 serverid 2 areaid
@Field(value = "pre_date")
private String preDate;
@Field(value = "exec_date")
private String execDate;
@Field(value = "flag")
private boolean flag ;
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public int getAreaId() {
return areaId;
}
public void setAreaId(int areaId) {
this.areaId = areaId;
}
public int getMasterServerId() {
return masterServerId;
}
public void setMasterServerId(int masterServerId) {
this.masterServerId = masterServerId;
}
public List<Integer> getSlaveAreaIds() {
return slaveAreaIds;
}
public void setSlaveAreaIds(List<Integer> slaveAreaIds) {
this.slaveAreaIds = slaveAreaIds;
}
public Map<Integer, Integer> getAddServerOrAreaIds() {
return addServerOrAreaIds;
}
public void setAddServerOrAreaIds(Map<Integer, Integer> addServerOrAreaIds) {
this.addServerOrAreaIds = addServerOrAreaIds;
}
public String getPreDate() {
return preDate;
}
public void setPreDate(String preDate) {
this.preDate = preDate;
}
public String getExecDate() {
return execDate;
}
public void setExecDate(String execDate) {
this.execDate = execDate;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
}

View File

@ -0,0 +1,59 @@
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;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
*/
@Document(collection = "server_area_manager")
public class ServerAreaInfoManager {
@Id
private int id;
@Field(value = "version")
private int version;
@Field(value = "server_area_map")
private Map<Integer,ServerAreaInfo> serverAreaInfoMap = new ConcurrentHashMap<>();
@Field(value = "server_area_id")
private Map<Integer,Integer> areaIdByServerIdMap = new ConcurrentHashMap<>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public Map<Integer, ServerAreaInfo> getServerAreaInfoMap() {
return serverAreaInfoMap;
}
public void setServerAreaInfoMap(Map<Integer, ServerAreaInfo> serverAreaInfoMap) {
this.serverAreaInfoMap = serverAreaInfoMap;
}
public Map<Integer, Integer> getAreaIdByServerIdMap() {
return areaIdByServerIdMap;
}
public void setAreaIdByServerIdMap(Map<Integer, Integer> areaIdByServerIdMap) {
this.areaIdByServerIdMap = areaIdByServerIdMap;
}
}

View File

@ -109,6 +109,9 @@ public enum PowersEnum {
GAME_AGREEMENT_MANAGER(1408,"游戏协议管理",1400,1,"gameAgreementList"),
ADD_GAME_AGREEMENT_PERMISSIONS(1409,"权限: 操作游戏协议(增,删,改)",1400,0,""),
HEFU(1500,"合服",1500,1,""),
HEFU_MANAGER(1501,"合服",1500,1,"/html/hefu.html"),
;
private int id;

View File

@ -0,0 +1,414 @@
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<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]-->
<title>基本设置</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
<span class="c-gray en">&gt;</span>
合服
<span class="c-gray en">&gt;</span>
合服操作
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
<div id="tab-system" class="HuiTab">
<div class="tabBar cl">
<span>合服操作</span>&nbsp;&nbsp;
<!--<input type="text" name="" id="" placeholder="" style="width:400px;height: 25px">-->
</div>
</div>
<!--关闭服务器-->
<br>
<div>
<span style="color: red ;font-size: 20px">关闭服务器>>>>:</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="colse_ids" id="colse_ids" placeholder="服务器id10001#10002" style="width:650px" class="input-text" autocomplete="off">
<span class="COLSESERVER"></span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name="" id="close" class="btn btn-success" type="button" onclick="colse_server()" ><i class="Hui-iconfont">&#xe665;</i> 关闭服务器</button>
</div>
<br>
<div class="tabBar cl"></div>
<!--开启服务器-->
<br>
<div>
<span style="color: red ;font-size: 20px">开启服务器>>>>:</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="open_ids" id="open_ids" placeholder="服务器id10001#10002" style="width:650px" class="input-text" autocomplete="off">
<span class="OPENSERVER"></span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name="" id="open" class="btn btn-success" type="button" onclick="open_server()"><i class="Hui-iconfont">&#xe665;</i> 开启服务器</button>
</div>
<br>
<div class="tabBar cl"></div>
<!--添加合并服务器标示-->
<br>
<div>
<!--<button onclick="removeIframe()" class="btn btn-primary radius">关闭选项卡</button>-->
<span style="color: red ;font-size: 20px">添加合并服务器标示>>>>:</span>&nbsp;&nbsp;&nbsp;
<input type="text" name="areaId" id="areaId" placeholder="大区id" style="width:100px" class="input-text" autocomplete="off">
<span class="select-box inline">
<select id="type" name="type" class="select">
<option value="0">服务器合并</option>
<option value="1">大区吞并</option>
</select>
</span>
<input type="text" name="hefu_ids" id="hefu_ids" placeholder="服务器合并1001#1002 大区吞并100001|100002#100003" style="width:450px" class="input-text" autocomplete="off">
<span class="HEFUSERVER"></span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name="" id="hefu" class="btn btn-success" type="button" onclick="hefu()"><i class="Hui-iconfont">&#xe665;</i> 添加</button>
</div>
<br>
<div class="tabBar cl"></div>
<!--删除邮件-->
<br>
<div>
<!--<button onclick="removeIframe()" class="btn btn-primary radius">关闭选项卡</button>-->
<span style="color: red ;font-size: 20px">删除合服服务器邮件>>>>:</span>&nbsp;&nbsp;&nbsp;
<input type="text" name="delMail_ids" id="delMail_ids" placeholder="格式1001#1002" style="width:650px" class="input-text" autocomplete="off">
<span class="DELMAIL"></span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name="" id="del_mail" class="btn btn-success" type="button" onclick="del_mail()"><i class="Hui-iconfont">&#xe665;</i>删除</button>
</div>
<br>
<div class="tabBar cl"></div>
<!--合并排行榜-->
<br>
<div>
<!--<button onclick="removeIframe()" class="btn btn-primary radius">关闭选项卡</button>-->
<span style="color: red ;font-size: 20px">合并排行榜>>>>:</span>&nbsp;&nbsp;&nbsp;
<input type="text" name="r_areaId" id="r_areaId" placeholder="大区id" style="width:100px" class="input-text" autocomplete="off">
<span class="RAREAID"></span>&nbsp;
<input type="text" name="activityId" id="activityId" placeholder="活动id" style="width:100px" class="input-text" autocomplete="off">
<span class="ACTIVITY"></span>&nbsp;
<span class="select-box inline">
<select id="rank_type" name="type" class="select">
<option value="1">活动排行榜</option>
<option value="2">妖神记假期</option>
</select>
</span>
<input type="text" name="rank_ids" id="rank_ids" placeholder="格式1001#1002" style="width:400px" class="input-text" autocomplete="off">
<span class="HEBINGRANK"></span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name="" id="hebing_rank" class="btn btn-success" type="button" onclick="hebing_rank()"><i class="Hui-iconfont">&#xe665;</i>合并</button>
</div>
<br>
<div class="tabBar cl"></div>
<!--x修改发货机地址-->
<br>
<div>
<!--<button onclick="removeIframe()" class="btn btn-primary radius">关闭选项卡</button>-->
<span style="color: red ;font-size: 20px">修改发货机地址>>>>:</span>&nbsp;&nbsp;&nbsp;
<input type="text" name="master_id" id="master_id" placeholder="合服后主服务器id" style="width:150px" class="input-text" autocomplete="off">
<span class="MASTERID"></span>&nbsp;
<input type="text" name="slave_ids" id="slave_ids" placeholder="格式1001#1002" style="width:570px" class="input-text" autocomplete="off">
<span class="SLAVEIDS"></span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name="" id="update_address" class="btn btn-success" type="button" onclick="update_address()"><i class="Hui-iconfont">&#xe665;</i>修改</button>
</div>
<br>
<div class="tabBar cl"></div>
<!--修改服务器ip和端口-->
<br>
<div>
<!--<button onclick="removeIframe()" class="btn btn-primary radius">关闭选项卡</button>-->
<span style="color: red ;font-size: 20px">服务器ip和端口>>>>:</span>&nbsp;&nbsp;&nbsp;
<input type="text" name="ip" id="ip" placeholder="ip" style="width:150px" class="input-text" autocomplete="off">
<span class="IP"></span>&nbsp;
<span class="select-box inline">
<select id="game_port" name="type" class="select">
<option value="0">游戏服端口</option>
<option value="18091">18091</option>
<option value="18092">18092</option>
<option value="18093">18093</option>
<option value="18094">18094</option>
<option value="18095">18095</option>
<option value="18096">18096</option>
<option value="18097">18097</option>
<option value="18098">18098</option>
<option value="18099">18099</option>
<option value="18100">18100</option>
</select>
</span>&nbsp;
<span class="select-box inline">
<select id="chat_port" name="type" class="select">
<option value="0">聊天服端口</option>
<option value="20001">20001</option>
<option value="20002">20002</option>
<option value="20003">20003</option>
<option value="20004">20004</option>
<option value="20005">20005</option>
<option value="20006">20006</option>
<option value="20007">20007</option>
<option value="20008">20008</option>
<option value="20009">20009</option>
<option value="20010">20010</option>
</select>
</span>&nbsp;
<input type="text" name="server_ids" id="server_ids" placeholder="格式1001#1002" style="width:350px" class="input-text" autocomplete="off">
<span class="SERVERIDS"></span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name="" id="update_server" class="btn btn-success" type="button" onclick="update_server()"><i class="Hui-iconfont">&#xe665;</i>修改</button>
</div>
<br>
<div class="tabBar cl"></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> <!--/_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 type="text/javascript">
$(function(){
$('.skin-minimal input').iCheck({
checkboxClass: 'icheckbox-blue',
radioClass: 'iradio-blue',
increaseArea: '20%'
});
$("#tab-system").Huitab({
index:0
});
});
//修改服务器列表
function update_server() {
var erroCode = $('.HEBINGRANK');
var ip = $("input[name='ip']").val();
var server_ids = $("input[name='server_ids']").val();
var game_port = document.getElementById("game_port").value;
var chat_port = document.getElementById("chat_port").value;
if (ip === '' || ip == null) {
erroCode = $('.IP');
erroCode.html('<span style="color: red; ">ip不能为空!</span>');
return false;
}
if (server_ids === '' || server_ids == null) {
erroCode = $('.SERVERIDS');
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
return false;
}
$.ajax({
type: "POST",
data: {
"ip": ip,
"port":game_port,
"chatPort":chat_port,
"serverIds":server_ids
},
url: "/updateServerAdress",
success: function (data) {
erroCode.html('<span style="color: red;"></span>');
alert(data)
}
}
);
return true;
}
//修改发货机地址
function update_address() {
var erroCode = $('.SLAVEIDS');
var master_id = $("input[name='master_id']").val();
var slave_ids = $("input[name='slave_ids']").val();
if (master_id === '' || master_id == null) {
erroCode = $('.MASTERID');
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
return false;
}
if (slave_ids === '' || slave_ids == null) {
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
return false;
}
$.ajax({
type: "POST",
data: {
"serverId":master_id,
"serverIds":slave_ids
},
url: "/fahuojiAdress",
success: function (data) {
erroCode.html('<span style="color: red;"></span>');
alert(data)
}
}
);
return true;
}
//合并
function hebing_rank() {
var erroCode = $('.HEBINGRANK');
var areaId = $("input[name='r_areaId']").val();
var rank_ids = $("input[name='rank_ids']").val();
var type = document.getElementById("rank_type").value;
var activityId = $("input[name='activityId']").val();
if (areaId === '' || areaId == null) {
erroCode = $('.RAREAID');
erroCode.html('<span style="color: red; ">大区id不能为空!</span>');
return false;
}
if (activityId === '' || activityId == null) {
erroCode = $('.ACTIVITY');
erroCode.html('<span style="color: red; ">活动id不能为空!</span>');
return false;
}
if (rank_ids === '' || rank_ids == null) {
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
return false;
}
$.ajax({
type: "POST",
data: {
"type": type,
"areaId":areaId,
"activityId":activityId,
"serverIds":rank_ids
},
url: "/serverMergeRank",
success: function (data) {
erroCode.html('<span style="color: red;"></span>');
alert(data)
}
}
);
return true;
}
//删除邮件
function del_mail() {
var erroCode = $('.DELMAIL');
var delMail_ids = $("input[name='delMail_ids']").val();
if (delMail_ids === '' || delMail_ids == null) {
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
return false;
}
$.ajax({
type: "POST",
data: {
"serverIds": delMail_ids
},
url: "/delMails",
success: function (data) {
erroCode.html('<span style="color: red; "></span>');
alert(data)
}
}
);
return true;
}
//合服
function hefu() {
var erroCode = $('.HEFUSERVER');
var areaId = $("input[name='areaId']").val();
var hefu_ids = $("input[name='hefu_ids']").val();
var type = document.getElementById("type").value;
if (hefu_ids === '' || hefu_ids == null) {
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
return false;
}
$.ajax({
type: "POST",
data: {
"type": type,
"areaId":areaId,
"serverIds":hefu_ids
},
url: "/addHefuManager",
success: function (data) {
erroCode.html('<span style="color: red;"></span>');
alert(data)
}
}
);
return true;
}
//关服
function colse_server() {
var erroCode = $('.COLSESERVER');
var colse_ids = $("input[name='colse_ids']").val();
if (colse_ids === '' || colse_ids == null) {
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
return false;
}
$.ajax({
type: "POST",
data: {
"serverIds": colse_ids
},
url: "/closeServer",
success: function (data) {
erroCode.html('<span style="color: red; "></span>');
alert(data)
}
}
);
return true;
}
//开服
function open_server() {
var erroCode = $('.OPENSERVER');
var open_ids = $("input[name='open_ids']").val();
if (open_ids === '' || open_ids == null) {
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
return false;
}
$.ajax({
type: "POST",
data: {
"serverIds": open_ids
},
url: "/openServer",
success: function (data) {
erroCode.html('<span style="color: red; "></span>');
alert(data)
}
}
);
return true;
}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>