From 08b203ac4cda87b13837f8e003e9caade9c9cc52 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期四, 24 十一月 2022 13:47:34 +0800
Subject: [PATCH] 111

---
 AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java b/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java
index 2d51db2..d08582c 100644
--- a/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java
+++ b/AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java
@@ -35,9 +35,9 @@
         Map<String, Object> map = paramsInit(paramsMap);
         JsonObject jsonResult = null;
         if (CONST.isHdlServer()) {
-            if(method.equals("bindDevice")){
+            if (method.equals("bindDevice")) {
                 jsonResult = doPost(CONST.HOST + "/home-wisdom/app/device/independentRegister", map, timeOut);
-            }else {
+            } else {
                 jsonResult = doPost(CONST.HOST + "/home-wisdom/imou/openapi/" + method, map, timeOut);
             }
         } else {
@@ -56,26 +56,29 @@
             String msg = jsonResult.get("msg").getAsString();
             throw new BusinessException(code + msg);
         }
+
+        JsonObject jsonData = new JsonObject();
         try {
-            JsonObject jsonData = jsonResult.getAsJsonObject("data");
+            jsonData = jsonResult.getAsJsonObject("data");
             if (jsonData == null) {
                 jsonData = new JsonObject();
             }
-            return jsonData;
+
         } catch (Throwable e) {
-            BusinessException businessException = new BusinessException(e);
-            throw businessException;
+//            BusinessException businessException = new BusinessException(e);
+//            throw businessException;
         }
+        return jsonData;
     }
 
 
 
     private static JsonObject doPost(String url, Map<String, Object> map, int timeOut) throws BusinessException {
         Gson gson = new Gson();
-        map.put("homeId", LCDeviceEngine.newInstance().getHomeId());
         String json;
         JsonObject jsonObject;
         if(CONST.isHdlServer()) {
+            map.put("homeId", LCDeviceEngine.newInstance().getHomeId());
             if (map.containsKey("params")) {
                 Map<String, Object> tempMap = (Map<String, Object>) map.get("params");
                 map.remove("params");

--
Gitblit v1.8.0