重构
This commit is contained in:
@@ -40,6 +40,32 @@ abstract public class Action {
|
|||||||
public ChannelHandlerContext ctx;
|
public ChannelHandlerContext ctx;
|
||||||
public Response response;
|
public Response response;
|
||||||
|
|
||||||
|
protected class Result {
|
||||||
|
Object data;
|
||||||
|
ErrorCode errorCode;
|
||||||
|
|
||||||
|
public Result(ErrorCode errorCode) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result(ErrorCode errorCode, Object data) {
|
||||||
|
this.data = data;
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ErrorCode getErrorCode() {
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected interface ApiCallback {
|
||||||
|
Result onResult(byte[] response);
|
||||||
|
}
|
||||||
|
|
||||||
public ErrorCode preAction(Request request, Response response) {
|
public ErrorCode preAction(Request request, Response response) {
|
||||||
if (getClass().getAnnotation(RequireAuthentication.class) != null) {
|
if (getClass().getAnnotation(RequireAuthentication.class) != null) {
|
||||||
//do authentication
|
//do authentication
|
||||||
@@ -94,4 +120,9 @@ abstract public class Action {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setResponseContent(RestResult result) {
|
||||||
|
response.setStatus(HttpResponseStatus.OK);
|
||||||
|
response.setContent(new Gson().toJson(result));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-5
@@ -45,11 +45,7 @@ public class AddFriendRequestAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,17 +41,11 @@ public class AddGroupMemberAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -33,10 +33,6 @@ abstract public class AdminAction extends Action {
|
|||||||
SECRET_KEY = secretKey;
|
SECRET_KEY = secretKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected interface Callback {
|
|
||||||
void onSuccess(byte[] response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setNoCheckTime(String noCheckTime) {
|
public static void setNoCheckTime(String noCheckTime) {
|
||||||
try {
|
try {
|
||||||
NO_CHECK_TIME = Boolean.parseBoolean(noCheckTime);
|
NO_CHECK_TIME = Boolean.parseBoolean(noCheckTime);
|
||||||
@@ -97,12 +93,13 @@ abstract public class AdminAction extends Action {
|
|||||||
response.send();
|
response.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendApiMessage(String fromUser, String topic, byte[] message, Callback callback) {
|
protected void sendApiMessage(String fromUser, String topic, byte[] message, ApiCallback callback) {
|
||||||
ServerAPIHelper.sendRequest(fromUser, null, topic, message, new ServerAPIHelper.Callback() {
|
ServerAPIHelper.sendRequest(fromUser, null, topic, message, new ServerAPIHelper.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(byte[] result) {
|
public void onSuccess(byte[] result) {
|
||||||
if(callback != null) {
|
if(callback != null) {
|
||||||
callback.onSuccess(result);
|
Result r = callback.onResult(result);
|
||||||
|
sendResponse(response, r.getErrorCode(), r.getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
package com.xiaoleilu.loServer.action.admin;
|
package com.xiaoleilu.loServer.action.admin;
|
||||||
|
|
||||||
import cn.wildfirechat.common.APIPath;
|
import cn.wildfirechat.common.APIPath;
|
||||||
|
import cn.wildfirechat.common.ErrorCode;
|
||||||
import cn.wildfirechat.pojos.InputGetAlias;
|
import cn.wildfirechat.pojos.InputGetAlias;
|
||||||
import cn.wildfirechat.pojos.InputGetFriendList;
|
import cn.wildfirechat.pojos.InputGetFriendList;
|
||||||
import cn.wildfirechat.pojos.OutputGetAlias;
|
import cn.wildfirechat.pojos.OutputGetAlias;
|
||||||
@@ -49,9 +50,8 @@ public class AliasGetAction extends AdminAction {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result = RestResult.ok(out);
|
setResponseContent(RestResult.ok(out));
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,7 @@ public class AliasPutAction extends AdminAction {
|
|||||||
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
||||||
InputUpdateAlias input = getRequestBody(request.getNettyRequest(), InputUpdateAlias.class);
|
InputUpdateAlias input = getRequestBody(request.getNettyRequest(), InputUpdateAlias.class);
|
||||||
ErrorCode errorCode = messagesStore.setFriendAliasRequest(input.getOperator(), input.getTargetId(), input.getAlias(), new long[1]);
|
ErrorCode errorCode = messagesStore.setFriendAliasRequest(input.getOperator(), input.getTargetId(), input.getAlias(), new long[1]);
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(errorCode));
|
||||||
RestResult result = RestResult.resultOf(errorCode);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,17 +46,11 @@ public class BlacklistAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,9 +45,7 @@ public class BlacklistGetAction extends AdminAction {
|
|||||||
list.add(data.getFriendUid());
|
list.add(data.getFriendUid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.ok(new OutputStringList(list)));
|
||||||
RestResult result = RestResult.ok(new OutputStringList(list));
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,9 +49,7 @@ public class BlockUserAction extends AdminAction {
|
|||||||
|
|
||||||
sendResponse(response, ErrorCode.ERROR_CODE_SUCCESS, null);
|
sendResponse(response, ErrorCode.ERROR_CODE_SUCCESS, null);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-5
@@ -46,16 +46,14 @@ public class BroadcastMessageAction extends AdminAction {
|
|||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
long messageId = byteBuf.readLong();
|
long messageId = byteBuf.readLong();
|
||||||
long count = byteBuf.readLong();
|
long count = byteBuf.readLong();
|
||||||
sendResponse(response, null, new BroadMessageResult(messageId, count));
|
return new Result(errorCode, new BroadMessageResult(messageId, count));
|
||||||
} else {
|
} else {
|
||||||
sendResponse(response, errorCode, null);
|
return new Result(errorCode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class CheckUserOnlineAction extends AdminAction {
|
|||||||
if (inputUserId == null || !StringUtil.isNullOrEmpty(inputUserId.getUserId())) {
|
if (inputUserId == null || !StringUtil.isNullOrEmpty(inputUserId.getUserId())) {
|
||||||
sendApiMessage(inputUserId.getUserId(), ServerAPIHelper.CHECK_USER_ONLINE_REQUEST, inputUserId.getUserId().getBytes(), res -> {
|
sendApiMessage(inputUserId.getUserId(), ServerAPIHelper.CHECK_USER_ONLINE_REQUEST, inputUserId.getUserId().getBytes(), res -> {
|
||||||
OutputCheckUserOnline out = new Gson().fromJson(new String(res), OutputCheckUserOnline.class);
|
OutputCheckUserOnline out = new Gson().fromJson(new String(res), OutputCheckUserOnline.class);
|
||||||
sendResponse(response, null, out);
|
return new Result(ErrorCode.ERROR_CODE_SUCCESS, out);
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -53,16 +53,14 @@ public class CreateChannelAction extends AdminAction {
|
|||||||
byte[] data = new byte[byteBuf.readableBytes()];
|
byte[] data = new byte[byteBuf.readableBytes()];
|
||||||
byteBuf.readBytes(data);
|
byteBuf.readBytes(data);
|
||||||
String channelId = new String(data);
|
String channelId = new String(data);
|
||||||
sendResponse(response, null, new OutputCreateChannel(channelId));
|
return new Result(ErrorCode.ERROR_CODE_SUCCESS, new OutputCreateChannel(channelId));
|
||||||
} else {
|
} else {
|
||||||
sendResponse(response, errorCode, null);
|
return new Result(errorCode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,17 +53,10 @@ public class CreateChatroomAction extends AdminAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WFCMessage.ChatroomInfo info = inputCreateChatroom.toChatroomInfo();
|
WFCMessage.ChatroomInfo info = inputCreateChatroom.toChatroomInfo();
|
||||||
|
|
||||||
messagesStore.createChatroom(inputCreateChatroom.getChatroomId(), info);
|
messagesStore.createChatroom(inputCreateChatroom.getChatroomId(), info);
|
||||||
|
setResponseContent(RestResult.ok(new OutputCreateChatroom(inputCreateChatroom.getChatroomId())));
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result = RestResult.ok(new OutputCreateChatroom(inputCreateChatroom.getChatroomId()));
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,16 +46,14 @@ public class CreateGroupAction extends AdminAction {
|
|||||||
byte[] data = new byte[byteBuf.readableBytes()];
|
byte[] data = new byte[byteBuf.readableBytes()];
|
||||||
byteBuf.readBytes(data);
|
byteBuf.readBytes(data);
|
||||||
String groupId = new String(data);
|
String groupId = new String(data);
|
||||||
sendResponse(response, null, new OutputCreateGroupResult(groupId));
|
return new Result(ErrorCode.ERROR_CODE_SUCCESS, new OutputCreateGroupResult(groupId));
|
||||||
} else {
|
} else {
|
||||||
sendResponse(response, errorCode, null);
|
return new Result(errorCode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -78,16 +78,10 @@ public class CreateRobotAction extends AdminAction {
|
|||||||
if (StringUtil.isNullOrEmpty(inputCreateRobot.getSecret())) {
|
if (StringUtil.isNullOrEmpty(inputCreateRobot.getSecret())) {
|
||||||
inputCreateRobot.setSecret(UUIDGenerator.getUUID());
|
inputCreateRobot.setSecret(UUIDGenerator.getUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
messagesStore.addRobot(inputCreateRobot.toRobot());
|
messagesStore.addRobot(inputCreateRobot.toRobot());
|
||||||
|
setResponseContent(RestResult.ok(new OutputCreateRobot(inputCreateRobot.getUserId(), inputCreateRobot.getSecret())));
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result = RestResult.ok(new OutputCreateRobot(inputCreateRobot.getUserId(), inputCreateRobot.getSecret()));
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,19 +89,13 @@ public class CreateUserAction extends AdminAction {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Utility.printExecption(LOG, e, IMExceptionEvent.EventType.ADMIN_API_Exception);
|
Utility.printExecption(LOG, e, IMExceptionEvent.EventType.ADMIN_API_Exception);
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.ERROR_CODE_SERVER_ERROR, e.getMessage()));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.ERROR_CODE_SERVER_ERROR, e.getMessage());
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.ok(new OutputCreateUser(inputCreateUser.getUserId(), inputCreateUser.getName())));
|
||||||
RestResult result = RestResult.ok(new OutputCreateUser(inputCreateUser.getUserId(), inputCreateUser.getName()));
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,17 +41,10 @@ public class DestoryChatroomAction extends AdminAction {
|
|||||||
InputDestoryChatroom inputDestoryChatroom = gson.fromJson(content, InputDestoryChatroom.class);
|
InputDestoryChatroom inputDestoryChatroom = gson.fromJson(content, InputDestoryChatroom.class);
|
||||||
if (inputDestoryChatroom != null
|
if (inputDestoryChatroom != null
|
||||||
&& !StringUtil.isNullOrEmpty(inputDestoryChatroom.getChatroomId())) {
|
&& !StringUtil.isNullOrEmpty(inputDestoryChatroom.getChatroomId())) {
|
||||||
|
|
||||||
messagesStore.destoryChatroom(inputDestoryChatroom.getChatroomId());
|
messagesStore.destoryChatroom(inputDestoryChatroom.getChatroomId());
|
||||||
|
setResponseContent(RestResult.ok());
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result = RestResult.ok();
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,24 +43,11 @@ public class DestroyUserAction extends AdminAction {
|
|||||||
WFCMessage.IDBuf idBuf = WFCMessage.IDBuf.newBuilder().setId(inputDestroyUser.getUserId()).build();
|
WFCMessage.IDBuf idBuf = WFCMessage.IDBuf.newBuilder().setId(inputDestroyUser.getUserId()).build();
|
||||||
sendApiMessage(inputDestroyUser.getUserId(), IMTopic.DestroyUserTopic, idBuf.toByteArray(), result -> {
|
sendApiMessage(inputDestroyUser.getUserId(), IMTopic.DestroyUserTopic, idBuf.toByteArray(), result -> {
|
||||||
ErrorCode errorCode1 = ErrorCode.fromCode(result[0]);
|
ErrorCode errorCode1 = ErrorCode.fromCode(result[0]);
|
||||||
if (errorCode1 == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode1);
|
||||||
//ba errorcode qudiao
|
|
||||||
byte[] data = new byte[result.length -1];
|
|
||||||
for (int i = 0; i < data.length; i++) {
|
|
||||||
data[i] = result[i+1];
|
|
||||||
}
|
|
||||||
String token = Base64.getEncoder().encodeToString(data);
|
|
||||||
|
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode1, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,17 +41,11 @@ public class DismissGroupAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -49,17 +49,11 @@ public class FriendRelationAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -47,9 +47,7 @@ public class FriendRelationGetAction extends AdminAction {
|
|||||||
list.add(data.getFriendUid());
|
list.add(data.getFriendUid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.ok(new OutputStringList(list)));
|
||||||
RestResult result = RestResult.ok(new OutputStringList(list));
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,14 +46,9 @@ public class GetChatroomInfoAction extends AdminAction {
|
|||||||
} else {
|
} else {
|
||||||
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(result);
|
||||||
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-7
@@ -58,14 +58,9 @@ public class GetChatroomMembersAction extends AdminAction {
|
|||||||
} else {
|
} else {
|
||||||
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(result);
|
||||||
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ public class GetGroupInfoAction extends AdminAction {
|
|||||||
&& (!StringUtil.isNullOrEmpty(inputGetGroup.getGroupId()))) {
|
&& (!StringUtil.isNullOrEmpty(inputGetGroup.getGroupId()))) {
|
||||||
|
|
||||||
WFCMessage.GroupInfo groupInfo = messagesStore.getGroupInfo(inputGetGroup.getGroupId());
|
WFCMessage.GroupInfo groupInfo = messagesStore.getGroupInfo(inputGetGroup.getGroupId());
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result;
|
RestResult result;
|
||||||
if (groupInfo == null) {
|
if (groupInfo == null) {
|
||||||
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
||||||
@@ -57,12 +55,9 @@ public class GetGroupInfoAction extends AdminAction {
|
|||||||
pojoGroupInfo.setType(groupInfo.getType());
|
pojoGroupInfo.setType(groupInfo.getType());
|
||||||
result = RestResult.ok(pojoGroupInfo);
|
result = RestResult.ok(pojoGroupInfo);
|
||||||
}
|
}
|
||||||
|
setResponseContent(result);
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ public class GetGroupMembersAction extends AdminAction {
|
|||||||
List<WFCMessage.GroupMember> members = new ArrayList<>();
|
List<WFCMessage.GroupMember> members = new ArrayList<>();
|
||||||
ErrorCode errorCode = messagesStore.getGroupMembers(null, inputGetGroup.getGroupId(), 0, members);
|
ErrorCode errorCode = messagesStore.getGroupMembers(null, inputGetGroup.getGroupId(), 0, members);
|
||||||
|
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result;
|
RestResult result;
|
||||||
if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) {
|
if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
result = RestResult.resultOf(errorCode);
|
result = RestResult.resultOf(errorCode);
|
||||||
@@ -69,11 +67,9 @@ public class GetGroupMembersAction extends AdminAction {
|
|||||||
result = RestResult.ok(out);
|
result = RestResult.ok(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setContent(new Gson().toJson(result));
|
setResponseContent(result);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ public class GetIMTokenAction extends AdminAction {
|
|||||||
}
|
}
|
||||||
String token = Base64.getEncoder().encodeToString(data);
|
String token = Base64.getEncoder().encodeToString(data);
|
||||||
|
|
||||||
sendResponse(response, null, new OutputGetIMTokenData(userId, token));
|
return new Result(errorCode1, new OutputGetIMTokenData(userId, token));
|
||||||
} else {
|
} else {
|
||||||
sendResponse(response, errorCode1, null);
|
return new Result(errorCode1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+2
-5
@@ -40,7 +40,6 @@ public class GetSystemSettingAction extends AdminAction {
|
|||||||
if (inputUserId != null) {
|
if (inputUserId != null) {
|
||||||
SystemSettingPojo output = messagesStore.getSystemSetting(inputUserId.id);
|
SystemSettingPojo output = messagesStore.getSystemSetting(inputUserId.id);
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result;
|
RestResult result;
|
||||||
if (output == null) {
|
if (output == null) {
|
||||||
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
||||||
@@ -48,11 +47,9 @@ public class GetSystemSettingAction extends AdminAction {
|
|||||||
result = RestResult.ok(output);
|
result = RestResult.ok(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setContent(new Gson().toJson(result));
|
setResponseContent(result);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ public class GetUserAction extends AdminAction {
|
|||||||
user = messagesStore.getUserInfoByMobile(inputUserId.getMobile());
|
user = messagesStore.getUserInfoByMobile(inputUserId.getMobile());
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result;
|
RestResult result;
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
||||||
@@ -56,11 +55,9 @@ public class GetUserAction extends AdminAction {
|
|||||||
result = RestResult.ok(InputOutputUserInfo.fromPbUser(user));
|
result = RestResult.ok(InputOutputUserInfo.fromPbUser(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setContent(new Gson().toJson(result));
|
setResponseContent(result);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -31,11 +31,10 @@ public class GetUserBlockListAction extends AdminAction {
|
|||||||
@Override
|
@Override
|
||||||
public boolean action(Request request) {
|
public boolean action(Request request) {
|
||||||
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
OutputUserBlockStatusList list = new OutputUserBlockStatusList();
|
OutputUserBlockStatusList list = new OutputUserBlockStatusList();
|
||||||
list.setStatusList(messagesStore.getUserStatusList());
|
list.setStatusList(messagesStore.getUserStatusList());
|
||||||
RestResult result = RestResult.ok(list);
|
RestResult result = RestResult.ok(list);
|
||||||
response.setContent(new Gson().toJson(result));
|
setResponseContent(result);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -39,13 +39,9 @@ public class GetUserBlockStatusAction extends AdminAction {
|
|||||||
&& !StringUtil.isNullOrEmpty(inputUserId.getUserId())) {
|
&& !StringUtil.isNullOrEmpty(inputUserId.getUserId())) {
|
||||||
|
|
||||||
int status = messagesStore.getUserStatus(inputUserId.getUserId());
|
int status = messagesStore.getUserStatus(inputUserId.getUserId());
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.ok(new OutputUserStatus(status)));
|
||||||
RestResult result = RestResult.ok(new OutputUserStatus(status));
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,16 +45,12 @@ public class GetUserGroupsAction extends AdminAction {
|
|||||||
&& (!StringUtil.isNullOrEmpty(inputUserId.getUserId()))) {
|
&& (!StringUtil.isNullOrEmpty(inputUserId.getUserId()))) {
|
||||||
|
|
||||||
Set<String> groupIds = messagesStore.getUserGroupIds(inputUserId.getUserId());
|
Set<String> groupIds = messagesStore.getUserGroupIds(inputUserId.getUserId());
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
OutputGroupIds outputGroupIds = new OutputGroupIds();
|
OutputGroupIds outputGroupIds = new OutputGroupIds();
|
||||||
outputGroupIds.setGroupIds(new ArrayList<>(groupIds));
|
outputGroupIds.setGroupIds(new ArrayList<>(groupIds));
|
||||||
RestResult result = RestResult.ok(outputGroupIds);
|
RestResult result = RestResult.ok(outputGroupIds);
|
||||||
|
setResponseContent(result);
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-8
@@ -41,17 +41,11 @@ public class KickoffGroupMemberAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+1
-3
@@ -38,9 +38,7 @@ public class KickoffUserClientAction extends AdminAction {
|
|||||||
sessionsStore.kickoffUserClient(pojo.getFirst(), pojo.getSecond());
|
sessionsStore.kickoffUserClient(pojo.getFirst(), pojo.getSecond());
|
||||||
sendResponse(response, ErrorCode.ERROR_CODE_SUCCESS, null);
|
sendResponse(response, ErrorCode.ERROR_CODE_SUCCESS, null);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,17 +41,11 @@ public class ModifyGroupInfoAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+2
-8
@@ -41,17 +41,11 @@ public class ModifyGroupMemberAliasAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+3
-5
@@ -45,16 +45,14 @@ public class MulticastMessageAction extends AdminAction {
|
|||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
long messageId = byteBuf.readLong();
|
long messageId = byteBuf.readLong();
|
||||||
long timestamp = byteBuf.readLong();
|
long timestamp = byteBuf.readLong();
|
||||||
sendResponse(response, null, new MultiMessageResult(messageId, timestamp));
|
return new Result(errorCode, new MultiMessageResult(messageId, timestamp));
|
||||||
} else {
|
} else {
|
||||||
sendResponse(response, errorCode, null);
|
return new Result(errorCode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+2
-8
@@ -40,22 +40,16 @@ public class PutSystemSettingAction extends AdminAction {
|
|||||||
if (inputUserId != null
|
if (inputUserId != null
|
||||||
&& (!StringUtil.isNullOrEmpty(inputUserId.value) || !StringUtil.isNullOrEmpty(inputUserId.desc))) {
|
&& (!StringUtil.isNullOrEmpty(inputUserId.value) || !StringUtil.isNullOrEmpty(inputUserId.desc))) {
|
||||||
|
|
||||||
|
|
||||||
boolean success = messagesStore.updateSystemSetting(inputUserId.id, inputUserId.value, inputUserId.desc);
|
boolean success = messagesStore.updateSystemSetting(inputUserId.id, inputUserId.value, inputUserId.desc);
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result;
|
RestResult result;
|
||||||
if (!success) {
|
if (!success) {
|
||||||
result = RestResult.resultOf(ErrorCode.ERROR_CODE_SERVER_ERROR);
|
result = RestResult.resultOf(ErrorCode.ERROR_CODE_SERVER_ERROR);
|
||||||
} else {
|
} else {
|
||||||
result = RestResult.ok();
|
result = RestResult.ok();
|
||||||
}
|
}
|
||||||
|
setResponseContent(result);
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,17 +41,11 @@ public class QuitGroupMemberAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -44,13 +44,11 @@ public class RecallMessageAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
sendResponse(response, errorCode, null);
|
return new Result(errorCode);
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+2
-4
@@ -44,13 +44,11 @@ public class RecallMultiCastMessageAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
sendResponse(response, errorCode, null);
|
return new Result(errorCode);
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -51,10 +51,7 @@ public class RelationGetAction extends AdminAction {
|
|||||||
out.alias = data.getAlias();
|
out.alias = data.getAlias();
|
||||||
out.extra = data.getExtra();
|
out.extra = data.getExtra();
|
||||||
}
|
}
|
||||||
|
setResponseContent(RestResult.ok(out));
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result = RestResult.ok(out);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,16 +46,14 @@ public class SendMessageAction extends AdminAction {
|
|||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
long messageId = byteBuf.readLong();
|
long messageId = byteBuf.readLong();
|
||||||
long timestamp = byteBuf.readLong();
|
long timestamp = byteBuf.readLong();
|
||||||
sendResponse(response, null, new SendMessageResult(messageId, timestamp));
|
return new Result(errorCode, new SendMessageResult(messageId, timestamp));
|
||||||
} else {
|
} else {
|
||||||
sendResponse(response, errorCode, null);
|
return new Result(errorCode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+1
-3
@@ -38,9 +38,7 @@ public class SensitiveWordAddAction extends AdminAction {
|
|||||||
response.setStatus(HttpResponseStatus.OK);
|
response.setStatus(HttpResponseStatus.OK);
|
||||||
sendResponse(response, errorCode, null);
|
sendResponse(response, errorCode, null);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -39,9 +39,7 @@ public class SensitiveWordDeleteAction extends AdminAction {
|
|||||||
|
|
||||||
sendResponse(response, errorCode, null);
|
sendResponse(response, errorCode, null);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,17 +41,11 @@ public class SetGroupManagerAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -41,17 +41,11 @@ public class TransferGroupAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
sendResponse(response, null, null);
|
|
||||||
} else {
|
|
||||||
sendResponse(response, errorCode, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -50,13 +50,9 @@ public class UpdateUserAction extends AdminAction {
|
|||||||
&& inputCreateUser.flag > 0) {
|
&& inputCreateUser.flag > 0) {
|
||||||
|
|
||||||
ErrorCode errorCode = messagesStore.updateUserInfo(inputCreateUser.userInfo, inputCreateUser.flag);
|
ErrorCode errorCode = messagesStore.updateUserInfo(inputCreateUser.userInfo, inputCreateUser.flag);
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(errorCode));
|
||||||
RestResult result = RestResult.resultOf(errorCode);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ public class GetChannelAction extends ChannelAction {
|
|||||||
@Override
|
@Override
|
||||||
public boolean action(Request request) {
|
public boolean action(Request request) {
|
||||||
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.ok(OutputGetChannelInfo.fromPbInfo(channelInfo)));
|
||||||
RestResult result = RestResult.ok(OutputGetChannelInfo.fromPbInfo(channelInfo));
|
|
||||||
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-4
@@ -36,10 +36,7 @@ public class GetChannelSubscribersAction extends ChannelAction {
|
|||||||
OutputStringList outputStringList = new OutputStringList();
|
OutputStringList outputStringList = new OutputStringList();
|
||||||
outputStringList.setList(new ArrayList<>());
|
outputStringList.setList(new ArrayList<>());
|
||||||
outputStringList.getList().addAll(messagesStore.getChannelSubscriber(channelInfo.getTargetId()));
|
outputStringList.getList().addAll(messagesStore.getChannelSubscriber(channelInfo.getTargetId()));
|
||||||
|
setResponseContent(RestResult.ok(outputStringList));
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result = RestResult.ok(outputStringList);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public class GetUserAction extends ChannelAction {
|
|||||||
user = messagesStore.getUserInfoByMobile(inputUserId.getMobile());
|
user = messagesStore.getUserInfoByMobile(inputUserId.getMobile());
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result;
|
RestResult result;
|
||||||
|
|
||||||
if (user == null || StringUtil.isNullOrEmpty(user.getName())) {
|
if (user == null || StringUtil.isNullOrEmpty(user.getName())) {
|
||||||
@@ -70,11 +69,9 @@ public class GetUserAction extends ChannelAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setContent(new Gson().toJson(result));
|
setResponseContent(result);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -45,9 +45,7 @@ public class ModifyChannelProfileAction extends ChannelAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,9 +65,7 @@ public class SendMessageAction extends ChannelAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+1
-3
@@ -54,9 +54,7 @@ public class SubscriberChannelAction extends ChannelAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,9 +51,7 @@ public class AddGroupMemberAction extends RobotAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -60,9 +60,7 @@ public class CreateGroupAction extends RobotAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -32,9 +32,7 @@ public class DeleteCallbackAction extends RobotAction {
|
|||||||
robot = robot.toBuilder().clearCallback().setState(0).build();
|
robot = robot.toBuilder().clearCallback().setState(0).build();
|
||||||
messagesStore.addRobot(robot);
|
messagesStore.addRobot(robot);
|
||||||
}
|
}
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.ok());
|
||||||
RestResult result = RestResult.ok();
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,9 +51,7 @@ public class DismissGroupAction extends RobotAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ public class GetCallbackAction extends RobotAction {
|
|||||||
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
||||||
RobotCallbackPojo out = new RobotCallbackPojo();
|
RobotCallbackPojo out = new RobotCallbackPojo();
|
||||||
out.setUrl(robot.getCallback());
|
out.setUrl(robot.getCallback());
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.ok(out));
|
||||||
RestResult result = RestResult.ok(out);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ public class GetGroupInfoAction extends RobotAction {
|
|||||||
&& (!StringUtil.isNullOrEmpty(inputGetGroup.getGroupId()))) {
|
&& (!StringUtil.isNullOrEmpty(inputGetGroup.getGroupId()))) {
|
||||||
|
|
||||||
WFCMessage.GroupInfo groupInfo = messagesStore.getGroupInfo(inputGetGroup.getGroupId());
|
WFCMessage.GroupInfo groupInfo = messagesStore.getGroupInfo(inputGetGroup.getGroupId());
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result;
|
RestResult result;
|
||||||
if (groupInfo == null) {
|
if (groupInfo == null) {
|
||||||
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
||||||
@@ -56,12 +54,9 @@ public class GetGroupInfoAction extends RobotAction {
|
|||||||
pojoGroupInfo.setType(groupInfo.getType());
|
pojoGroupInfo.setType(groupInfo.getType());
|
||||||
result = RestResult.ok(pojoGroupInfo);
|
result = RestResult.ok(pojoGroupInfo);
|
||||||
}
|
}
|
||||||
|
setResponseContent(result);
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ public class GetGroupMembersAction extends RobotAction {
|
|||||||
|
|
||||||
List<WFCMessage.GroupMember> members = new ArrayList<>();
|
List<WFCMessage.GroupMember> members = new ArrayList<>();
|
||||||
ErrorCode errorCode = messagesStore.getGroupMembers(null, inputGetGroup.getGroupId(), 0, members);
|
ErrorCode errorCode = messagesStore.getGroupMembers(null, inputGetGroup.getGroupId(), 0, members);
|
||||||
|
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result;
|
RestResult result;
|
||||||
if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) {
|
if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
result = RestResult.resultOf(errorCode);
|
result = RestResult.resultOf(errorCode);
|
||||||
@@ -77,11 +74,9 @@ public class GetGroupMembersAction extends RobotAction {
|
|||||||
result = RestResult.ok(out);
|
result = RestResult.ok(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setContent(new Gson().toJson(result));
|
setResponseContent(result);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,19 +43,15 @@ public class GetUserAction extends RobotAction {
|
|||||||
user = messagesStore.getUserInfoByMobile(inputUserId.getMobile());
|
user = messagesStore.getUserInfoByMobile(inputUserId.getMobile());
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result;
|
RestResult result;
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
||||||
} else {
|
} else {
|
||||||
result = RestResult.ok(InputOutputUserInfo.fromPbUser(user));
|
result = RestResult.ok(InputOutputUserInfo.fromPbUser(user));
|
||||||
}
|
}
|
||||||
|
setResponseContent(result);
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -51,9 +51,7 @@ public class KickoffGroupMemberAction extends RobotAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -51,9 +51,7 @@ public class ModifyGroupInfoAction extends RobotAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+1
-3
@@ -51,9 +51,7 @@ public class ModifyGroupMemberAliasAction extends RobotAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -51,9 +51,7 @@ public class QuitGroupMemberAction extends RobotAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -54,9 +54,7 @@ public class SendMessageAction extends RobotAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -35,14 +35,9 @@ public class SetCallbackAction extends RobotAction {
|
|||||||
robot = robot.toBuilder().setCallback(input.getUrl()).setState(1).build();
|
robot = robot.toBuilder().setCallback(input.getUrl()).setState(1).build();
|
||||||
messagesStore.addRobot(robot);
|
messagesStore.addRobot(robot);
|
||||||
}
|
}
|
||||||
|
setResponseContent(RestResult.ok());
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result = RestResult.ok();
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,9 +51,7 @@ public class TransferGroupAction extends RobotAction {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER));
|
||||||
RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER);
|
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ public class UpdateProfileAction extends RobotAction {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
|
||||||
RestResult result = RestResult.ok();
|
RestResult result = RestResult.ok();
|
||||||
if(modified) {
|
if(modified) {
|
||||||
try {
|
try {
|
||||||
@@ -86,8 +85,7 @@ public class UpdateProfileAction extends RobotAction {
|
|||||||
result.setErrorCode(ErrorCode.ERROR_CODE_SERVER_ERROR);
|
result.setErrorCode(ErrorCode.ERROR_CODE_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setResponseContent(result);
|
||||||
response.setContent(new Gson().toJson(result));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user