From 0a8fd4aa92555875f58f67144c2c0c0a20a200af Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 20 八月 2024 09:57:13 +0800
Subject: [PATCH] 增加版本通过配置读取

---
 HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/protocol/LinkMessageDecoder.java |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/protocol/LinkMessageDecoder.java b/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/protocol/LinkMessageDecoder.java
index 243d81e..1cf5c5c 100644
--- a/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/protocol/LinkMessageDecoder.java
+++ b/HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/protocol/LinkMessageDecoder.java
@@ -314,13 +314,15 @@
 
                 if (encrypt(body)) {
                     //闇�瑕佽В瀵�
-                    byte[] bodyBytes = AesUtil.aesDecrypt(body, HDLLinkConfig.getInstance().getLocalSecret());
-                    if (bodyBytes != null) {
-                        response.setData(new String(bodyBytes, StandardCharsets.UTF_8));
-                    } else {
-                        LogUtils.e("瑙e瘑澶辫触\r\n" + topic);
-                        response.setData(new String(body, "utf-8"));
-                        continue;
+                    if (!TextUtils.isEmpty(HDLLinkConfig.getInstance().getLocalSecret())) {
+                        byte[] bodyBytes = AesUtil.aesDecrypt(body, HDLLinkConfig.getInstance().getLocalSecret());
+                        if (bodyBytes != null) {
+                            response.setData(new String(bodyBytes, StandardCharsets.UTF_8));
+                        } else {
+                            LogUtils.e("瑙e瘑澶辫触\r\n" + topic);
+                            response.setData(new String(body, "utf-8"));
+                            continue;
+                        }
                     }
                 } else {
                     response.setData(new String(body, "utf-8"));

--
Gitblit v1.8.0