CEEX v1.0.1版本的 MD5 值为:d20246587215ec3471b0d051724c6d34
以下内容为反编译后的 UrlsConfig.java 源代码,内容仅作参考
package io.bhex.sdk;
import android.text.TextUtils;
import io.bhex.baselib.utils.DebugLog;
import io.bhex.sdk.config.bean.BackupDomainBean;
import io.bhex.sdk.config.domain.BackupDomainManager;
public class UrlsConfig {
public static String API_H5_URL = null;
public static String API_OTC_URL = null;
public static String API_SERVER_URL = null;
public static String API_SOCKET_URL = null;
public static String H5_URL_DEV = "https://www.XXX.com/";
public static String H5_URL_ONLINE = "";
public static String H5_URL_PREV = "https://www.XXX.com/";
public static String H5_URL_TEST = "https://www.XXX.com/";
public static String OTC_URL_DEV = "https://otc.XXX.com/";
public static String OTC_URL_ONLINE = "";
public static String OTC_URL_PREV = "https://otc.XXX.com/";
public static String OTC_URL_TEST = "https://otc.XXX.com/";
public static String REST_URL_DEV = "https://www.XXX.com/";
public static String REST_URL_ONLINE = "";
public static String REST_URL_PREV = "https://www.XXX.com/";
public static String REST_URL_TEST = "https://www.XXX.com/";
public static String SOCKET_DEV = "wss://ws.XXX.com/";
public static String SOCKET_ONLINE = "";
public static String SOCKET_PREV = "wss://ws.XXX.com/";
public static String SOCKET_TEST = "wss://www.XXX.com/";
private static Config mConfig;
public static ServerType mServerType = ServerType.ONLINE_SERVER;
public static class AnonymousClass1 {
static final int[] a;
static {
int[] iArr = new int[ServerType.values().length];
a = iArr;
try {
iArr[ServerType.ONLINE_SERVER.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[ServerType.PREV_SERVER.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[ServerType.TEST_SERVER.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[ServerType.DEV_SERVER.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
public enum ServerType {
DEV_SERVER,
PREV_SERVER,
TEST_SERVER,
ONLINE_SERVER
}
public static void init(boolean z, Config config) {
mConfig = config;
BackupDomainManager.getInstance().firstLoadBackupDomainList(config.getDomainList());
switchDomain();
DebugLog.e("DOMAIN-TEST", "switchDomain finish");
}
public static void initUrls(ServerType serverType) {
mServerType = serverType;
int i = AnonymousClass1.a[mServerType.ordinal()];
if (i == 1) {
API_SERVER_URL = REST_URL_ONLINE;
API_SOCKET_URL = SOCKET_ONLINE;
API_H5_URL = H5_URL_ONLINE;
API_OTC_URL = OTC_URL_ONLINE;
} else if (i == 2) {
API_SERVER_URL = REST_URL_PREV;
API_SOCKET_URL = SOCKET_PREV;
API_H5_URL = H5_URL_PREV;
API_OTC_URL = OTC_URL_PREV;
} else if (i == 3) {
API_SERVER_URL = REST_URL_TEST;
API_SOCKET_URL = SOCKET_TEST;
API_H5_URL = H5_URL_TEST;
API_OTC_URL = OTC_URL_TEST;
} else if (i == 4) {
API_SERVER_URL = REST_URL_DEV;
API_SOCKET_URL = SOCKET_DEV;
API_H5_URL = H5_URL_DEV;
API_OTC_URL = OTC_URL_DEV;
}
Urls.initBrokerUrls();
OTCUrls.initOTCUrls();
}
public static void switchDomain() {
BackupDomainBean h5Domain = BackupDomainManager.getInstance().getH5Domain();
if (h5Domain != null) {
String domain = h5Domain.getDomain();
if (!TextUtils.isEmpty(domain)) {
H5_URL_ONLINE = "https://www." + domain + "/";
}
}
BackupDomainBean currentDomain = BackupDomainManager.getInstance().getCurrentDomain();
if (currentDomain != null) {
String domain2 = currentDomain.getDomain();
int level = currentDomain.getLevel();
if (!TextUtils.isEmpty(domain2)) {
if (level == 1) {
REST_URL_ONLINE = "https://app." + domain2 + "/";
OTC_URL_ONLINE = "https://otc." + domain2 + "/";
SOCKET_ONLINE = "wss://ws." + domain2 + "/";
} else if (level == 2) {
REST_URL_ONLINE = "https://" + domain2 + "/";
OTC_URL_ONLINE = "https://" + domain2 + "/";
SOCKET_ONLINE = "wss://" + domain2 + "/";
}
DebugLog.e("DOMAIN-XXX", "切换域名了.. " + domain2 + " " + H5_URL_ONLINE);
initUrls(mServerType);
BackupDomainManager.getInstance().clearAllCountHostFailed();
return;
}
}
Config config = mConfig;
if (config != null) {
String onlyDomain = config.getOnlyDomain();
if (!TextUtils.isEmpty(onlyDomain)) {
H5_URL_ONLINE = "https://www." + onlyDomain + "/";
REST_URL_ONLINE = "https://app." + onlyDomain + "/";
OTC_URL_ONLINE = "https://otc." + onlyDomain + "/";
SOCKET_ONLINE = "wss://ws." + onlyDomain + "/";
}
}
initUrls(mServerType);
}
}