From dee916ea7de5339f4288829312057f4b5d3f1b37 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Tue, 10 Sep 2024 13:41:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=A7=A3=E5=AF=86=E8=BD=AC?= =?UTF-8?q?=E4=B9=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/src/main/java/com/yunbao/common/http/JsonBean.java | 5 +++-- .../main/java/com/yunbao/common/http/LiveHttpUtil.java | 2 +- .../src/main/java/com/yunbao/common/utils/AesUtils.java | 8 +++++--- config.gradle | 2 +- .../java/com/yunbao/main/views/MainHomeViewHolder.java | 5 +++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/http/JsonBean.java b/common/src/main/java/com/yunbao/common/http/JsonBean.java index f84357593..f6c4d927f 100644 --- a/common/src/main/java/com/yunbao/common/http/JsonBean.java +++ b/common/src/main/java/com/yunbao/common/http/JsonBean.java @@ -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("字符串格式错误"); } diff --git a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java index 4204a38f9..adac07904 100644 --- a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java @@ -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) diff --git a/common/src/main/java/com/yunbao/common/utils/AesUtils.java b/common/src/main/java/com/yunbao/common/utils/AesUtils.java index eb57ebd2d..f550c4bda 100644 --- a/common/src/main/java/com/yunbao/common/utils/AesUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/AesUtils.java @@ -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(); } } diff --git a/config.gradle b/config.gradle index 9425aa231..9632ac9e3 100644 --- a/config.gradle +++ b/config.gradle @@ -10,7 +10,7 @@ ext { manifestPlaceholders = [ //正式、 // serverHost : "https://napi.yaoulive.com", - serverHost : "https://napi.yaoulive.com", + serverHost : "https://api.poyoshow.com", buildTime : new Date().format("MM-dd HH:mm", TimeZone.getTimeZone("GMT+8")), testServerHost : "https://api.poyoshow.com", diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java index dedd0ab9b..16b23a8bc 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java @@ -14,6 +14,7 @@ import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; +import com.alibaba.fastjson.JSON; import com.lxj.xpopup.XPopup; import com.lxj.xpopup.core.BottomPopupView; import com.yunbao.common.dialog.GiftWallDialog; @@ -99,14 +100,14 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { }); } private void testAes() { - String aesStr ="yvNHDY/jYopEYMnjYKzm5p0WfeP/IqahmtN/zY8kH5MYiLn1K6P57c+JkIBTySvRDcULlZCNJEPynx0Z6PcPwfLpWHTniDNKRYo3Hiw1iwI="; + String aesStr ="yvNHDY/jYopEYMnjYKzm5p0WfeP/IqahmtN/zY8kH5OyAUcmqc4igt/6eSslvgSKA0fX8/imr+yHfLb2DZNKI7bikEAuagiKvJdRZ9GIvw9mix5Ap0E/BGVe3DrirxKf3XrmJL8mONw4OTn7JmDStB/SMt3tgWP9bvjVwa66BcRcIaRSxbMDm/6dN7QsLtBMjx+XzpRocH2ISTLhEhuxbjz9ovIDwETx4IgPj4LuHcPERDSeNE9TC9UWHqIo+hWoUiGc8MhSh3uO7ptOzno6Dg9Zk4uxnKZdLYeR+M9JLaja6NMloza5IjI15CIcGVT9o4HLeUVodShZjFGsw7JfMcoUBhnQEOHPSh2S8q6Py0Z0ofiTsJWUj2+XwYwyvjxx"; //byte[] msg = AesUtils.decrypt(aesStr.getBytes(), "LhHBfcsN2VmBpHCn".getBytes()); byte[] decodedData = null; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { decodedData = Base64.getDecoder().decode(aesStr); } String decryptedText = AesUtils.decryptToString(decodedData); - L.e("decryptedText:"+decryptedText); + L.e("decryptedText:"+JSON.parseObject(decryptedText)); } public void setCurPosition(int position) { mViewPager.setCurrentItem(position);