riku
2025-07-02 3013b813e5df6977c0be921928f73b1a3adde290
app/src/main/java/cn/flightfeather/thirdappmodule/common/net/RetrofitFactory.kt
@@ -19,9 +19,16 @@
 * 网络请求
 */
class RetrofitFactory constructor(val application: CommonApplication){
    // 本系统飞羽监管后端接口ip
    val retrofit: Retrofit = application.retrofit
    val retrofitImage: Retrofit = application.retrofitImage
    // 飞羽环境系统后端接口ip
    lateinit var retrofit2: Retrofit
    init {
        retrofit2 = newRetrofit(application.ROOT_URL_RELEASE_2)
    }
    private fun newOkHttpClient(list: List<Interceptor>): OkHttpClient =
            OkHttpClient.Builder()
@@ -33,11 +40,9 @@
                    }
                    .build()
    private fun newRetrofit(mOkHttpClient: OkHttpClient): Retrofit =
    private fun newRetrofit(url: String, mOkHttpClient: OkHttpClient? = null): Retrofit =
            Retrofit.Builder()
                    .apply {
                        baseUrl(application.ROOT_URL_RELEASE)
                    }
            .baseUrl(url)
                    .addConverterFactory(
                            GsonConverterFactory.create(
                                    GsonBuilder()
@@ -46,7 +51,7 @@
                            )
                    )
                    .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                    .client(mOkHttpClient)
            .apply { mOkHttpClient?.let { client(it) } }
                    .build()
    companion object {
@@ -74,7 +79,7 @@
                instance.retrofit
            } else {
                val c = instance.newOkHttpClient(listOf(NetWorkProgressInterceptor(listener)))
                instance.newRetrofit(c)
                instance.newRetrofit(instance.application.ROOT_URL_RELEASE, c)
            }
        }
    }