正在查看: 小柿子 v1.3.8 应用的 ApiManager.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 小柿子 v1.3.8 应用的 ApiManager.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package cn.hzjizhun.admin.api;
import android.content.Context;
import android.text.TextUtils;
import cn.hzjizhun.admin.AdSdk;
import cn.hzjizhun.admin.ad.bean.AdPlatforms;
import cn.hzjizhun.admin.api.bean.ChannelUrlBean;
import cn.hzjizhun.admin.api.bean.InitConfigBean;
import cn.hzjizhun.admin.api.bean.PriceNoticeBean;
import cn.hzjizhun.admin.api.bean.ResponseBaseBean;
import cn.hzjizhun.admin.base.ErrorCallback;
import cn.hzjizhun.admin.base.RcSdk;
import cn.hzjizhun.admin.custom_ad.http.AESUtil;
import cn.hzjizhun.admin.exception.AdError;
import cn.hzjizhun.admin.h5.AdSdkH5Activity;
import cn.hzjizhun.admin.http.HttpManager;
import cn.hzjizhun.admin.http.RequestCallback;
import cn.hzjizhun.admin.util.ALog;
import cn.hzjizhun.admin.util.DeviceUtil;
import cn.hzjizhun.admin.util.DisplayUtil;
import cn.hzjizhun.admin.util.FileInfoUtils;
import cn.hzjizhun.admin.util.LocationUtils;
import cn.hzjizhun.admin.util.OAIDUtil;
import com.baidu.mobads.sdk.api.IAdInterListener;
import com.bytedance.sdk.openadsdk.api.plugin.PluginConstants;
import com.bytedance.sdk.openadsdk.downloadnew.core.TTDownloadField;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
public class ApiManager {
private static String TAG = "ApiManager";
private static final String default_file_key = "8S0WGZJgo_h7BpWJ";
private static HashMap<String, String> mChannelUrlMap;
private static int mDialogTouchKeen;
private static HashMap<String, AdSdk.InitCallback> mCallbackMap = new HashMap<>();
private static volatile int mInitResult = 0;
public class a implements RequestCallback {
@Override
public void onFail(Throwable th) {
}
@Override
public void onSuccess(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
try {
ResponseBaseBean bean = ResponseBaseBean.toBean(str);
bean.getResult();
if (bean.isOk()) {
bean.objectToBean().booleanValue();
}
} catch (Throwable unused) {
}
}
}
public class b implements RequestCallback {
@Override
public void onFail(Throwable th) {
if (th != null) {
ALog.d(ApiManager.TAG, "竞价反馈失败 " + th.getMessage());
}
}
@Override
public void onSuccess(String str) {
ALog.d(ApiManager.TAG, "竞价反馈结果 " + str);
}
}
public class c implements RequestCallback {
@Override
public void onFail(Throwable th) {
}
@Override
public void onSuccess(String str) {
try {
int intValue = Integer.valueOf(str).intValue();
if (intValue > 0) {
ApiManager.setDialogTouchKeen(intValue);
}
} catch (Throwable unused) {
}
}
}
public class d implements RequestCallback {
public final String f184a;
public d(String str) {
this.f184a = str;
}
@Override
public void onFail(Throwable th) {
}
@Override
public void onSuccess(String str) {
try {
JSONArray jSONArray = new JSONArray(AESUtil.decrypt(str, ApiManager.default_file_key));
HashMap hashMap = new HashMap();
if (jSONArray.length() > 0) {
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i2);
if (optJSONObject != null) {
String optString = optJSONObject.optString("type");
j.b bVar = new j.b(optString, optJSONObject.optString("uri"), optJSONObject.optString(TTDownloadField.TT_ID));
List list = (List) hashMap.get(optString);
if (list == null) {
list = new ArrayList();
hashMap.put(optString, list);
}
list.add(bVar);
}
}
}
FileInfoUtils.readShellText(this.f184a, hashMap);
} catch (Throwable unused) {
}
}
}
public class e implements RequestCallback {
public final String f185a;
public e(String str) {
this.f185a = str;
}
@Override
public void onFail(Throwable th) {
}
@Override
public void onSuccess(String str) {
boolean z;
try {
JSONArray jSONArray = new JSONArray(AESUtil.decrypt(str, ApiManager.default_file_key));
if (jSONArray.length() > 0) {
JSONObject jSONObject = new JSONObject();
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
String optString = jSONArray.optString(i2);
if (!TextUtils.isEmpty(optString)) {
if (AdSdk.getInstance().getContext().getPackageManager().getPackageInfo(optString, 0) != null) {
z = true;
jSONObject.put(optString, z);
}
z = false;
jSONObject.put(optString, z);
}
}
ApiManager.reportGInfo(this.f185a, jSONObject);
}
} catch (Throwable th) {
th.printStackTrace();
}
}
}
public class f implements ErrorCallback {
@Override
public void errorReport(String str) {
ApiManager.reportErrorAndMsg("30001", str, "");
}
}
public class g implements RequestCallback {
public final AdSdk.b f186a;
public g(AdSdk.b bVar) {
this.f186a = bVar;
}
@Override
public void onFail(Throwable th) {
this.f186a.a("");
}
@Override
public void onSuccess(String str) {
if (!TextUtils.isEmpty(str)) {
try {
ResponseBaseBean bean = ResponseBaseBean.toBean(str);
if (bean.isOk()) {
ALog.d(ApiManager.TAG, "onSuccess: " + bean.getResult());
this.f186a.a(bean.objectToString());
} else {
this.f186a.a("");
}
return;
} catch (Throwable th) {
if (ALog.isLog) {
th.printStackTrace();
}
}
}
this.f186a.a("");
}
}
public class h extends i.b {
public final AdSdk.InitCallback f187a;
public h(AdSdk.InitCallback initCallback) {
this.f187a = initCallback;
}
@Override
public void a(InitConfigBean initConfigBean, String str) {
try {
FunctionConfig.instance().saveInitConfig(initConfigBean, str);
ApiManager.parseChannelUrlList(initConfigBean.getChannelUrlList());
ApiManager.initBase(AdSdk.getInstance().getContext());
ALog.d(ApiManager.TAG, " requestInitConfigData onSucceed" + initConfigBean);
c.b.a().e();
int unused = ApiManager.mInitResult = 1;
AdSdk.InitCallback initCallback = this.f187a;
if (initCallback != null) {
initCallback.onInitResult(true);
}
ApiManager.initMob();
if (initConfigBean.getPosInfoList() == null || initConfigBean.getPosInfoList().isEmpty()) {
ApiManager.reportError("10001", "");
}
} catch (Throwable unused2) {
}
}
@Override
public void b(AdError adError) {
String str;
String str2;
try {
ApiManager.initBase(AdSdk.getInstance().getContext());
adError.log();
int unused = ApiManager.mInitResult = 2;
AdSdk.InitCallback initCallback = this.f187a;
if (initCallback != null) {
initCallback.onInitResult(false);
}
if (AdSdk.getInstance().isNoAd()) {
str = ApiManager.TAG;
str2 = "广告已经停用";
} else {
str = ApiManager.TAG;
str2 = " requestInitConfigData onFailed";
}
ALog.d(str, str2);
ApiManager.reportError("10001", "");
} catch (Throwable unused2) {
}
}
}
public static boolean checkAdSdkInitStatus() {
return mInitResult == 1;
}
public static void clickCoordinatesReport(String str, String str2, String str3, String str4) {
try {
String e2 = i.c.e();
if (!TextUtils.isEmpty(e2) && !TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3) && !TextUtils.isEmpty(str4)) {
HttpManager.instance().get(i.c.c() + "/coordinate/android/" + e2 + "/" + str + "/" + (DisplayUtil.screenWidth(AdSdk.getInstance().getContext()) + "," + DisplayUtil.screenHeight(AdSdk.getInstance().getContext())) + "/" + str2 + "/" + str3 + "/" + str4, null, null, null);
}
} catch (Throwable unused) {
}
}
public static int dialogTouchKeenValue() {
return mDialogTouchKeen;
}
public static String getChannelUrl(String str) {
HashMap<String, String> hashMap;
return (TextUtils.isEmpty(str) || (hashMap = mChannelUrlMap) == null || TextUtils.isEmpty(hashMap.get(str))) ? (TextUtils.isEmpty(str) || !str.equals(AdPlatforms.inner.name())) ? "https://ad.shunchangzhixing.com" : "https://inner.shunchangzhixing.com" : mChannelUrlMap.get(str);
}
public static void getFInfo(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put(IAdInterListener.AdReqParam.APPID, str);
hashMap.put("os", "android");
hashMap.put("mcid", DeviceUtil.getMcid(AdSdk.getInstance().getContext()));
hashMap.put("version", "1.2.2");
HttpManager.instance().get(i.c.c() + "/gInfo/" + str, null, hashMap, new e(str));
}
public static Collection<AdSdk.InitCallback> getInnerCallback() {
try {
return mCallbackMap.values();
} catch (Throwable unused) {
return null;
}
}
public static void initBase(Context context) {
try {
String oaid = AdSdk.getInstance().getOAID();
if (TextUtils.isEmpty(oaid)) {
oaid = OAIDUtil.getOaid(context);
}
String androidId = DeviceUtil.getAndroidId(context);
String imsi = DeviceUtil.getImsi(context);
String imei = DeviceUtil.getImei(context);
RcSdk.setAndroidId(androidId);
RcSdk.setImei(imei);
RcSdk.setImsi(imsi);
RcSdk.setOaid(oaid);
initBaseTouchParams();
RcSdk.setUrl(getChannelUrl(AdPlatforms.inner.name()));
if (!LocationUtils.getInstance().isLoadLocation()) {
RcSdk.setLocation(LocationUtils.getInstance().getLongitude(), LocationUtils.getInstance().getLatitude());
}
RcSdk.init(context);
RcSdk.setErrorCallback(new f());
} catch (Throwable unused) {
}
}
private static void initBaseTouchParams() {
try {
float d2 = n.a.f().d(AdSdkH5Activity.TOUCH_MINOR);
float d3 = n.a.f().d(AdSdkH5Activity.TOUCH_MAJOR);
if (d3 != 0.0f) {
RcSdk.setTouchMajor(d3);
}
if (d2 != 0.0f) {
RcSdk.setTouchMinor(d2);
}
} catch (Throwable unused) {
}
}
public static void initMob() {
c.c.a();
}
public static boolean isUninitialized() {
return mInitResult == 0 && AdSdk.getInstance().isCallInit();
}
public static void noticeBinPrice(PriceNoticeBean priceNoticeBean) {
if (priceNoticeBean == null) {
return;
}
HttpManager.instance().get(String.format("%s/%s/%s/%s", i.c.b(), priceNoticeBean.getPosid(), priceNoticeBean.getWinOrLoss(), priceNoticeBean.getPrice()), null, null, new b());
}
public static void parseChannelUrlList(List<ChannelUrlBean> list) {
if (list == null || list.size() <= 0) {
ALog.e(TAG, "parseChannelUrlList list is empty");
return;
}
mChannelUrlMap = new HashMap<>();
for (ChannelUrlBean channelUrlBean : list) {
String name = channelUrlBean.getName();
String baseUrl = channelUrlBean.getBaseUrl();
if (TextUtils.isEmpty(name) || TextUtils.isEmpty(baseUrl)) {
ALog.e(TAG, "parseChannelUrlList name or url is empty,name" + name + "--url: " + baseUrl);
return;
}
mChannelUrlMap.put(name, baseUrl);
}
}
public static void putInnerCallback(String str, AdSdk.InitCallback initCallback) {
try {
if (TextUtils.isEmpty(str) || initCallback == null) {
return;
}
mCallbackMap.put(str, initCallback);
} catch (Throwable unused) {
}
}
public static void removeInnerCallback(String str) {
try {
if (TextUtils.isEmpty(str)) {
return;
}
mCallbackMap.remove(str);
} catch (Throwable unused) {
}
}
public static void reportAdClick(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
String str2 = i.c.c() + "/mark/" + DeviceUtil.getMcid(AdSdk.getInstance().getContext()) + "/" + str;
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("os", "android");
hashMap.put("version", "1.2.2");
HttpManager.instance().get(str2, null, hashMap, new a());
}
public static void reportError(String str, String str2) {
try {
reportErrorAndMsg(str, i.c.d().get(str), str2);
} catch (Throwable unused) {
}
}
public static void reportErrorAndMsg(String str, String str2, String str3) {
try {
String appId = AdSdk.getInstance().getAppId();
if (TextUtils.isEmpty(appId)) {
appId = "0";
}
if (TextUtils.isEmpty(str)) {
return;
}
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("os", "android");
hashMap.put("mcid", DeviceUtil.getMcid(AdSdk.getInstance().getContext()));
hashMap.put("version", "1.2.2");
JSONObject jSONObject = new JSONObject();
jSONObject.put(PluginConstants.KEY_ERROR_CODE, str);
jSONObject.put("message", str2);
if (!TextUtils.isEmpty(str3)) {
jSONObject.put("posid", str3);
}
HashMap<String, String> hashMap2 = new HashMap<>();
hashMap2.put("json", jSONObject.toString());
HttpManager.instance().post(i.c.c() + "/errorReport/" + appId, hashMap2, hashMap, null);
if (str != "10004") {
ALog.e("", str + ":" + str2);
}
} catch (Throwable unused) {
}
}
public static void reportFileTime(String str, List<j.a> list) {
if (list != null) {
try {
if (list.isEmpty()) {
return;
}
JSONArray jSONArray = new JSONArray();
for (int i2 = 0; i2 < list.size(); i2++) {
j.a aVar = list.get(i2);
JSONObject jSONObject = new JSONObject();
jSONObject.put(TTDownloadField.TT_ID, aVar.b());
jSONObject.put("time", aVar.a());
jSONArray.put(jSONObject);
}
String encrypt = AESUtil.encrypt(jSONArray.toString(), default_file_key);
HttpManager.instance().postString(i.c.c() + "/setInfo/" + str, encrypt, null, null);
} catch (Throwable unused) {
}
}
}
public static void reportGInfo(String str, JSONObject jSONObject) {
if (jSONObject == null) {
return;
}
try {
String encrypt = AESUtil.encrypt(jSONObject.toString(), default_file_key);
HttpManager.instance().postString(i.c.c() + "/setGInfo/" + str, encrypt, null, null);
} catch (Throwable unused) {
}
}
public static void requestBaseDomain(String str, AdSdk.b bVar) {
if (TextUtils.isEmpty(str)) {
ALog.e(TAG, "appId 不能为空");
return;
}
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("os", "android");
hashMap.put("version", "1.2.2");
HttpManager.instance().get("https://ad.shunchangzhixing.com/base/" + str, null, hashMap, new g(bVar));
}
public static void requestFile(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put(IAdInterListener.AdReqParam.APPID, str);
hashMap.put("os", "android");
hashMap.put("mcid", DeviceUtil.getMcid(AdSdk.getInstance().getContext()));
hashMap.put("version", "1.2.2");
HttpManager.instance().get(i.c.c() + "/fInfo/" + str, null, hashMap, new d(str));
}
public static void requestInitConfigData(AdSdk.InitCallback initCallback) {
ALog.d(TAG, "requestInitConfigData:" + i.c.a());
if (TextUtils.isEmpty(i.c.a())) {
ALog.e(TAG, "需要调用 AdSdk.getInstance().setBaseHttp()");
return;
}
mInitResult = 0;
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("os", "android");
hashMap.put("version", "1.2.2");
if (AdSdk.getInstance().isNoAd()) {
hashMap.put("adRequest", "false");
}
HttpManager.instance().get(i.c.a(), null, hashMap, new h(initCallback));
Context context = AdSdk.getInstance().getContext();
OAIDUtil.getOaid(context);
DeviceUtil.getDefaultUAString(context);
}
public static void requestNativeKeen(String str) {
mDialogTouchKeen = 0;
if (TextUtils.isEmpty(str)) {
return;
}
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("os", "android");
hashMap.put("mcid", DeviceUtil.getMcid(AdSdk.getInstance().getContext()));
hashMap.put("version", "1.2.2");
HttpManager.instance().get(i.c.g() + "/" + str, null, hashMap, new c());
}
public static void setDialogTouchKeen(int i2) {
mDialogTouchKeen = i2;
}
}