diff --git a/commonLib/src/main/java/com/common/commonlib/net/manager/RequestManager.kt b/commonLib/src/main/java/com/common/commonlib/net/manager/RequestManager.kt index 2a274bb..0381abd 100644 --- a/commonLib/src/main/java/com/common/commonlib/net/manager/RequestManager.kt +++ b/commonLib/src/main/java/com/common/commonlib/net/manager/RequestManager.kt @@ -43,9 +43,7 @@ object RequestManager { * 创建service */ fun create(service: Class): T { -// if (mRetrofit == null) { - init(null) -// } + init(null) return mRetrofit!!.create(service) } @@ -64,9 +62,6 @@ object RequestManager { // 动态HOST替换拦截器 builder.addInterceptor(HostInterceptor()) - // 添加日志拦截器 - loggingInterceptor.level = logLevel - builder.addInterceptor(loggingInterceptor) // 添加通用拦截器 val interceptorList = CommonInterceptorManager.getInterceptorsByRequiredTypeList() if (interceptorList.isNotEmpty()) { @@ -80,6 +75,10 @@ object RequestManager { for (intercept in interceptors!!) { builder.addInterceptor(intercept) } + // 添加日志拦截器 + loggingInterceptor.level = logLevel + builder.addInterceptor(loggingInterceptor) + mRetrofitWithIntercept = Retrofit.Builder() .client(builder.build()) .addCallAdapterFactory(RxJava3CallAdapterFactory.create()) @@ -87,6 +86,10 @@ object RequestManager { .baseUrl("https://www") .build() } else { + // 添加日志拦截器 + loggingInterceptor.level = logLevel + builder.addInterceptor(loggingInterceptor) + mRetrofit = Retrofit.Builder() .client(builder.build()) .addCallAdapterFactory(RxJava3CallAdapterFactory.create())