From e0a5ebeb7ab4480a89cc22bc1093cea71046edd7 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期一, 14 七月 2025 15:22:43 +0800
Subject: [PATCH] 2025年07月14日14:57:30

---
 app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
index 1db0a91..c3b16be 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -10,6 +10,7 @@
 import android.location.Location;
 import android.location.LocationManager;
 import android.os.IBinder;
+import android.os.SystemClock;
 import android.provider.Settings;
 import android.text.TextUtils;
 import android.util.Log;
@@ -43,6 +44,7 @@
 import com.hdl.photovoltaic.internet.api.TopicApi;
 import com.hdl.photovoltaic.listener.CloudCallBeak;
 import com.hdl.photovoltaic.listener.LinkCallBack;
+import com.hdl.photovoltaic.ui.LoginActivity;
 import com.hdl.photovoltaic.ui.bean.CUserInfo;
 import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean;
 import com.hdl.photovoltaic.ui.bean.DeviceInfoBean;
@@ -393,6 +395,11 @@
                         this.uniGetGatewayInfo(mode_type, data, callback);
                     }
                     break;
+                    //鍒犻櫎BMS/鐢垫睜鍖�
+                    case HDLUniMP.UNI_EVENT_REPLY_DEVICE_del_oid: {
+                        this.uniDeleteOid(mode_type, data, callback);
+                    }
+                    break;
                 }
 
             } else if (HDLUniMP.UNI_EVENT_REPLY_WIFI_MODEL.equals(topic)) {
@@ -707,7 +714,8 @@
                     //uni閫氱煡鍘熺敓閫�鍑虹櫥褰�
                     case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOGOUT: {
                         HdlLogLogic.print("uni閫氱煡鍘熺敓閫�鍑虹櫥褰�---", true);
-                        HDLLinkPMUser.getInstance().logout(0);
+//                        HDLLinkPMUser.getInstance().logout(0);
+                        HdlAccountLogic.getInstance().logout();
                     }
                     break;
                     //鏈湴瀵嗛挜鑾峰彇
@@ -768,10 +776,10 @@
                                             } else if (s.startsWith("[")) {
                                                 uniSuccessCallback(type, new Gson().fromJson(s, JsonArray.class), callback);
                                             } else {
-                                                uniSuccessCallback(type, s, callback);
+                                                uniSuccessCallback(type, new JsonArray(), callback);
                                             }
                                         } catch (Exception e) {
-                                            uniSuccessCallback(type, s, callback);
+                                            uniSuccessCallback(type, new JsonArray(), callback);
                                         }
                                     }
                                 }
@@ -792,10 +800,10 @@
                                     } else if (json.startsWith("[")) {
                                         uniSuccessCallback(type, new Gson().fromJson(json, JsonArray.class), callback);
                                     } else {
-                                        uniSuccessCallback(type, json, callback);
+                                        uniSuccessCallback(type, new JsonArray(), callback);
                                     }
                                 } catch (Exception e) {
-                                    uniSuccessCallback(type, json, callback);
+                                    uniSuccessCallback(type, new JsonArray(), callback);
                                 }
                                 long endTime = System.currentTimeMillis() - startTime;
                                 Log.d("====鑰楁椂鏃堕棿====", String.valueOf(endTime));
@@ -812,11 +820,17 @@
             } else if (HDLUniMP.UNI_EVENT_REPLY_NO_WORK_MODEL.equals(topic)) {
                 //鏃犵綉妯″紡
                 switch (type) {
-
                     case HDLUniMP.UNI_EVENT_REPLY_NO_WORK_MODEL_EXIT: {
                         //閫�鍑烘棤缃戞ā寮忔爣璇�
                         UserConfigManage.getInstance().setNoNetworkFlag(false);
                         UserConfigManage.getInstance().Save();
+                        uniSuccessCallback(mode_type, true, callback);
+                        if (null != HDLUniMPSDKManager.getInstance().getUniMP()) {
+                            HDLUniMPSDKManager.getInstance().getUniMP().closeUniMP();
+                        }
+                        Intent intent = new Intent(HDLApp.getInstance(), LoginActivity.class);
+                        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+                        HDLApp.getInstance().startActivity(intent);
                     }
                     break;
                     case HDLUniMP.UNI_EVENT_REPLY_NO_WORK_MODEL_DEVICE_INFO: {
@@ -827,7 +841,9 @@
                             UserConfigManage.getInstance().setNoNetworkDeviceMac(mac);
                             UserConfigManage.getInstance().setNoNetworkPassword(password);
                             UserConfigManage.getInstance().Save();
-                        } catch (Exception ignored) {
+                            uniSuccessCallback(mode_type, true, callback);
+                        } catch (Exception e) {
+                            uniSuccessCallback(mode_type, e, callback);
                         }
                     }
                     break;
@@ -835,7 +851,9 @@
                         //鏃犵綉妯″紡閫嗗彉鍣ㄨ鎯呴〉锛屾竻闄ょ紦瀛榤ac鍜屽瘑鐮�
                         UserConfigManage.getInstance().setNoNetworkDeviceMac("");
                         UserConfigManage.getInstance().setNoNetworkPassword("");
+                        UserConfigManage.getInstance().setNoNetworkFlag(false);
                         UserConfigManage.getInstance().Save();
+                        uniSuccessCallback(mode_type, true, callback);
                     }
                     break;
                 }
@@ -846,7 +864,8 @@
                 if (!TextUtils.isEmpty(body)) {
                     try {
                         jObject = new Gson().fromJson(body, JsonObject.class);
-                    } catch (Exception ignored) {
+                    } catch (Exception e) {
+                        uniSuccessCallback(mode_type, e, callback);
                     }
                 }
                 HttpClient.getInstance().requestHttp(type, jObject.toString(), new CloudCallBeak<String>() {
@@ -2839,6 +2858,30 @@
         });
     }
 
+    /**
+     * 鍒犻櫎璁惧oid
+     *
+     * @param type     绫诲瀷
+     * @param data     uni璇锋眰鏁版嵁
+     * @param callback uni鍥炶皟
+     */
+    public void uniDeleteOid(String type, Object data, DCUniMPJSCallback callback) {
+        String mac = getKeyValue("mac", getKeyValue("data", data));
+        String oid_json = getKeyValue("attribute_data", getKeyValue("data", data));
+        JsonArray jsonArray = new Gson().fromJson(oid_json, JsonArray.class);
+        HdlDeviceLogic.getInstance().deleteOid(mac, jsonArray, new LinkCallBack<Boolean>() {
+            @Override
+            public void onSuccess(Boolean obj) {
+                uniSuccessCallback(type, obj, callback);
+            }
+
+            @Override
+            public void onError(HDLLinkException e) {
+                uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+            }
+        });
+    }
+
 
     /**
      * 鍙戦�乵odbus鍗忚鏁版嵁

--
Gitblit v1.8.0