From d6a2ca78cc573243a44ff805ac01935fd36bb6d8 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 07 十二月 2021 15:40:00 +0800
Subject: [PATCH] 2021-12-07 1.调整搜索网关机制

---
 HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/protocol/LinkMessageDecoder.java |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 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 5047ae0..4cc8a8f 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
@@ -1,9 +1,8 @@
 package com.hdl.sdk.connect.protocol;
 
 
-import android.util.Log;
-
-import com.hdl.sdk.common.config.AuthenticateConfig;
+import com.hdl.sdk.common.utils.LogUtils;
+import com.hdl.sdk.connect.config.HDLLinkConfig;
 import com.hdl.sdk.common.event.EventDispatcher;
 import com.hdl.sdk.common.utils.ByteUtils;
 import com.hdl.sdk.connect.bean.LinkResponse;
@@ -61,16 +60,22 @@
                 if (byteArray.length >= bodyLength + bodyStartIndex) {
                     byte[] body = ByteUtils.getRangeBytes(bytes, bodyStartIndex, bodyStartIndex + bodyLength);
 
-                    if(AuthenticateConfig.getInstance().ifNeedEncrypt(response.getTopic())){
+                    if (HDLLinkConfig.getInstance().ifNeedEncrypt(response.getTopic())) {
                         //闇�瑕佽В瀵�
-                        byte[] bodyBytes = AesUtil.aesDecrypt(body,AuthenticateConfig.getInstance().getLocalSecret());
-                        response.setData(new String(bodyBytes, "utf-8"));
-                        Log.i("TAG", "decoder: ");
-                    }else{
+                        byte[] bodyBytes = AesUtil.aesDecrypt(body, HDLLinkConfig.getInstance().getLocalSecret());
+//                        byte[] bodyBytes = AESUtils.decryptAES(body,AuthenticateConfig.getInstance().getLocalSecret());
+                        if (bodyBytes != null) {
+                            response.setData(new String(bodyBytes, "utf-8"));
+//                            LogUtils.i("TAG", "瑙e瘑 涓婚锛�"+response.getTopic()+ " body: "+response.getData());
+                        } else {
+                            //瑙e瘑澶辫触锛岃繑鍥炲師鏁版嵁
+                            response.setData(new String(body, "utf-8"));
+                            LogUtils.e( "瑙e瘑澶辫触");
+                        }
+
+                    } else {
                         response.setData(new String(body, "utf-8"));
                     }
-
-
 
                     if (byteArray.length >= bodyLength + bodyStartIndex) {
                         //淇濆瓨浣欑暀

--
Gitblit v1.8.0