generated from root/miduo_server
踢人修改 服务器显示名称
parent
e8e245d400
commit
04550dbf5e
|
|
@ -43,6 +43,7 @@ public class GameTitleController {
|
|||
public String toGameTitle(ModelMap map,Integer type){
|
||||
try {
|
||||
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
|
||||
allServerInfo.add(0,new ServerInfo(0,"全服"));
|
||||
map.addAttribute("serverInfo",allServerInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ public class UserInfoController {
|
|||
if (gsUser == null) {
|
||||
cUserVo.setIsData(0);
|
||||
} else {
|
||||
cUserVo.setOpenID(gsUser.getPlayerManager().getOpenId());
|
||||
cUserVo.setIsData(1);
|
||||
cUserVo.setUserId(gsUser.getId());
|
||||
cUserVo.setUserName(gsUser.getPlayerManager().getNickName());
|
||||
|
|
|
|||
|
|
@ -33,129 +33,75 @@ public class GMHandler extends BaseHandler {
|
|||
dsid = jsonObject.getIntValue("dsid");
|
||||
treat_type = jsonObject.getIntValue("treat_type");
|
||||
|
||||
boolean allServer = false;
|
||||
boolean allServer = dsid == 0;
|
||||
|
||||
String cmd = "";
|
||||
switch (treat_type){
|
||||
case 1:
|
||||
if(!jsonObject.containsKey("actor_id")){
|
||||
throw new Exception("缺少参数");
|
||||
}
|
||||
String actor_id_ban = jsonObject.getString("actor_id");
|
||||
cmd="silence "+actor_id_ban+" 1";
|
||||
break;
|
||||
case 2:
|
||||
if(!jsonObject.containsKey("actor_id")){
|
||||
throw new Exception("缺少参数");
|
||||
}
|
||||
String actor_id_no_ban = jsonObject.getString("actor_id");
|
||||
cmd="silence "+actor_id_no_ban+" 0";
|
||||
break;
|
||||
case 4:
|
||||
if(dsid==0){
|
||||
allServer=true;
|
||||
cmd="addblack ";
|
||||
}else {
|
||||
if(!jsonObject.containsKey("actor_id")){
|
||||
throw new Exception("缺少参数");
|
||||
}
|
||||
String id = jsonObject.getString("actor_id");
|
||||
cmd="addblack "+id;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if(dsid==0){
|
||||
allServer=true;
|
||||
cmd="reblack ";
|
||||
}else {
|
||||
if(!jsonObject.containsKey("actor_id")){
|
||||
throw new Exception("缺少参数");
|
||||
}
|
||||
String id2 = jsonObject.getString("actor_id");
|
||||
cmd="reblack "+id2;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(!jsonObject.containsKey("actor_id")){
|
||||
throw new Exception("缺少参数");
|
||||
}
|
||||
String actor_id = jsonObject.getString("actor_id");
|
||||
cmd="kick "+actor_id;
|
||||
break;
|
||||
case 6:
|
||||
if(!jsonObject.containsKey("actor_id")){
|
||||
throw new Exception("缺少参数");
|
||||
}
|
||||
String actor_id2 = jsonObject.getString("actor_id");
|
||||
if(!jsonObject.containsKey("actor_name")){
|
||||
cmd="changename "+actor_id2;
|
||||
}else {
|
||||
String actor_name = jsonObject.getString("actor_name");
|
||||
cmd="changename "+actor_id2+" "+actor_name;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(allServer){
|
||||
List<CUserInfo> coreUserInfoList = gsUserDao.findUserInfo(uid);
|
||||
if (coreUserInfoList == null) {
|
||||
List<CUserInfo> coreUserInfoList = gsUserDao.findUserInfo(uid);
|
||||
if (coreUserInfoList == null) {
|
||||
throw new Exception("帐号不存在");
|
||||
} else {
|
||||
if (coreUserInfoList.size() == 0)
|
||||
throw new Exception("帐号不存在");
|
||||
} else {
|
||||
if (coreUserInfoList.size() == 0)
|
||||
throw new Exception("帐号不存在");
|
||||
for (CUserInfo coreUserInfo : coreUserInfoList) {
|
||||
ServerInfo coreServerList = serverListDao.getServerinfo(coreUserInfo.getServerid());
|
||||
if (null == coreServerList) {
|
||||
continue;
|
||||
} else {
|
||||
String rpcString = RedisUtil.getInstence().getObject(RedisUserKey.LOGIC_SERVER_INFO, String.valueOf(coreServerList.getServer_id()), String.class, -1);
|
||||
if(null==rpcString){
|
||||
continue;
|
||||
}
|
||||
String thriftIp = rpcString.split(":")[0];
|
||||
String thriftPort = rpcString.split(":")[1];
|
||||
if (thriftIp == null || thriftIp.isEmpty() || null == thriftPort || thriftPort.isEmpty()) {
|
||||
continue;
|
||||
} else {
|
||||
cmd = cmd+coreUserInfo.getUserId();
|
||||
Result result = RPCClient.gmSend(cmd, thriftIp, thriftPort);
|
||||
//异常或者错误
|
||||
// if (result.getResultCode() != 0) {
|
||||
// continue;
|
||||
// }
|
||||
}
|
||||
}
|
||||
for (CUserInfo coreUserInfo : coreUserInfoList) {
|
||||
ServerInfo coreServerList = serverListDao.getServerinfo(coreUserInfo.getServerid());
|
||||
|
||||
if (null == coreServerList) {
|
||||
continue;
|
||||
}
|
||||
if (!allServer && !coreServerList.getServer_id().equals(String.valueOf(dsid))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}else {
|
||||
String cmd = "";
|
||||
switch (treat_type) {
|
||||
case 1:
|
||||
cmd = "silence " + coreUserInfo.getUserId() + " 1";
|
||||
break;
|
||||
case 2:
|
||||
cmd = "silence " + coreUserInfo.getUserId() + " 0";
|
||||
break;
|
||||
case 4:
|
||||
cmd = "addblack " + coreUserInfo.getUserId();
|
||||
break;
|
||||
case 5:
|
||||
|
||||
ServerInfo coreServerList = serverListDao.getServerinfo(dsid);
|
||||
if (null == coreServerList) {
|
||||
throw new Exception("应用不存在");
|
||||
} else {
|
||||
cmd = "reblack " + coreUserInfo.getUserId();
|
||||
|
||||
break;
|
||||
case 3:
|
||||
cmd = "kickuser " + coreUserInfo.getUserId();
|
||||
break;
|
||||
case 6:
|
||||
if (!jsonObject.containsKey("actor_id")) {
|
||||
throw new Exception("缺少参数");
|
||||
}
|
||||
if (!jsonObject.containsKey("actor_name")) {
|
||||
cmd = "changename " + coreUserInfo.getUserId();
|
||||
} else {
|
||||
String actor_name = jsonObject.getString("actor_name");
|
||||
cmd = "changename " + coreUserInfo.getUserId() + " " + actor_name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
String rpcString = RedisUtil.getInstence().getObject(RedisUserKey.LOGIC_SERVER_INFO, String.valueOf(coreServerList.getServer_id()), String.class, -1);
|
||||
if(null==rpcString){
|
||||
throw new Exception("serverAddress not exist");
|
||||
if (null == rpcString) {
|
||||
LOGGER.error("Exception send err rpcString dsid=>{},uid=>{},cmd=>{}", coreUserInfo.getServerid(), uid, cmd);
|
||||
continue;
|
||||
}
|
||||
String thriftIp = rpcString.split(":")[0];
|
||||
String thriftPort = rpcString.split(":")[1];
|
||||
String thriftPort = rpcString.split(":")[1];
|
||||
if (thriftIp == null || thriftIp.isEmpty() || null == thriftPort || thriftPort.isEmpty()) {
|
||||
throw new Exception("serverAddress not exist");
|
||||
} else {
|
||||
|
||||
Result result = RPCClient.gmSend(cmd, thriftIp, thriftPort);
|
||||
if (result.getResultCode() != 0) {
|
||||
throw new Exception(result.getResultMsg());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
Result result = RPCClient.gmSend(cmd, thriftIp, thriftPort);
|
||||
// 异常或者错误
|
||||
if (result.getResultCode() != 0) {
|
||||
LOGGER.error("Exception send err dsid=>{},uid=>{},cmd=>{}", coreUserInfo.getServerid(), uid, cmd);
|
||||
}
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,12 @@ public class ServerInfo {
|
|||
@Field(value = "open_type")
|
||||
private String open_type;
|
||||
|
||||
public ServerInfo(int _id, String name) {
|
||||
this._id = _id;
|
||||
this.server_id = String.valueOf(_id);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int get_id() {
|
||||
return _id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ public class CUserVo implements java.io.Serializable {
|
|||
public int isData; // 是否有数据 0:没有 1: 有
|
||||
|
||||
public int userId;
|
||||
public String openID;
|
||||
public String serverId;
|
||||
public String userName;
|
||||
|
||||
|
|
@ -22,6 +23,13 @@ public class CUserVo implements java.io.Serializable {
|
|||
|
||||
public String outLineTime; //离线时间
|
||||
|
||||
public String getOpenID() {
|
||||
return openID;
|
||||
}
|
||||
|
||||
public void setOpenID(String openID) {
|
||||
this.openID = openID;
|
||||
}
|
||||
|
||||
public void setIsData(int isData) {
|
||||
this.isData = isData;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<div style="width: 800px;height: 50px">
|
||||
<div style="width: 200px; float: left">
|
||||
<span style="float: left;line-height: 200%">服务器id:</span> <select class="select-default" id="serverId" >
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.server_id}"></option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.name}"></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
区服id:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select name="serverId" class="input-text" id="serverId"><!--下拉列表-->
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.server_id}"></option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.name}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
区服id:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select name="serverId" class="input-text" id="serverId"><!--下拉列表-->
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.server_id}"></option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.name}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
区服id:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select name="serverId" class="input-text" id="serverId"><!--下拉列表-->
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.server_id}"></option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.name}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -60,14 +60,7 @@
|
|||
<span class="USERIDS"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
角色id:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<textarea class="textarea" name="uid" placeholder="roleid"></textarea>
|
||||
<span class="UID"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
|
|
@ -177,23 +170,12 @@ function gameTitle() {
|
|||
erroCode.html('<span style="color: red; "></span>');
|
||||
}
|
||||
|
||||
if (serverId != 0){
|
||||
if (uid === '' || uid == null) {
|
||||
erroCode = $('.UID');
|
||||
erroCode.html('<span style="color: red; ">角色id不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
erroCode = $('.UID');
|
||||
erroCode.html('<span style="color: red; "></span>');
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"dsid": serverId,
|
||||
"uid": userIds,
|
||||
"actor_id": uid,
|
||||
"treat_type": type,
|
||||
"banTime": banTime,
|
||||
"banReason": banReason
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
区服id:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select name="serverId" class="input-text" id="serverId"><!--下拉列表-->
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.server_id}"></option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.name}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
区服id:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select name="serverId" class="input-text" id="serverId"><!--下拉列表-->
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.server_id}"></option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.name}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select name="serverId" class="input-text" id="serverId"><!--下拉列表-->
|
||||
<option value="0" selected = "selected">所有区服</option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.server_id}"></option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.name}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
区服id:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select name="serverId" class="input-text" id="serverId"><!--下拉列表-->
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.server_id}"></option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.name}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<select name="serverId" class="input-text" id="serverId"><!--下拉列表-->
|
||||
<option value="0" selected = "selected">所有区服</option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.server_id}"></option>
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.name}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
<thead>
|
||||
<tr class="text-c">
|
||||
<th width="500">ID</th>
|
||||
<th width="500">openID</th>
|
||||
<th width="500">serverID</th>
|
||||
<th width="500">角色名</th>
|
||||
<th width="200">等級</th>
|
||||
|
|
@ -55,6 +56,7 @@
|
|||
</div>
|
||||
<div th:case="1">
|
||||
<td th:text="${cUserVo.userId}" style="text-align: center;"></td>
|
||||
<td th:text="${cUserVo.openID}" style="text-align: center;"></td>
|
||||
<td th:text="${cUserVo.serverId}" style="text-align: center;"></td>
|
||||
<td th:text="${cUserVo.userName}" style="text-align: center;"></td>
|
||||
<td th:text="${cUserVo.level}" style="text-align: center;"></td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue