导航菜单

页面标题

页面副标题

多多分期 v4.1.2 - a.java 源代码

正在查看: 多多分期 v4.1.2 应用的 a.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package d.i.b.d.a;

import com.alibaba.fastjson.support.spring.FastJsonJsonView;
import com.alipay.alipaysecuritysdk.common.config.Constant;
import com.base.commonlibrary.netstate.ComNetWorkUtil;
import com.blankj.utilcode.util.LogUtils;
import d.b.a.r.j;
import java.io.File;
import java.util.concurrent.TimeUnit;
import okhttp3.Cache;
import okhttp3.CacheControl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class a {

    public static a f6813e;

    public Retrofit f6814a;

    public c f6815b;

    public final Interceptor f6816c = new C0124a(this);

    public final Interceptor f6817d = new b(this);

    public class C0124a implements Interceptor {
        public C0124a(a aVar) {
        }

        @Override
        public Response intercept(Interceptor.Chain chain) {
            Request request = chain.request();
            if (!ComNetWorkUtil.b(d.b.a.a.a())) {
                request = request.newBuilder().cacheControl(CacheControl.FORCE_CACHE).build();
            }
            Response proceed = chain.proceed(request);
            if (!ComNetWorkUtil.b(d.b.a.a.a())) {
                return proceed.newBuilder().header("Cache-Control", "public, only-if-cached, max-stale=172800").removeHeader("Pragma").build();
            }
            return proceed.newBuilder().header("Cache-Control", request.cacheControl().toString()).removeHeader("Pragma").build();
        }
    }

    public class b implements Interceptor {
        public b(a aVar) {
        }

        @Override
        public Response intercept(Interceptor.Chain chain) {
            return chain.proceed(chain.request().newBuilder().addHeader("Content-Type", FastJsonJsonView.DEFAULT_CONTENT_TYPE).addHeader("token", (String) j.b("APP_TOKEN", "")).addHeader("ClientType", Constant.SDK_OS).addHeader("ClientVersion", d.b.a.r.b.a(d.b.a.a.a())).removeHeader("User-Agent").addHeader("User-Agent", a.c()).build());
        }
    }

    public a() {
        if (d.i.b.d.d.a.f6876a.b() || d.i.b.d.d.a.f6876a.c()) {
            OkHttpClient b2 = b();
            d.l.b.f fVar = new d.l.b.f();
            fVar.d("yyyy-MM-dd'T'HH:mm:ssZ");
            fVar.c();
            Retrofit build = new Retrofit.Builder().addConverterFactory(GsonConverterFactory.create(fVar.b())).addCallAdapterFactory(RxJavaCallAdapterFactory.create()).client(b2).baseUrl("http://www.beizhuabao.com").build();
            this.f6814a = build;
            this.f6815b = (c) build.create(c.class);
            return;
        }
        OkHttpClient b3 = b();
        d.l.b.f fVar2 = new d.l.b.f();
        fVar2.d("yyyy-MM-dd'T'HH:mm:ssZ");
        fVar2.c();
        Retrofit build2 = new Retrofit.Builder().addConverterFactory(GsonConverterFactory.create(fVar2.b())).addCallAdapterFactory(RxJavaCallAdapterFactory.create()).client(b3).baseUrl(d.f6828e).build();
        this.f6814a = build2;
        this.f6815b = (c) build2.create(c.class);
    }

    public static c a() {
        a aVar = new a();
        f6813e = aVar;
        return aVar.f6815b;
    }

    public static String c() {
        try {
            StringBuffer stringBuffer = new StringBuffer();
            String property = System.getProperty("http.agent");
            int length = property.length();
            for (int i2 = 0; i2 < length; i2++) {
                char charAt = property.charAt(i2);
                if (charAt > 31 && charAt < 127) {
                    stringBuffer.append(charAt);
                }
                stringBuffer.append(String.format("\\u%04x", Integer.valueOf(charAt)));
            }
            return f.a() + "/" + d.b.a.r.b.a(d.b.a.a.a()) + LogUtils.PLACEHOLDER + stringBuffer.toString();
        } catch (Exception e2) {
            e2.printStackTrace();
            return "";
        }
    }

    public final OkHttpClient b() {
        new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY);
        return new OkHttpClient.Builder().readTimeout(30000L, TimeUnit.MILLISECONDS).connectTimeout(30000L, TimeUnit.MILLISECONDS).addInterceptor(this.f6816c).addNetworkInterceptor(this.f6816c).addInterceptor(this.f6817d).cache(new Cache(new File(d.b.a.a.a().getCacheDir(), "cache"), 104857600L)).build();
    }
}