翰林优商.apk(点击下载) / b.java


package com.mobile.auth.i;

import android.content.Context;
import android.content.SharedPreferences;
import com.baidu.idl.face.platform.FaceEnvironment;
import com.baidu.mobads.sdk.internal.ae;
import com.cmic.sso.sdk.h.d;
import com.cmic.sso.sdk.h.f;
import com.cmic.sso.sdk.h.j;
import com.cmic.sso.sdk.h.l;
import com.cmic.sso.sdk.h.o;
import com.cmic.sso.sdk.h.p;
import com.cmic.sso.sdk.h.t;
import com.cmic.sso.sdk.h.u;
import com.cmic.sso.sdk.h.v;
import com.cmic.sso.sdk.h.y;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mobile.auth.BuildConfig;
import com.mobile.auth.g.d;
import java.util.Iterator;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class b {
    private com.cmic.sso.sdk.a a;
    private Context b;

    /* access modifiers changed from: package-private */
    public class a extends u.a {
        final /* synthetic */ JSONObject a;

        a(JSONObject jSONObject) {
            this.a = jSONObject;
        }

        @Override // com.cmic.sso.sdk.h.u.a
        public void a() {
            b.this.a((b) this.a);
        }
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.mobile.auth.i.b$b  reason: collision with other inner class name */
    public class C0252b implements com.mobile.auth.h.b {
        C0252b(b bVar) {
        }

        @Override // com.mobile.auth.h.b
        public void a(String str, String str2, JSONObject jSONObject) {
        }
    }

    /* access modifiers changed from: package-private */
    public class c implements d.b {
        final /* synthetic */ String a;
        final /* synthetic */ com.mobile.auth.h.b b;

        c(String str, com.mobile.auth.h.b bVar) {
            this.a = str;
            this.b = bVar;
        }

        @Override // com.cmic.sso.sdk.h.d.b
        public void a(String str, String str2) {
            f.a("SendLog", "request success , url : " + this.a + ">>>>result : " + str);
            SharedPreferences.Editor a2 = p.a();
            a2.putInt("logFailTimes", 0);
            a2.commit();
            try {
                JSONObject jSONObject = new JSONObject(str);
                this.b.a(jSONObject.optString("resultCode"), jSONObject.optString(CampaignEx.JSON_KEY_DESC), jSONObject);
            } catch (Exception e) {
                e.printStackTrace();
                a("200021", "数据解析异常", str2);
            }
        }

        @Override // com.cmic.sso.sdk.h.d.b
        public void a(String str, String str2, String str3) {
            com.mobile.auth.f.a a2 = b.this.a.a();
            if (!(a2.q() == 0 || a2.p() == 0)) {
                int a3 = p.a("logFailTimes", 0) + 1;
                SharedPreferences.Editor a4 = p.a();
                if (a3 >= a2.p()) {
                    a4.putInt("logFailTimes", 0);
                    a4.putLong("logCloseTime", System.currentTimeMillis());
                } else {
                    a4.putInt("logFailTimes", a3);
                }
                a4.commit();
            }
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("resultCode", str);
                jSONObject.put(CampaignEx.JSON_KEY_DESC, str2);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            f.a("SendLog", "request failed , url : " + this.a + ">>>>>errorMsg : " + jSONObject.toString());
            com.mobile.auth.h.b bVar = this.b;
            if (bVar != null) {
                bVar.a(str, str2, jSONObject);
            }
        }
    }

    private <T extends com.mobile.auth.g.f> void a(String str, T t, com.mobile.auth.h.b bVar) {
        f.a("SendLog", "request https url : " + str + ">>>>>>> PARAMS : " + t.a().toString());
        new d().a(str, t, false, new c(str, bVar), ae.b, this.a.a("traceId", ""), this.a);
    }

    private void a(JSONArray jSONArray, com.mobile.auth.h.b bVar) {
        com.mobile.auth.g.d dVar = new com.mobile.auth.g.d();
        d.a aVar = new d.a();
        d.b bVar2 = new d.b();
        bVar2.d(y.a());
        bVar2.e(v.a());
        bVar2.b(this.a.a("appid", ""));
        bVar2.a(MBridgeConstans.NATIVE_VIDEO_VERSION);
        bVar2.c(bVar2.f());
        if (jSONArray == null) {
            jSONArray = new JSONArray();
        }
        aVar.a(jSONArray);
        dVar.a(aVar);
        dVar.a(bVar2);
        com.mobile.auth.f.a a2 = this.a.a();
        a("https://" + a2.f() + "/log/logReport", dVar, bVar);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(JSONObject jSONObject) {
        JSONArray jSONArray = new JSONArray();
        jSONArray.put(jSONObject);
        a(jSONArray, new C0252b(this));
    }

    public void a(Context context, String str, com.cmic.sso.sdk.a aVar, Throwable th) {
        this.b = context;
        try {
            a aVar2 = new a();
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("resultCode", str);
            JSONArray jSONArray = null;
            jSONObject.put("PGWResultCode", aVar.a("PGWResultCode", (String) null));
            JSONObject jSONObject2 = new JSONObject();
            StringBuilder sb = new StringBuilder();
            sb.append(t.a(this.b));
            aVar2.F(sb.toString());
            jSONObject2.put("timeOut", aVar.c("timeOut"));
            jSONObject2.put("imsiState", aVar.c("imsiState"));
            aVar2.x(aVar.a("isCacheScrip", false) ? "scrip" : "pgw");
            if ("loginAuth".equals(aVar.c("loginMethod"))) {
                aVar2.C("loginAuth");
            } else if ("mobileAuth".equals(aVar.c("loginMethod"))) {
                aVar2.C("mobileAuth");
            } else {
                aVar2.C("preGetMobile");
            }
            aVar2.y(aVar.c("traceId"));
            aVar2.D(aVar.c("appid"));
            aVar2.r(j.c(this.b));
            aVar2.s(j.d(this.b));
            aVar2.b(aVar.c("degrade"));
            aVar2.c(t.c(this.b));
            aVar2.d(aVar.c("protocol"));
            aVar2.E(BuildConfig.CMCC_SDK_VERSION);
            aVar2.p(FaceEnvironment.OS);
            aVar2.q(aVar.c("timeOut"));
            aVar2.z(aVar.c("starttime"));
            String str2 = "1";
            aVar2.a(aVar.a("hsaReadPhoneStatePermission", false) ? str2 : "0");
            long currentTimeMillis = System.currentTimeMillis();
            aVar2.B(v.a(currentTimeMillis));
            StringBuilder sb2 = new StringBuilder();
            sb2.append(currentTimeMillis - aVar.b("starttimemills"));
            aVar2.o(sb2.toString());
            aVar2.m(aVar.a("interfacetype", ""));
            aVar.b("interfacetype", "");
            aVar2.i(aVar.a("interfacecode", ""));
            aVar.b("interfacecode", "");
            aVar2.j(aVar.a("interfaceelasped", ""));
            aVar.b("interfaceelasped", "");
            StringBuilder sb3 = new StringBuilder();
            sb3.append(aVar.a("loginTime", 0L));
            aVar2.k(sb3.toString());
            aVar2.u(aVar.a("operatorType", ""));
            if (aVar.a("startnetworkType", 0) == 0) {
                StringBuilder sb4 = new StringBuilder();
                sb4.append(t.a(this.b));
                aVar2.F(sb4.toString());
            } else {
                StringBuilder sb5 = new StringBuilder();
                sb5.append(aVar.a("startnetworkType", 0));
                aVar2.F(sb5.toString());
            }
            aVar2.A(aVar.c("networkClass"));
            aVar2.l(t.a());
            aVar2.v(t.b());
            aVar2.w(t.c());
            aVar2.t(aVar.c("simCardNum"));
            aVar2.h(str);
            if (!l.a()) {
                str2 = "0";
            }
            aVar2.g(str2);
            aVar2.f(aVar.a("imsiState", "0"));
            StringBuilder sb6 = new StringBuilder();
            sb6.append(System.currentTimeMillis() - aVar.a("methodTimes", 0L));
            aVar2.o(sb6.toString());
            if (th != null) {
                jSONArray = new JSONArray();
                JSONObject jSONObject3 = new JSONObject();
                StringBuffer stringBuffer = new StringBuffer();
                StackTraceElement[] stackTrace = th.getStackTrace();
                for (StackTraceElement stackTraceElement : stackTrace) {
                    stringBuffer.append("\n");
                    stringBuffer.append(stackTraceElement.toString());
                }
                jSONObject3.put("message", th.toString());
                jSONObject3.put("stack", stringBuffer.toString());
                jSONArray.put(jSONObject3);
            }
            if (a.a.size() > 0) {
                if (jSONArray == null) {
                    jSONArray = new JSONArray();
                }
                Iterator<Throwable> it = a.a.iterator();
                while (it.hasNext()) {
                    Throwable next = it.next();
                    StringBuffer stringBuffer2 = new StringBuffer();
                    JSONObject jSONObject4 = new JSONObject();
                    StackTraceElement[] stackTrace2 = next.getStackTrace();
                    for (StackTraceElement stackTraceElement2 : stackTrace2) {
                        stringBuffer2.append("\n");
                        stringBuffer2.append(stackTraceElement2.toString());
                    }
                    jSONObject4.put("message", next.toString());
                    jSONObject4.put("stack", stringBuffer2.toString());
                    jSONArray.put(jSONObject4);
                }
                a.a.clear();
            }
            if (jSONArray != null && jSONArray.length() > 0) {
                aVar2.a(jSONArray);
            }
            aVar2.e(p.b("AID", ""));
            aVar2.G(o.a(this.b).d());
            f.a("SendLog", "登录日志" + aVar2.a());
            a(this.b, aVar2.a(), aVar);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void a(Context context, JSONObject jSONObject, com.cmic.sso.sdk.a aVar) {
        this.a = aVar;
        this.b = context;
        u.a(new a(jSONObject));
    }
}