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


package com.mobile.auth.x;

import android.content.Context;
import android.net.Network;
import android.os.Build;
import android.text.TextUtils;
import com.baidu.speech.utils.AsrError;
import com.bytedance.sdk.openadsdk.api.plugin.PluginConstants;
import com.kwai.video.player.KsMediaMeta;
import com.mobile.auth.BuildConfig;
import com.mobile.auth.gatewayauth.ExceptionProcessor;
import com.mobile.auth.w.b;
import com.mobile.auth.z.b;
import com.mobile.auth.z.c;
import com.mobile.auth.z.f;
import com.mobile.auth.z.g;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.json.JSONObject;

public class a {
    private ScheduledExecutorService a = Executors.newScheduledThreadPool(1);
    private ExecutorService b = Executors.newSingleThreadExecutor();
    private b c;
    private String d;

    static /* synthetic */ b a(a aVar) {
        try {
            return aVar.c;
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    static /* synthetic */ b a(a aVar, b bVar) {
        try {
            aVar.c = bVar;
            return bVar;
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    private String a(Context context, int i, String str) {
        try {
            String packageName = context.getPackageName();
            String b2 = g.b(context, context.getPackageName());
            if (packageName == null) {
                packageName = "";
            }
            if (b2 == null) {
                b2 = "";
            }
            String a2 = f.a();
            String str2 = i != 2 ? "1" : "";
            StringBuilder sb = new StringBuilder();
            sb.append(System.currentTimeMillis());
            String sb2 = sb.toString();
            String a3 = b.a(g.c(context).getBytes());
            String d2 = g.d(str);
            String a4 = g.a(str2 + a2 + "30100" + "jsonp" + a3 + d2 + packageName + b2 + sb2 + BuildConfig.CUCC_SDK_VERSION + f.b());
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("client_id", a2);
            jSONObject.put("client_type", "30100");
            jSONObject.put(KsMediaMeta.KSM_KEY_FORMAT, b.a("jsonp"));
            jSONObject.put("version", b.a(BuildConfig.CUCC_SDK_VERSION));
            if (i != 2) {
                jSONObject.put("business_type", b.a(str2));
            }
            jSONObject.put("packname", b.a(packageName));
            jSONObject.put("packsign", b.a(b2));
            jSONObject.put("timeStamp", b.a(sb2));
            jSONObject.put("key", b.a(d2));
            jSONObject.put("fp", b.a(a3));
            jSONObject.put("sign", b.a(a4));
            return jSONObject.toString();
        } catch (Exception e) {
            try {
                e.printStackTrace();
                return "";
            } catch (Throwable th) {
                ExceptionProcessor.processException(th);
                return null;
            }
        }
    }

    private void a() {
        try {
            ScheduledExecutorService scheduledExecutorService = this.a;
            if (scheduledExecutorService != null) {
                scheduledExecutorService.shutdownNow();
                this.a = null;
            }
        } catch (Exception e) {
            try {
                e.printStackTrace();
            } catch (Throwable th) {
                ExceptionProcessor.processException(th);
            }
        }
    }

    private void a(Context context, int i) {
        try {
            this.d = com.mobile.auth.w.a.a();
            a(context, i, new com.mobile.auth.y.a() {
                /* class com.mobile.auth.x.a.AnonymousClass2 */

                @Override // com.mobile.auth.y.a
                public void a(int i, String str) {
                    try {
                        synchronized (a.this) {
                            if (a.a(a.this) != null) {
                                if (i == 1) {
                                    try {
                                        JSONObject jSONObject = new JSONObject(str);
                                        int optInt = jSONObject.optInt(PluginConstants.KEY_ERROR_CODE);
                                        String optString = jSONObject.optString("msg");
                                        String optString2 = jSONObject.optString("data");
                                        if (optInt == 0) {
                                            a.a(a.this).a(optString, URLDecoder.decode(com.mobile.auth.w.a.a(optString2, a.c(a.this)), "UTF-8"));
                                        } else {
                                            a.a(a.this).a(optInt, optString, optString2);
                                        }
                                    } catch (Exception e) {
                                        b a2 = a.a(a.this);
                                        a2.a(10002, "异常" + e.getMessage(), str);
                                    }
                                } else {
                                    a.a(a.this).a(i, str);
                                }
                                a.a(a.this, (b) null);
                                a.b(a.this);
                            }
                        }
                    } catch (Throwable th) {
                        ExceptionProcessor.processException(th);
                    }
                }
            });
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
        }
    }

    private void a(final Context context, final int i, final com.mobile.auth.y.a aVar) {
        try {
            int a2 = g.a(context.getApplicationContext());
            f.b(a2);
            if (a2 == 1) {
                com.mobile.auth.z.b.a().a(context, "https://opencloud.wostore.cn/openapi/netauth/precheck/wp?", new b.a() {
                    /* class com.mobile.auth.x.a.AnonymousClass3 */

                    @Override // com.mobile.auth.z.b.a
                    public void a(boolean z, Network network) {
                        if (z) {
                            try {
                                a.a(a.this, context, i, "https://opencloud.wostore.cn/openapi/netauth/precheck/wp?", network, aVar);
                            } catch (Throwable th) {
                                ExceptionProcessor.processException(th);
                            }
                        } else {
                            aVar.a(10003, "无法切换至数据网络");
                        }
                    }
                });
            } else if (a2 == 0) {
                a(context, i, "https://opencloud.wostore.cn/openapi/netauth/precheck/wp?", null, aVar);
            } else {
                aVar.a(10004, "数据网络未开启");
            }
        } catch (Exception e) {
            try {
                e.printStackTrace();
                aVar.a(AsrError.ERROR_OFFLINE_NOT_INITIAL, "网络判断异常" + e.getMessage());
            } catch (Throwable th) {
                ExceptionProcessor.processException(th);
            }
        }
    }

    private void a(Context context, int i, String str, final Network network, final com.mobile.auth.y.a aVar) {
        try {
            synchronized (this) {
                try {
                    final String str2 = str + c.a(a(context, i, this.d), "&");
                    this.b.submit(new Runnable() {
                        /* class com.mobile.auth.x.a.AnonymousClass4 */

                        public void run() {
                            try {
                                String a2 = new com.mobile.auth.y.b().a(str2, a.d(a.this), network);
                                if (TextUtils.isEmpty(a2)) {
                                    aVar.a(10022, "网络请求响应为空");
                                } else {
                                    aVar.a(1, a2);
                                }
                            } catch (Exception e) {
                                try {
                                    e.printStackTrace();
                                } catch (Throwable th) {
                                    ExceptionProcessor.processException(th);
                                }
                            }
                        }
                    });
                } catch (Exception e) {
                    aVar.a(AsrError.ERROR_OFFLINE_ENGINE_INITIAL_FAIL, "10009" + e.getMessage());
                }
            }
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
        }
    }

    static /* synthetic */ void a(a aVar, Context context, int i, String str, Network network, com.mobile.auth.y.a aVar2) {
        try {
            aVar.a(context, i, str, network, aVar2);
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
        }
    }

    private HashMap<String, String> b() {
        try {
            HashMap<String, String> hashMap = new HashMap<>();
            hashMap.put("model", Build.MODEL);
            hashMap.put("system", Build.VERSION.RELEASE);
            hashMap.put("woodcock", f.i());
            return hashMap;
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    static /* synthetic */ void b(a aVar) {
        try {
            aVar.a();
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
        }
    }

    static /* synthetic */ String c(a aVar) {
        try {
            return aVar.d;
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    static /* synthetic */ HashMap d(a aVar) {
        try {
            return aVar.b();
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    public void a(Context context, int i, int i2, com.mobile.auth.v.a aVar) {
        try {
            b bVar = new b();
            this.c = bVar;
            bVar.a(aVar);
            try {
                this.a.schedule(new Runnable() {
                    /* class com.mobile.auth.x.a.AnonymousClass1 */

                    public void run() {
                        try {
                            synchronized (a.this) {
                                if (a.a(a.this) != null) {
                                    a.a(a.this).a(10000, "请求超时");
                                    a.a(a.this, (b) null);
                                    a.b(a.this);
                                }
                            }
                        } catch (Throwable th) {
                            ExceptionProcessor.processException(th);
                        }
                    }
                }, (long) i, TimeUnit.MILLISECONDS);
                a(context, i2);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
        }
    }
}