tongmengxiao пре 6 месеци
родитељ
комит
2688f9b2c2

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

@@ -112,9 +112,9 @@ class SplashVm(application: Application) : BaseViewModel(application) {
 
     private fun setBaseUrl(baseUrl: String) {
         if (BuildConfig.DEBUG) {
-            UrlConstant.BASE_URL =   "https://apiv.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"
+            UrlConstant.BASE_URL =   "https://pro-api.swago.cn"
         } else {
             UrlConstant.BASE_URL = baseUrl
         }

BIN
baseswago/src/main/assets/ssl_crt.p12


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

@@ -14,11 +14,11 @@ import java.io.File
 object UrlConstant {
 
     var BASE_URL = if (BuildConfig.DEBUG) {
-            "https://apiv.swago.cn"
+//            "http:test-api.swago.cn"
 //          "http:huawei.swago.cn"
-//        "https://pro-api.swago.cn"
+        "https://pro-api.swago.cn"
     } else {
-        "https://apiv.swago.cn"
+        "https://pro-api.swago.cn"
     }
 
     private val BASE_WEB_URL by lazy {

+ 0 - 25
baseswago/src/main/java/com/swago/baseswago/http/RetrofitManager.kt

@@ -32,7 +32,6 @@ object RetrofitManager {
         if (BuildConfig.DEBUG) {
             okHttpClientBuilder.addInterceptor(ChuckerInterceptor(AppContext.getContext()))
         }
-        setSSLSocketFactory(okHttpClientBuilder)
         okHttpClientBuilder.addInterceptor(SwagoInterceptor())
         okHttpClientBuilder.retryOnConnectionFailure(true)
         okHttpClientBuilder.connectTimeout(30000, TimeUnit.MILLISECONDS)
@@ -52,28 +51,4 @@ object RetrofitManager {
             .client(okHttpClient)
             .build()
     }
-
-    private fun setSSLSocketFactory(okHttpClientBuilder: OkHttpClient.Builder) {
-        // 加载 PKCS12 格式的密钥库
-        val inputStream: InputStream = AppContext.getContext().assets.open("ssl_crt.p12")
-        val keyStore = KeyStore.getInstance("PKCS12")
-        val keyStorePassword = "123456" // 密钥库密码
-        keyStore.load(inputStream, keyStorePassword.toCharArray())
-
-        // 用于从密钥库中获取密钥
-        val keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm())
-        keyManagerFactory.init(keyStore, keyStorePassword.toCharArray())
-
-        val trustManagerFactory =
-            TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
-        trustManagerFactory.init(keyStore)
-
-        // 创建 SSLContext,用于建立安全连接
-        val sslContext = SSLContext.getInstance("TLS")
-        sslContext.init(keyManagerFactory.keyManagers, trustManagerFactory.trustManagers, null)
-        okHttpClientBuilder.sslSocketFactory(
-            sslContext.socketFactory ,
-            (trustManagerFactory.trustManagers[0] as X509TrustManager
-                    ))
-    }
 }