From 2ced517f70386310c1004007a99bb64aa33a43d3 Mon Sep 17 00:00:00 2001 From: imhao183 Date: Fri, 23 Apr 2021 10:27:48 +0800 Subject: [PATCH] =?UTF-8?q?revert=E5=AF=B9api=E5=8F=82=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E9=9C=80=E8=A6=81=E4=BF=9D=E6=8C=81?= =?UTF-8?q?SDK=E7=9A=84=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/channel/SubscriberChannelAction.java | 4 ++-- .../cn/wildfirechat/pojos/InputChannelSubscribe.java | 10 +++++----- .../java/cn/wildfirechat/sdk/ChannelServiceApi.java | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/broker/src/main/java/com/xiaoleilu/loServer/action/channel/SubscriberChannelAction.java b/broker/src/main/java/com/xiaoleilu/loServer/action/channel/SubscriberChannelAction.java index cb9d565d..dcc5766e 100755 --- a/broker/src/main/java/com/xiaoleilu/loServer/action/channel/SubscriberChannelAction.java +++ b/broker/src/main/java/com/xiaoleilu/loServer/action/channel/SubscriberChannelAction.java @@ -33,7 +33,7 @@ public class SubscriberChannelAction extends ChannelAction { public boolean action(Request request) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputChannelSubscribe input = getRequestBody(request.getNettyRequest(), InputChannelSubscribe.class); - if (input != null && !StringUtil.isNullOrEmpty(input.getUserId())) { + if (input != null && !StringUtil.isNullOrEmpty(input.getTarget())) { if(input.getSubscribe() > 0 && (channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Active_Subscribe) == 0) { response.setStatus(HttpResponseStatus.OK); RestResult result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_RIGHT); @@ -41,7 +41,7 @@ public class SubscriberChannelAction extends ChannelAction { return true; } WFCMessage.ListenChannel listenChannel = WFCMessage.ListenChannel.newBuilder().setChannelId(channelInfo.getTargetId()).setListen(input.getSubscribe()).build(); - sendApiMessage(input.getUserId(), IMTopic.ChannelListenTopic, listenChannel.toByteArray(), result -> { + sendApiMessage(input.getTarget(), IMTopic.ChannelListenTopic, listenChannel.toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); diff --git a/common/src/main/java/cn/wildfirechat/pojos/InputChannelSubscribe.java b/common/src/main/java/cn/wildfirechat/pojos/InputChannelSubscribe.java index 342871c3..8e143793 100644 --- a/common/src/main/java/cn/wildfirechat/pojos/InputChannelSubscribe.java +++ b/common/src/main/java/cn/wildfirechat/pojos/InputChannelSubscribe.java @@ -9,15 +9,15 @@ package cn.wildfirechat.pojos; public class InputChannelSubscribe { - private String userId; + private String target; private int subscribe; //1,订阅;0,取消订阅 - public String getUserId() { - return userId; + public String getTarget() { + return target; } - public void setUserId(String userId) { - this.userId = userId; + public void setTarget(String target) { + this.target = target; } public int getSubscribe() { diff --git a/sdk/src/main/java/cn/wildfirechat/sdk/ChannelServiceApi.java b/sdk/src/main/java/cn/wildfirechat/sdk/ChannelServiceApi.java index 4ed5e72e..e5a2dfa2 100644 --- a/sdk/src/main/java/cn/wildfirechat/sdk/ChannelServiceApi.java +++ b/sdk/src/main/java/cn/wildfirechat/sdk/ChannelServiceApi.java @@ -55,10 +55,10 @@ public class ChannelServiceApi { return httpUtils.httpJsonPost(path, messageData, SendMessageResult.class); } - public IMResult subscribe(String target) throws Exception { + public IMResult subscribe(String userId) throws Exception { String path = APIPath.Channel_Subscribe; InputChannelSubscribe input = new InputChannelSubscribe(); - input.setUserId(target); + input.setTarget(userId); input.setSubscribe(1); return httpUtils.httpJsonPost(path, input, Void.class); } @@ -66,7 +66,7 @@ public class ChannelServiceApi { public IMResult unsubscribe(String userId) throws Exception { String path = APIPath.Channel_Subscribe; InputChannelSubscribe input = new InputChannelSubscribe(); - input.setUserId(userId); + input.setTarget(userId); input.setSubscribe(0); return httpUtils.httpJsonPost(path, input, Void.class); }