channel api添加检查是否是订阅者的接口
This commit is contained in:
@@ -9,7 +9,6 @@ import org.apache.commons.codec.digest.DigestUtils;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.wildfirechat.proto.ProtoConstants.ApplicationType.ApplicationType_Channel;
|
||||
import static cn.wildfirechat.proto.ProtoConstants.ApplicationType.ApplicationType_Robot;
|
||||
|
||||
//仅专业版支持,社区版不支持
|
||||
public class ChannelServiceApi {
|
||||
@@ -80,6 +79,12 @@ public class ChannelServiceApi {
|
||||
return channelHttpUtils.httpJsonPost(path, null, OutputStringList.class);
|
||||
}
|
||||
|
||||
public IMResult<Boolean> isSubscriber(String userId) throws Exception {
|
||||
String path = APIPath.Channel_Is_Subscriber;
|
||||
InputUserId input = new InputUserId(userId);
|
||||
return channelHttpUtils.httpJsonPost(path, input, Boolean.class);
|
||||
}
|
||||
|
||||
public IMResult<OutputApplicationUserInfo> applicationGetUserInfo(String authCode) throws Exception {
|
||||
String path = APIPath.Channel_Application_Get_UserInfo;
|
||||
InputApplicationGetUserInfo input = new InputApplicationGetUserInfo();
|
||||
|
||||
@@ -50,10 +50,10 @@ public class Main {
|
||||
|
||||
|
||||
//admin使用的是18080端口,超级管理接口,理论上不能对外开放端口,也不能让非内部服务知悉密钥。
|
||||
testAdmin();
|
||||
// testAdmin();
|
||||
|
||||
//Robot和Channel都是使用的80端口,第三方可以创建或者为第三方创建,第三方可以使用robot或者channel与IM系统进行对接。
|
||||
testRobot();
|
||||
// testRobot();
|
||||
testChannel();
|
||||
}
|
||||
|
||||
@@ -1443,6 +1443,14 @@ public class Main {
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<Boolean> booleanIMResult = channelServiceApi.isSubscriber("userId2");
|
||||
if(booleanIMResult != null && booleanIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && booleanIMResult.getResult()) {
|
||||
System.out.println("is subscriber success");
|
||||
} else {
|
||||
System.out.println("is subscriber failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
resultVoid = channelServiceApi.unsubscribe("userId2");
|
||||
if (resultVoid != null && resultVoid.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("unsubscriber done");
|
||||
|
||||
Reference in New Issue
Block a user