OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

以下内容为反编译后的 UserUtil.java 源代码,内容仅作参考


package com.excelliance.kxqp.gs.util;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.excean.bytedancebi.manager.BiManager;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.bean.LoginUserInfo;
import com.excelliance.kxqp.gs.util.bk;
import java.util.HashMap;
import org.apache.http.client.config.CookieSpecs;
import org.json.JSONException;
import org.json.JSONObject;

public class UserUtil {
    private static final String TAG = "UserUtil";
    private static UserUtil mUserUtil;

    private UserUtil() {
    }

    public static UserUtil getInstance() {
        if (mUserUtil == null) {
            synchronized (UserUtil.class) {
                if (mUserUtil == null) {
                    mUserUtil = new UserUtil();
                }
            }
        }
        return mUserUtil;
    }

    public void clearLocalUserInfo(SharedPreferences sharedPreferences, Context context) {
        bx a2 = bx.a();
        context.getSharedPreferences("alipay", 4).edit().remove(a2.a(context)).commit();
        a2.b(sharedPreferences, "SWITCH_ACCOUNT", true);
        a2.a(sharedPreferences, "USER_ID", 0);
        BiManager.setUUID(null);
        a2.b(sharedPreferences, t.f12028b, false);
        com.excelliance.kxqp.gs.g.aa.a(context).a(0);
        a2.b(sharedPreferences, t.c, "");
        a2.b(sharedPreferences, t.f, "");
        a2.b(sharedPreferences, t.g, "");
        a2.a(sharedPreferences, t.d, 0);
        a2.b(sharedPreferences, t.e, "");
        a2.b(sharedPreferences, t.j, "");
        a2.b(sharedPreferences, t.f, "");
        a2.b(sharedPreferences, "MM_ORDER", "");
        a2.b(sharedPreferences, "END_TIME", "");
        a2.b(sharedPreferences, t.h, "");
        a2.b(sharedPreferences, t.i, "");
        a2.a(sharedPreferences, t.k, 2);
        a2.a(sharedPreferences, t.l, 2);
        a2.a(sharedPreferences, "USER_REAL_NAME_VERIFY", 0);
        a2.b(sharedPreferences, "USER_REAL_NAME", "");
        a2.b(sharedPreferences, "USER_ID_NUMBER", "");
        a2.a(sharedPreferences, "USER_IS_ADULT", 0);
        HashMap hashMap = new HashMap();
        hashMap.put(BiManager.IS_VIP, "否");
        hashMap.put(BiManager.IS_LOGIN, "否");
        hashMap.put(BiManager.IS_WECHAT_LOGIN, "否");
        hashMap.put(BiManager.CURRENT_VIP_TYPE, "");
        BiManager.setPublicPresetParam(hashMap);
        com.excelliance.kxqp.gs.ui.medal.a.l.a(context).b();
    }

    public void loginOut(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("USERINFO", 4);
        clearLocalUserInfo(sharedPreferences, context);
        sharedPreferences.edit().putString("USER_P002", null).apply();
        com.excelliance.kxqp.task.g.g.a().d(context);
        aq.a().j(context);
        az.d(TAG, "LoginOut");
        if (b.bh(context)) {
            com.excelliance.kxqp.gs.newappstore.b.a.a().a(null, context.getApplicationContext(), 2);
        }
    }

    public String getRequestParams(SharedPreferences sharedPreferences, Context context) {
        GameUtil intance = GameUtil.getIntance();
        String r = intance.r(context);
        String v = intance.v(context);
        String w = intance.w(context);
        String packageName = context.getPackageName();
        String q = intance.q();
        String y = intance.y(context);
        int s = intance.s(context);
        int l = intance.l();
        int j = intance.j();
        int h = intance.h();
        int i = intance.i();
        int i2 = Build.VERSION.SDK_INT;
        if (sharedPreferences == null) {
            Log.d(TAG, "userInfo SP is null");
            return "";
        }
        String a2 = bx.a().a(sharedPreferences, "USER_NAME", CookieSpecs.DEFAULT);
        int b2 = bx.a().b(sharedPreferences, "USER_ID");
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("aid", r);
            jSONObject.put("imei", v);
            jSONObject.put("imsi", w);
            jSONObject.put("pkgName", packageName);
            jSONObject.put("model", q);
            jSONObject.put("screen", y);
            jSONObject.put("compVer", s);
            jSONObject.put("mainVer", l);
            jSONObject.put("otaVer", j);
            jSONObject.put("chid", h);
            jSONObject.put("subchid", i);
            jSONObject.put("userName", a2);
            jSONObject.put("rid", b2);
            jSONObject.put("api", i2);
            return intance.a(context, jSONObject).toString();
        } catch (JSONException e) {
            e.printStackTrace();
            Log.d(TAG, "json exception");
            return "";
        }
    }

    public String getRequestParamsForLogin(Context context, String str, String str2, int i) {
        GameUtil intance = GameUtil.getIntance();
        String r = intance.r(context);
        String v = intance.v(context);
        String w = intance.w(context);
        String packageName = context.getPackageName();
        String q = intance.q();
        String y = intance.y(context);
        int s = intance.s(context);
        int l = intance.l();
        int j = intance.j();
        int h = intance.h();
        int i2 = intance.i();
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("aid", r);
            jSONObject.put("imei", v);
            jSONObject.put("imsi", w);
            jSONObject.put("pkgName", packageName);
            jSONObject.put("model", q);
            jSONObject.put("screen", y);
            jSONObject.put("compVer", s);
            jSONObject.put("mainVer", l);
            jSONObject.put("otaVer", j);
            jSONObject.put("chid", h);
            jSONObject.put("subchid", i2);
            jSONObject.put("userName", str);
            jSONObject.put("pwd", str2);
            jSONObject.put("type", i);
            return intance.a(context, jSONObject).toString();
        } catch (JSONException e) {
            e.printStackTrace();
            Log.d(TAG, "json exception");
            return "";
        }
    }

    public void loginOperate(final Context context, String str, final String str2, final String str3) {
        String a2 = c.a(str);
        Log.d(TAG, "content : " + a2);
        bk.a().a("https://sdk.ourplay.com.cn/account/login.php", a2, new bk.a() {
            @Override
            public void a(String str4) {
                Log.d(UserUtil.TAG, "response = " + str4);
                try {
                    String a3 = c.a(str4, t.f12027a);
                    if (TextUtils.isEmpty(a3)) {
                        Log.d(UserUtil.TAG, "content is empty");
                        return;
                    }
                    try {
                        JSONObject jSONObject = new JSONObject(a3);
                        if (jSONObject.optInt("od") != 1) {
                            UserUtil.this.checkLoginIsSuccess(context, jSONObject, str2, str3);
                        } else {
                            Log.d(UserUtil.TAG, "od = 1");
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                        Log.d(UserUtil.TAG, "json exception");
                    }
                } catch (Exception e2) {
                    e2.printStackTrace();
                    Log.d(UserUtil.TAG, "AES exception = " + e2.getMessage().toString());
                }
            }

            @Override
            public void b(String str4) {
                Log.d(UserUtil.TAG, "onFailed info = " + str4);
            }
        });
    }

    public void checkLoginIsSuccess(Context context, JSONObject jSONObject, String str, String str2) {
        int optInt = jSONObject.optInt("flag");
        Log.d(TAG, "flag = " + optInt);
        if (optInt == 1) {
            cg.a(context, com.excelliance.kxqp.swipe.a.a.getString(context, "login_success"));
            SharedPreferences sharedPreferences = context.getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
            bx a2 = bx.a();
            a2.b(sharedPreferences, "SWITCH_ACCOUNT", true);
            a2.b(sharedPreferences, t.f12028b, true);
            a2.b(sharedPreferences, "USER_NAME", str);
            a2.b(sharedPreferences, "USER_P002", str2);
            jsonParseAndSaveSharedPre(context, jSONObject);
            sharedPreferences.edit().putBoolean("OFFLINE_NOTICE", false).apply();
        }
    }

    private void jsonParseAndSaveSharedPre(Context context, JSONObject jSONObject) {
        int optInt = jSONObject.optInt("vip");
        String optString = jSONObject.optString("nickname");
        int optInt2 = jSONObject.optInt("sex", 0);
        String optString2 = jSONObject.optString("birthday");
        String optString3 = jSONObject.optString("phoneNum");
        Log.d(TAG, "phoneNumber = " + optString3);
        int optInt3 = jSONObject.optInt("rid");
        bx a2 = bx.a();
        SharedPreferences sharedPreferences = context.getSharedPreferences("USERINFO", Build.VERSION.SDK_INT >= 11 ? 4 : 0);
        com.excelliance.kxqp.gs.g.aa.a(context).a(optInt);
        a2.b(sharedPreferences, t.c, optString);
        a2.a(sharedPreferences, t.d, optInt2);
        a2.b(sharedPreferences, t.e, optString2);
        a2.b(sharedPreferences, t.j, optString3);
        a2.a(sharedPreferences, "USER_ID", optInt3);
        BiManager.setUUID(optInt3 + "");
    }

    public void handleLoginResult(Context context, String str, String str2, String str3) {
        JSONObject jSONObject;
        cn.c(context, 0);
        try {
            jSONObject = new JSONObject(str3);
        } catch (JSONException e) {
            e.printStackTrace();
            jSONObject = null;
        }
        if (jSONObject == null) {
            return;
        }
        com.excelliance.kxqp.task.g.g.a().b(context);
        aq.a().g(context);
        SharedPreferences sharedPreferences = context.getSharedPreferences("USERINFO", 0);
        bx a2 = bx.a();
        a2.b(sharedPreferences, "SWITCH_ACCOUNT", true);
        a2.b(sharedPreferences, t.f12028b, true);
        a2.b(sharedPreferences, "USER_NAME", str);
        a2.b(sharedPreferences, "USER_P002", str2);
        int optInt = jSONObject.optInt("firstPay");
        int optInt2 = jSONObject.optInt("diamond");
        int optInt3 = jSONObject.optInt("vip");
        String optString = jSONObject.optString("nickname");
        int optInt4 = jSONObject.optInt("sex", 0);
        String optString2 = jSONObject.optString("birthday");
        String optString3 = jSONObject.optString("phoneNum");
        String optString4 = jSONObject.optString("headIconUrl");
        String optString5 = jSONObject.optString("avatar_frame");
        int optInt5 = jSONObject.optInt("rid");
        String optString6 = jSONObject.optString("endTime", "0");
        if ("null".equals(optString6)) {
            optString6 = "0";
        }
        String str4 = optString6;
        int optInt6 = jSONObject.optInt("headstu", 2);
        int optInt7 = jSONObject.optInt("nickstu", 2);
        String optString7 = jSONObject.optString("curtime", "0");
        Log.d(TAG, "handleLoginResult: response = " + str3);
        String optString8 = jSONObject.optString("open_id");
        String optString9 = jSONObject.optString("wx_nickname");
        String optString10 = jSONObject.optString("username");
        int optInt8 = jSONObject.optInt("isVerified");
        String optString11 = jSONObject.optString("realUsername");
        String optString12 = jSONObject.optString("idNumber");
        String optString13 = jSONObject.optString("token");
        int optInt9 = jSONObject.optInt("isAdult");
        com.quick.sdk.passport.b.b(optInt5, optString13, jSONObject.optLong("expire"));
        com.excelliance.kxqp.gs.g.aa.a(context).a(optInt3);
        a2.a(sharedPreferences, "USER_FIRST_PAY", optInt);
        a2.a(sharedPreferences, "USER_DIAMOND", optInt2);
        a2.b(sharedPreferences, t.c, optString);
        a2.b(sharedPreferences, t.f, optString4);
        a2.b(sharedPreferences, t.g, optString5);
        a2.a(sharedPreferences, t.d, optInt4);
        a2.b(sharedPreferences, t.e, optString2);
        a2.b(sharedPreferences, t.j, optString3);
        a2.a(sharedPreferences, "USER_ID", optInt5);
        BiManager.setUUID(optInt5 + "");
        a2.b(sharedPreferences, "END_TIME", (Long.parseLong(str4) * 1000) + "");
        a2.b(sharedPreferences, "CUR_TIME", optString7);
        a2.b(sharedPreferences, t.i, optString8);
        a2.b(sharedPreferences, t.h, optString9);
        a2.a(sharedPreferences, t.k, optInt6);
        a2.a(sharedPreferences, t.l, optInt7);
        a2.a(sharedPreferences, "USER_REAL_NAME_VERIFY", optInt8);
        a2.b(sharedPreferences, "USER_REAL_NAME", optString11);
        a2.b(sharedPreferences, "USER_ID_NUMBER", optString12);
        a2.a(sharedPreferences, "USER_IS_ADULT", optInt9);
        if (TextUtils.isEmpty(str)) {
            a2.b(sharedPreferences, "USER_NAME", optString10);
        }
        HashMap hashMap = new HashMap();
        hashMap.put(BiManager.IS_LOGIN, "是");
        hashMap.put(BiManager.IS_REGISTER, "是");
        BiManager.setPublicPresetParam(hashMap);
        sharedPreferences.edit().putBoolean("OFFLINE_NOTICE", false).apply();
    }

    public void updateHeadStuAndNickStu(Context context, LoginUserInfo loginUserInfo) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("USERINFO", 0);
        bx a2 = bx.a();
        a2.a(sharedPreferences, t.k, loginUserInfo.headstu);
        a2.a(sharedPreferences, t.l, loginUserInfo.nickstu);
        a2.b(sharedPreferences, t.c, loginUserInfo.nickname);
        a2.b(sharedPreferences, t.f, loginUserInfo.headIconUrl);
        a2.b(sharedPreferences, t.g, loginUserInfo.headFrameIconUrl);
        com.excelliance.kxqp.gs.ui.medal.a.c.a(context).a(loginUserInfo.headIconUrl);
        com.excelliance.kxqp.gs.ui.medal.a.b.a(context).a(loginUserInfo.headFrameIconUrl);
        Intent intent = new Intent("action_update_head_name_stu");
        intent.putExtra("head_stu", loginUserInfo.headstu);
        intent.putExtra("name_stu", loginUserInfo.nickstu);
        context.sendBroadcast(intent);
    }
}