龙将斩千 v5.5.5.39856版本的 MD5 值为:5c05b1d6f8d872ca3fe0343d6ff07caf

以下内容为反编译后的 c.java 源代码,内容仅作参考


package com.qiyukf.unicorn.i.a;

import android.text.TextUtils;
import ch.qos.logback.classic.spi.CallerData;
import com.qiyukf.nimlib.sdk.RequestCallback;
import cz.msebera.android.httpclient.client.methods.HttpPost;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class c {
    private static final Logger a = LoggerFactory.getLogger((Class<?>) c.class);
    private static boolean b = false;

    public static String a(String str, Map<String, String> map) throws d {
        try {
            return e.a(b(a(), str, map), "GET", "Common");
        } catch (IOException e) {
            throw new d("get request error", e);
        }
    }

    public static String a(String str, String str2) throws d {
        try {
            return e.a(b(str, str2, (Map<String, String>) null), "GET", "Common");
        } catch (IOException e) {
            throw new d("get request error", e);
        }
    }

    public static void a(String str, Map<String, String> map, RequestCallback<String> requestCallback) {
        if (b) {
            a("GET", str, map, requestCallback);
            return;
        }
        try {
            requestCallback.onSuccess(e.a(b(a(), str, map), "GET", "Common"));
        } catch (IOException e) {
            a("GET", str, map, requestCallback);
        } catch (Exception e2) {
            requestCallback.onException(e2);
        }
    }

    public static void b(String str, Map<String, String> map, RequestCallback<String> requestCallback) {
        if (b) {
            a(HttpPost.METHOD_NAME, str, map, requestCallback);
            return;
        }
        try {
            requestCallback.onSuccess(e.a(b(a(), str, map), HttpPost.METHOD_NAME, "Common"));
        } catch (IOException e) {
            a(HttpPost.METHOD_NAME, str, map, requestCallback);
        } catch (Exception e2) {
            requestCallback.onException(e2);
        }
    }

    public static String b(String str, String str2, Map<String, String> map) {
        String str3 = str + str2;
        a.info("http request url={}", str3);
        if (map != null) {
            int i = 0;
            for (Map.Entry<String, String> entry : map.entrySet()) {
                if (!TextUtils.isEmpty(entry.getKey()) && !TextUtils.isEmpty(entry.getValue())) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(str3);
                    sb.append(i == 0 ? CallerData.NA : "&");
                    str3 = sb.toString() + entry.getKey() + "=" + URLEncoder.encode(entry.getValue());
                    i++;
                }
            }
        }
        return str3;
    }

    private static void a(final String str, final String str2, final Map<String, String> map, final RequestCallback<String> requestCallback) {
        b = true;
        a.a().a(a(), new RequestCallback<String>() {
            @Override
            public final void onSuccess(String str3) {
                String str4 = str3;
                try {
                    c.a.info("http request use ip={} ", str4);
                    requestCallback.onSuccess(e.a(c.b(c.a(), str2, (Map<String, String>) map), str4, str, "Common"));
                } catch (IOException e) {
                    requestCallback.onException(e);
                }
            }

            @Override
            public final void onFailed(int i) {
                requestCallback.onException(new d(i, "ip get is failed" + str2));
            }

            @Override
            public final void onException(Throwable th) {
                requestCallback.onException(new d(404, "ip get is exception" + str2));
            }
        });
    }

    public static String a() {
        if (com.qiyukf.unicorn.c.g().unicornAddress == null || TextUtils.isEmpty(com.qiyukf.unicorn.c.g().unicornAddress.defaultUrl)) {
            int e = com.qiyukf.nimlib.e.e.e();
            if (e == 1) {
                return "http://aq1.qytest.netease.com";
            }
            if (e == 2) {
                return "http://qiyukf.netease.com";
            }
            if (e == 3) {
                return "http://qydev.netease.com";
            }
            return "https://ap1.qiyukf.com";
        }
        return com.qiyukf.unicorn.c.g().unicornAddress.defaultUrl;
    }

    public static String b() {
        if (com.qiyukf.unicorn.c.g().unicornAddress == null || TextUtils.isEmpty(com.qiyukf.unicorn.c.g().unicornAddress.daUrl)) {
            int e = com.qiyukf.nimlib.e.e.e();
            if (e == 1) {
                return "http://da.qytest.netease.com";
            }
            if (e == 2) {
                return "http://da.qiyukf.netease.com";
            }
            return "https://da.qiyukf.com";
        }
        return com.qiyukf.unicorn.c.g().unicornAddress.daUrl;
    }
}