2
0
imhao183 5 жил өмнө
parent
commit
4aa2001f7b

+ 1 - 0
common/src/main/java/cn/wildfirechat/common/APIPath.java

@@ -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";

+ 23 - 0
common/src/main/java/cn/wildfirechat/pojos/OutputDeviceHost.java

@@ -0,0 +1,23 @@
+/*
+ * This file is part of the Wildfire Chat package.
+ * (c) Heavyrain2012 <heavyrain.lee@gmail.com>
+ *
+ * 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;
+    }
+}

+ 9 - 0
sdk/src/main/java/cn/wildfirechat/sdk/Main.java

@@ -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);
+        }
+
     }
 }

+ 6 - 0
sdk/src/main/java/cn/wildfirechat/sdk/UserAdmin.java

@@ -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);
+    }
 }