配置解密转义问题

This commit is contained in:
Martin
2024-09-10 13:41:16 +08:00
parent 2e1eb3c7b4
commit dee916ea7d
5 changed files with 13 additions and 9 deletions

View File

@@ -48,6 +48,9 @@ public class JsonBean {
decodedData = Base64.getDecoder().decode(data);
}
String decryptedText = AesUtils.decryptToString(decodedData);
L.e("解码前:"+data);
L.e("解码前-转成base64"+decodedData);
L.e("解码前-解密後:"+decryptedText);
JSONObject object = JSON.parseObject(decryptedText);
try {
JSONArray jsonArray = object.getJSONArray("info");
@@ -58,7 +61,6 @@ public class JsonBean {
resultData.setInfo(array);
resultData.setCode(object.getInteger("code"));
resultData.setMsg(object.getString("msg"));
L.e("这是一个数组");
}catch (Exception e) {
try {
String [] array = new String[1];
@@ -66,7 +68,6 @@ public class JsonBean {
resultData.setInfo(array);
resultData.setCode(object.getInteger("code"));
resultData.setMsg(object.getString("msg"));
L.e("这是一个对象");
} catch (JSONException ex) {
L.e("字符串格式错误");
}

View File

@@ -1003,7 +1003,7 @@ public class LiveHttpUtil {
}
public static void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, String currencyType, int page, HttpCallback callback) {
HttpClient.getInstance().get("huoquxingjitiaozhanzhuangtai", "huoquxingjitiaozhanzhuangtai")
HttpClient.getInstance().get("huoquyouxiliebiao", "huoquyouxiliebiao")
.params("sud_game_id", sudGameId)
.params("threshold", threshold)
.params("room_holder_type", roomHolderType)

View File

@@ -1,5 +1,7 @@
package com.yunbao.common.utils;
import com.alibaba.fastjson.JSON;
import java.io.UnsupportedEncodingException;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
@@ -50,7 +52,7 @@ public class AesUtils {
}
public static String decodeUnicode(String unicode) {
StringBuilder sb = new StringBuilder();
/* StringBuilder sb = new StringBuilder();
for (int i = 0; i < unicode.length();) {
if (unicode.charAt(i) == '\\') {
if (i + 5 < unicode.length()) {
@@ -66,7 +68,7 @@ public class AesUtils {
}
}
sb.append(unicode.charAt(i++));
}
return sb.toString();
}*/
return JSON.parseObject(unicode).toString();
}
}