得物.apk(点击下载) / ReportServie.java


package com.shizhuang.duapp.libs.robustplus.core.track;

import a.f;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.libs.duapm2.aop.NetOKAspect;
import com.shizhuang.duapp.libs.robustplus.core.FetchService;
import iq.b;
import iq.d;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.aspectj.lang.JoinPoint;
import org.aspectj.runtime.internal.AroundClosure;
import org.aspectj.runtime.reflect.Factory;
import org.json.JSONObject;

public class ReportServie {
    private static /* synthetic */ JoinPoint.StaticPart ajc$tjp_0;
    public static ChangeQuickRedirect changeQuickRedirect;
    public static OkHttpClient client;

    public class AjcClosure1 extends AroundClosure {
        public static ChangeQuickRedirect changeQuickRedirect;

        public AjcClosure1(Object[] objArr) {
            super(objArr);
        }

        @Override // org.aspectj.runtime.internal.AroundClosure
        public Object run(Object[] objArr) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{objArr}, this, changeQuickRedirect, false, 35983, new Class[]{Object[].class}, Object.class);
            if (proxy.isSupported) {
                return proxy.result;
            }
            Object[] objArr2 = this.state;
            JoinPoint joinPoint = (JoinPoint) objArr2[1];
            return ((OkHttpClient.Builder) objArr2[0]).build();
        }
    }

    static {
        ajc$preClinit();
    }

    private static /* synthetic */ void ajc$preClinit() {
        if (!PatchProxy.proxy(new Object[0], null, changeQuickRedirect, true, 35979, new Class[0], Void.TYPE).isSupported) {
            Factory factory = new Factory("ReportServie.java", ReportServie.class);
            ajc$tjp_0 = factory.makeSJP("method-call", factory.makeMethodSig("1", "build", "okhttp3.OkHttpClient$Builder", "", "", "", "okhttp3.OkHttpClient"), 50);
        }
    }

    public static void report(Map<String, String> map) {
        if (!PatchProxy.proxy(new Object[]{map}, null, changeQuickRedirect, true, 35978, new Class[]{Map.class}, Void.TYPE).isSupported) {
            if (client == null) {
                OkHttpClient.Builder hostnameVerifier = new OkHttpClient.Builder().sslSocketFactory(d.a()).hostnameVerifier(new d.a());
                TimeUnit timeUnit = TimeUnit.SECONDS;
                OkHttpClient.Builder hostnameVerifier2 = hostnameVerifier.connectTimeout(4, timeUnit).readTimeout(5, timeUnit).hostnameVerifier(new HostnameVerifier() {
                    /* class com.shizhuang.duapp.libs.robustplus.core.track.ReportServie.AnonymousClass1 */
                    public static ChangeQuickRedirect changeQuickRedirect;

                    public boolean verify(String str, SSLSession sSLSession) {
                        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, sSLSession}, this, changeQuickRedirect, false, 35980, new Class[]{String.class, SSLSession.class}, Boolean.TYPE);
                        if (proxy.isSupported) {
                            return ((Boolean) proxy.result).booleanValue();
                        }
                        return true;
                    }
                });
                client = (OkHttpClient) NetOKAspect.aspectOf().aroundBuild(new AjcClosure1(new Object[]{hostnameVerifier2, Factory.makeJP(ajc$tjp_0, null, hostnameVerifier2)}).linkClosureAndJoinPoint(16));
            }
            String g3 = f.g(new StringBuilder(), FetchService.isDev ? "http://t1-app.dewu.com" : "https://app.dewu.com", "/api/v1/app/wireless-platform/client/cold-event");
            b.a("request report url = " + g3);
            JSONObject jSONObject = new JSONObject();
            try {
                for (Map.Entry<String, String> entry : map.entrySet()) {
                    jSONObject.put(entry.getKey(), entry.getValue());
                }
            } catch (Exception e) {
                b.c(e.getMessage());
            }
            client.newCall(new Request.Builder().url(g3).method("POST", RequestBody.create(MediaType.parse("application/json"), jSONObject.toString())).addHeader("Content-Type", "application/json").build()).enqueue(new Callback() {
                /* class com.shizhuang.duapp.libs.robustplus.core.track.ReportServie.AnonymousClass2 */
                public static ChangeQuickRedirect changeQuickRedirect;

                @Override // okhttp3.Callback
                public void onFailure(Call call, IOException iOException) {
                    if (!PatchProxy.proxy(new Object[]{call, iOException}, this, changeQuickRedirect, false, 35981, new Class[]{Call.class, IOException.class}, Void.TYPE).isSupported) {
                        b.c(iOException.getLocalizedMessage());
                    }
                }

                @Override // okhttp3.Callback
                public void onResponse(Call call, Response response) throws IOException {
                    if (!PatchProxy.proxy(new Object[]{call, response}, this, changeQuickRedirect, false, 35982, new Class[]{Call.class, Response.class}, Void.TYPE).isSupported) {
                        ResponseBody body = response.body();
                        if (body == null) {
                            b.c("body is null");
                            return;
                        }
                        String string = body.string();
                        b.a("report res = " + string);
                    }
                }
            });
        }
    }
}