package com.mob.secverify.pure.a.a.d; import a40.f; import android.content.Context; import android.net.Network; import android.text.TextUtils; import com.meizu.cloud.pushsdk.constants.PushConstants; import com.mob.MobSDK; import com.mob.secverify.common.callback.b; import com.mob.secverify.common.exception.VerifyErr; import com.mob.secverify.common.exception.VerifyException; import com.mob.secverify.e.c; import com.mob.secverify.e.i; import com.mob.secverify.e.k; import com.mob.secverify.pure.a.a.c.c.j; import com.mob.secverify.pure.entity.PreVerifyResult; import com.mob.secverify.pure.entity.VerifyResult; import java.net.URLDecoder; import org.json.JSONObject; /* compiled from: XWExecutor */ public class d { /* renamed from: a reason: collision with root package name */ private Network f6650a; /* compiled from: XWExecutor */ public class a implements k.a { public a() { } @Override // com.mob.secverify.e.k.a public void a(Network network, boolean z) { d.this.f6650a = network; } } public void a(String str, String str2, b bVar, boolean z) { VerifyErr verifyErr = VerifyErr.C_ONE_KEY_OBTAIN_CU_OPERATOR_ACCESS_CODE_ERR; if (!z) { verifyErr = VerifyErr.C_ONE_KEY_OBTAIN_CU_OPERATOR_ACCESS_TOKEN_ERR; } String b = i.b(); Context context = MobSDK.getContext(); try { String a5 = i.a(1, b, str, str2); if (!TextUtils.isEmpty(a5)) { String a12 = k.a(a5, "&"); if (!TextUtils.isEmpty(a12)) { String g3 = f.g("https://opencloud.wostore.cn/openapi/netauth/precheck/wp?", a12); if (i.a(context) == 3) { k.a(context).a(new a(), "https://opencloud.wostore.cn/openapi/netauth/precheck/wp?"); } String str3 = ""; try { str3 = new f().a(g3, i.a(), this.f6650a); if (!TextUtils.isEmpty(str3)) { try { JSONObject jSONObject = new JSONObject(str3); int optInt = jSONObject.optInt(PushConstants.BASIC_PUSH_STATUS_CODE, 1); String optString = jSONObject.optString("msg", "未知错误"); String optString2 = jSONObject.optString("data"); if (optInt == 0) { try { String a13 = b.a(optString2, b); if (!TextUtils.isEmpty(a13)) { try { String decode = URLDecoder.decode(a13, "UTF-8"); if (!TextUtils.isEmpty(decode)) { JSONObject jSONObject2 = new JSONObject(decode); String optString3 = jSONObject2.optString("accessCode"); long optLong = jSONObject2.optLong("expires"); String optString4 = jSONObject2.optString("mobile"); if (!TextUtils.isEmpty(optString4) && !TextUtils.isEmpty(optString3)) { if (z) { long currentTimeMillis = (optLong * 1000) + System.currentTimeMillis(); jSONObject2.put("expires", currentTimeMillis); PreVerifyResult preVerifyResult = new PreVerifyResult(optString4, "CUCC", currentTimeMillis, "CUXW"); j.c(jSONObject2.toString()); j.d(str); bVar.a(preVerifyResult); return; } VerifyResult verifyResult = new VerifyResult(optString4, optString3, "CUCC"); j.c(null); j.d(null); bVar.a(verifyResult); return; } return; } throw new Throwable("URLDecode response empty"); } catch (Throwable th2) { bVar.a(new VerifyException(verifyErr, c.a(6450002, "URL解密异常", th2))); } } else { throw new Throwable("AESDecode response empty"); } } catch (Throwable th3) { bVar.a(new VerifyException(verifyErr, c.a(6450001, "aes解密异常", th3))); } } else { bVar.a(new VerifyException(verifyErr, c.a(optInt, optString))); } } catch (Throwable th4) { bVar.a(new VerifyException(verifyErr, c.a(6450004, "服务端返回格式不匹配", th4))); } } else { throw new Throwable("http response empty"); } } catch (Throwable th5) { bVar.a(new VerifyException(verifyErr, c.a(6450003, "http请求异常", th5))); } } else { throw new Throwable("参数格式异常"); } } else { throw new Throwable("请求参数为空"); } } catch (Throwable th6) { bVar.a(new VerifyException(verifyErr, c.a(6450005, "请求参数为空", th6))); } } }