This commit is contained in:
imhao183
2020-05-01 12:39:40 +08:00
committed by heavyrain2012
parent c741b4e1da
commit 4aa2001f7b
4 changed files with 39 additions and 0 deletions
@@ -22,6 +22,7 @@ public interface APIPath {
String CreateOrUpdate_Device = "/admin/device/create";
String Get_Device = "/admin/device/get";
String Get_User_Devices = "/admin/device/user_devices";
String Get_Device_Host = "/admin/device/host";
String User_Get_Token = "/admin/user/get_token";
String User_Update_Block_Status = "/admin/user/update_block_status";
String User_Get_Info = "/admin/user/get_info";
@@ -0,0 +1,23 @@
/*
* This file is part of the Wildfire Chat package.
* (c) Heavyrain2012 <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package cn.wildfirechat.pojos;
import java.util.List;
public class OutputDeviceHost {
private String host;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
}
@@ -6,6 +6,7 @@ import cn.wildfirechat.proto.ProtoConstants;
import cn.wildfirechat.sdk.model.IMResult;
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
import cn.wildfirechat.sdk.utilities.RobotHttpUtils;
import io.netty.util.internal.StringUtil;
import java.util.ArrayList;
@@ -903,5 +904,13 @@ public class Main {
System.exit(-1);
}
IMResult<OutputDeviceHost> getDeviceHost = UserAdmin.getDeviceHost("deviceId1");
if (getDeviceHost != null && getDeviceHost.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && !StringUtil.isNullOrEmpty(getDeviceHost.getResult().getHost())) {
System.out.println("Get user device success");
} else {
System.out.println("Get device failure");
System.exit(-1);
}
}
}
@@ -91,4 +91,10 @@ public class UserAdmin {
return AdminHttpUtils.httpJsonPost(path, inputUserId, OutputDeviceList.class);
}
public static IMResult<OutputDeviceHost> getDeviceHost(String deviceId) throws Exception {
String path = APIPath.Get_Device_Host;
InputDeviceId inputUserId = new InputDeviceId();
inputUserId.setDeviceId(deviceId);
return AdminHttpUtils.httpJsonPost(path, inputUserId, OutputDeviceHost.class);
}
}