修正sdk好友和频道接口错误

This commit is contained in:
imhao183
2019-12-24 11:43:47 +08:00
parent 6c5354d17b
commit c7579877a1
6 changed files with 81 additions and 5 deletions
@@ -15,12 +15,12 @@ public class FriendAdmin {
return AdminHttpUtils.httpJsonPost(path, input, Void.class);
}
public static IMResult<Void> getFriendStatusList(String userId, int status) throws Exception {
public static IMResult<OutputStringList> getFriendStatusList(String userId, int status) throws Exception {
String path = APIPath.Friend_Get_List;
InputGetFriendList input = new InputGetFriendList();
input.setUserId(userId);
input.setStatus(status);
return AdminHttpUtils.httpJsonPost(path, input, Void.class);
return AdminHttpUtils.httpJsonPost(path, input, OutputStringList.class);
}
}
@@ -342,7 +342,7 @@ public class Main {
System.out.println("multi message failure");
System.exit(-1);
}
IMResult<SystemSettingPojo> resultGetSystemSetting = GeneralAdmin.getSystemSetting(Group_Max_Member_Count);
if (resultGetSystemSetting != null && resultGetSystemSetting.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("success");
@@ -369,6 +369,7 @@ public class Main {
InputCreateChannel inputCreateChannel = new InputCreateChannel();
inputCreateChannel.setName("MyChannel");
inputCreateChannel.setOwner("user1");
IMResult<OutputCreateChannel> resultCreateChannel = GeneralAdmin.createChannel(inputCreateChannel);
if (resultCreateChannel != null && resultCreateChannel.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("success");
@@ -377,6 +378,56 @@ public class Main {
System.exit(-1);
}
//***********************************************
//**** 好友相关功能
//***********************************************
//先创建2个用户
userInfo = new InputOutputUserInfo();
userInfo.setUserId("ff1");
userInfo.setName("ff1");
userInfo.setMobile("13800000000");
userInfo.setDisplayName("ff1");
resultCreateUser = UserAdmin.createUser(userInfo);
if (resultCreateUser != null && resultCreateUser.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("Create user " + resultCreateUser.getResult().getName() + " success");
} else {
System.out.println("Create user failure");
System.exit(-1);
}
userInfo = new InputOutputUserInfo();
userInfo.setUserId("ff2");
userInfo.setName("ff2");
userInfo.setMobile("13800000001");
userInfo.setDisplayName("ff2");
resultCreateUser = UserAdmin.createUser(userInfo);
if (resultCreateUser != null && resultCreateUser.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("Create user " + resultCreateUser.getResult().getName() + " success");
} else {
System.out.println("Create user failure");
System.exit(-1);
}
IMResult<Void> updateFriendStatusResult = FriendAdmin.updateFriendStatus("ff1", "ff2", 1);
if (updateFriendStatusResult != null && updateFriendStatusResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("update friend status success");
} else {
System.out.println("update friend status failure");
System.exit(-1);
}
IMResult<OutputStringList> resultGetFriendList = FriendAdmin.getFriendStatusList("ff1", 1);
if (resultGetFriendList != null && resultGetFriendList.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && resultGetFriendList.getResult().getList().contains("ff2")) {
System.out.println("get friend status success");
} else {
System.out.println("get friend status failure");
System.exit(-1);
}
//初始化机器人API
RobotHttpUtils.init("http://localhost", "robot1", "123456");
//***********************************************