From 9c67fc611daf6f9cb7c05f72d598543bff2d26f1 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 25 十月 2024 11:23:17 +0800
Subject: [PATCH] s2024年10月25日11:23:14

---
 app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java |   61 ++++++++++++++++++++----------
 1 files changed, 41 insertions(+), 20 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 8e4e0a7..0dd24b0 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -29,6 +29,7 @@
 import com.hdl.linkpm.sdk.utils.HDLMD5Utils;
 import com.hdl.photovoltaic.HDLApp;
 import com.hdl.photovoltaic.R;
+import com.hdl.photovoltaic.bean.LocalResponse;
 import com.hdl.photovoltaic.bean.ModBusBean;
 import com.hdl.photovoltaic.bean.PageNumberObject;
 import com.hdl.photovoltaic.config.AppConfigManage;
@@ -154,7 +155,6 @@
                     break;
                     //鐢ㄦ埛鏈湴缂撳瓨淇℃伅
                     case HDLUniMP.UNI_EVENT_REPLY_USER_LOCAL_INFO: {
-                        HdlLogLogic.print("鏈湴澶村儚璺緞---->>>" + UserConfigManage.getInstance().getUserImageUrl());
                         JsonObject jsonObject = new JsonObject();
                         jsonObject.addProperty("user_name", UserConfigManage.getInstance().getUserName());
                         jsonObject.addProperty("user_image_url", UserConfigManage.getInstance().getUserImageUrl());
@@ -169,6 +169,7 @@
                         jsonObject.addProperty("appKey", AppConfigManage.getAppKey());
                         jsonObject.addProperty("appSecret", AppConfigManage.getAppSecret());
                         uniSuccessCallback(mode_type, jsonObject, callback);
+                        HdlLogLogic.print("鑾峰彇鐢ㄦ埛鏈湴缂撳瓨淇℃伅---->>>" + jsonObject.toString());
                     }
                     break;
                 }
@@ -180,10 +181,7 @@
                     case HDLUniMP.UNI_EVENT_REPLY_HOME_ADD: {
                         String url = getKeyValue("url", getKeyValue("data", data));
                         //EventBus浜嬩欢鍒嗗彂
-                        HdlCommonLogic.getInstance().postEventBusSticky(
-                                HDLUniMP.UNI_EVENT_REPLY_HOME_ADD,
-                                HDLUniMP.UNI_EVENT_REPLY_HOME_ADD,
-                                url);
+                        HdlCommonLogic.getInstance().postEventBusSticky(HDLUniMP.UNI_EVENT_REPLY_HOME_ADD, HDLUniMP.UNI_EVENT_REPLY_HOME_ADD, url);
 
                         if (callback != null) {
                             uniSuccessCallback(type, null, callback);
@@ -200,10 +198,7 @@
                     //鍒涘缓鐢电珯
                     case HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION: {
                         //EventBus浜嬩欢鍒嗗彂
-                        HdlCommonLogic.getInstance().postEventBus(
-                                HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL,
-                                HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION,
-                                getKeyValue("data", data));
+                        HdlCommonLogic.getInstance().postEventBus(HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL, HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION, getKeyValue("data", data));
                         if (callback != null) {
                             uniSuccessCallback(type, null, callback);
                         }
@@ -238,10 +233,7 @@
                     //浣忓畢銆愮數绔欍�戠紪杈�
                     case HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT: {
                         //EventBus浜嬩欢鍒嗗彂
-                        HdlCommonLogic.getInstance().postEventBus(
-                                HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL,
-                                HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT,
-                                getKeyValue("data", data));
+                        HdlCommonLogic.getInstance().postEventBus(HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL, HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT, getKeyValue("data", data));
                         if (callback != null) {
                             uniSuccessCallback(type, null, callback);
                         }
@@ -687,13 +679,19 @@
                     //鏈湴瀵嗛挜璁剧疆
                     case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOCAL_ENCRYPT_SET: {
                         String local_encrypt = getKeyValue("local_encrypt", getKeyValue("data", data));
-                        //閲嶆柊璁剧疆鏈湴閫氳绉橀挜
-                        UserConfigManage.getInstance().setLocalSecret(local_encrypt);
-                        UserConfigManage.getInstance().Save();
-                        //閰嶇疆鏈湴閫氫俊鐨勪俊鎭�
-                        HDLLinkConfig.getInstance().setLocalSecret(local_encrypt);
-                        HdlLogLogic.print("uni---log---" + local_encrypt, true);
-
+                        if (!TextUtils.isEmpty(local_encrypt)) {
+                            //閲嶆柊璁剧疆鏈湴閫氳绉橀挜
+                            UserConfigManage.getInstance().setLocalSecret(local_encrypt);
+                            UserConfigManage.getInstance().Save();
+                            //閰嶇疆鏈湴閫氫俊鐨勪俊鎭�
+                            HDLLinkConfig.getInstance().setLocalSecret(local_encrypt);
+                            HdlLogLogic.print("uni---log---" + local_encrypt, true);
+                        }
+                    }
+                    break;
+                    //link杩涜瀵嗙爜楠岃瘉
+                    case HDLUniMP.UNI_EVENT_REPLY_OTHER_Password_verifiy: {
+                        uniCheckPasswordVerification(mode_type, data, callback);
                     }
                     break;
                 }
@@ -744,6 +742,29 @@
     //region ******uni鎺ュ彛鏂规硶******
 
     /**
+     * link杩涜瀵嗙爜楠岃瘉
+     */
+    private void uniCheckPasswordVerification(String type, Object data, DCUniMPJSCallback callback) {
+        String password = getKeyValue("password", getKeyValue("data", data));
+        String mac = getKeyValue("mac", getKeyValue("data", data));
+        HdlDeviceLogic.getInstance().getPasswordVerification(mac, password, new LinkCallBack<LocalResponse>() {
+            @Override
+            public void onSuccess(LocalResponse obj) {
+                if (callback != null) {
+                    uniCallbackData(type, obj.getObjects(), obj.getCode(), obj.getMsg(), callback);
+                }
+            }
+
+            @Override
+            public void onError(HDLLinkException e) {
+                if (callback != null) {
+                    uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+                }
+            }
+        });
+    }
+
+    /**
      * 鐢电珯鍒犻櫎
      */
     private void uniGetDelResidence(String type, Object data, DCUniMPJSCallback callback) {

--
Gitblit v1.8.0