honghengqiang 9 bulan lalu
induk
melakukan
871fb84596

+ 2 - 1
app/src/main/java/com/swago/app/SplashVm.kt

@@ -112,7 +112,8 @@ class SplashVm(application: Application) : BaseViewModel(application) {
 
     private fun setBaseUrl(baseUrl: String) {
         if (BuildConfig.DEBUG) {
-            UrlConstant.BASE_URL =   "http:test-api.swago.cn"
+//            UrlConstant.BASE_URL =   "http:test-api.swago.cn"
+            UrlConstant.BASE_URL =   "http:huawei.swago.cn"
 //            UrlConstant.BASE_URL =   "https://pro-api.swago.cn"
         } else {
             UrlConstant.BASE_URL = baseUrl

+ 4 - 3
baseswago/src/main/java/com/swago/baseswago/constant/UrlConstant.kt

@@ -14,7 +14,8 @@ import java.io.File
 object UrlConstant {
 
     var BASE_URL = if (BuildConfig.DEBUG) {
-            "http:test-api.swago.cn"
+//            "http:test-api.swago.cn"
+          "http:huawei.swago.cn"
 //        "https://pro-api.swago.cn"
     } else {
         "https://pro-api.swago.cn"
@@ -22,9 +23,9 @@ object UrlConstant {
 
     private val BASE_WEB_URL by lazy {
         if (BuildConfig.DEBUG) {
-            "http://swago-h5.codedreamit.com"
+            "http://test-h5.me-live.cn"
         } else {
-            "https://h5.swago.cn"
+            "https://h5.me-live.cn"
         }
     }
 

+ 2 - 1
baseswago/src/main/java/com/swago/baseswago/http/JsonResponseBodyConverter.kt

@@ -1,5 +1,6 @@
 package com.swago.baseswago.http
 
+import android.util.Log
 import com.alibaba.fastjson.util.ParameterizedTypeImpl
 import com.swago.baseswago.util.LogUtil.d
 import com.google.gson.Gson
@@ -33,7 +34,7 @@ class JsonResponseBodyConverter<T>(
             val encode = jsonObject.optInt("encode",0)
             if (encode == 1){
                 val data = jsonObject.getString("data")
-                val dataStr = MD5Util.decryptAES(data,"0129456789abcdeg0123456789adcdef")
+                val dataStr = MD5Util.decryptAES(data)
                 val obj = JSONTokener(dataStr).nextValue()
                 if (obj is JSONObject){
                     val dataStrJSONObject = JSONObject(dataStr)

+ 2 - 0
baseswago/src/main/java/com/swago/baseswago/http/SwagoInterceptor.kt

@@ -36,6 +36,8 @@ class SwagoInterceptor : Interceptor {
             .append("app-time:${time}")
             .append(":")
             .append("app-url:${appUrl}")
+//            .append(":")
+//            .append("key:${MD5Util.md5Hex(MD5Util.decodeBase64(SwagoInfo.key))}")
 
         LogUtil.d("加密路径", appUrl)
         LogUtil.d("加密前", "$stringBuffer")

+ 2 - 3
baseswago/src/main/java/com/swago/baseswago/util/MD5Util.java

@@ -12,7 +12,6 @@ import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 
 public class MD5Util {
-
     /**
      * 获取十六进制字符串形式的MD5摘要
      */
@@ -44,12 +43,12 @@ public class MD5Util {
     }
 
 
-    public static String decryptAES(String encrypted, String key) throws Exception {
+    public static String decryptAES(String encrypted) throws Exception {
         final byte[] encryptedBytes = android.util.Base64.decode(encrypted, android.util.Base64.DEFAULT);
         final byte[] iv = Arrays.copyOfRange(encryptedBytes, 0, 16);
         final byte[] encryptedData = Arrays.copyOfRange(encryptedBytes, 16, encryptedBytes.length);
 
-        SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
+        SecretKeySpec skeySpec = new SecretKeySpec(decodeBase64(SwagoInfo.INSTANCE.getKey()).getBytes(StandardCharsets.UTF_8), "AES");
         Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
         IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
         cipher.init(Cipher.DECRYPT_MODE, skeySpec, ivParameterSpec);

+ 1 - 1
baseswago/src/main/java/com/swago/baseswago/util/SwagoInfo.kt

@@ -12,7 +12,7 @@ import java.util.*
  *description:
  */
 object SwagoInfo {
-
+    var key = "MDEyOTQ1Njc4OWFiY2RlZzAxMjM0NTY3ODlhZGNkZWY="
     private var versionCode = ""
     private var languageCode = "en"
     var languageId = 0

+ 1 - 1
room/src/main/java/com/swago/room/game/GamePlayDialog.kt

@@ -279,7 +279,7 @@ class GamePlayDialog : BaseXDFragment<DialogGamePlayBinding>(), IRoomActiveListe
 
         @JavascriptInterface
         fun decodeStr(encodeData:String):String{
-            return  MD5Util.decryptAES(encodeData,"0129456789abcdeg0123456789adcdef")
+            return  MD5Util.decryptAES(encodeData)
         }
 
     }