和通讯录 v4.2.0版本的 MD5 值为:f213fa766dccbfebde0dd8add5534518
以下内容为反编译后的 OneCardLoginController.java 源代码,内容仅作参考
package com.chinamobile.contacts.im.mobilecard;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.chinamobile.contacts.im.App;
import com.chinamobile.contacts.im.Main;
import com.chinamobile.contacts.im.config.LoginInfoSP;
import com.chinamobile.contacts.im.config.g;
import com.chinamobile.contacts.im.enterpriseContact.utils.f;
import com.chinamobile.contacts.im.mobilecard.controller.AccessTokenController;
import com.chinamobile.contacts.im.mobilecard.data.SubPhonesCache;
import com.chinamobile.contacts.im.utils.ApplicationUtils;
import com.chinamobile.contacts.im.utils.bm;
import com.cmcc.sso.sdk.auth.AuthnConstants;
import com.huawei.mcs.cloud.msg.base.mms.Telephony;
import java.util.HashMap;
import java.util.UUID;
import org.json.JSONException;
import org.json.JSONObject;
public class OneCardLoginController {
public static final String API_VERSION = "1.0";
public static final String APP_KEY = "620b9ad5a2be89ba427640feb60f29d0";
public static final String APP_SECRET = "820b8d87a6ed65fb062f10c6f5ee5fe4";
public static String BASE_URL;
public static OneCardLoginController instance = null;
private Context mContext;
public interface OnLoadCompletedListener {
void onLoadCompleted(String str);
}
static {
BASE_URL = g.f1649a ? "https://api1.cytxl.com.cn/" : "https://api.cytxl.com.cn/";
}
public OneCardLoginController(Context context) {
this.mContext = context;
}
public static synchronized OneCardLoginController getInstance() {
OneCardLoginController oneCardLoginController;
synchronized (OneCardLoginController.class) {
if (instance == null) {
instance = new OneCardLoginController(App.b());
}
oneCardLoginController = instance;
}
return oneCardLoginController;
}
public void getLogin(final OnLoadCompletedListener onLoadCompletedListener) {
Main.c.execute(new Runnable() {
@Override
public void run() {
Log.e("Main", "和多号登录");
SubPhonesCache.getInstance().loadSubPhonesFromNet(onLoadCompletedListener);
}
});
}
public void queryUserInfo() {
try {
JSONObject jSONObject = new JSONObject();
String randomString = getRandomString(12);
HashMap hashMap = new HashMap();
hashMap.put("app_key", APP_KEY);
hashMap.put("access_token", LoginInfoSP.getAccessToken(this.mContext));
hashMap.put("once", randomString);
hashMap.put("version", API_VERSION);
hashMap.put("sdk_from", "java");
hashMap.put("authcode", LoginInfoSP.getAuthcode(this.mContext));
hashMap.put("client_version", ApplicationUtils.getVersionName(App.b()));
hashMap.put("device_id", ApplicationUtils.getUUID(App.b()));
hashMap.put("clientType", "4");
String signature = SignatureUtil.getSignature(hashMap);
jSONObject.put("app_key", APP_KEY);
jSONObject.put("access_token", LoginInfoSP.getAccessToken(this.mContext));
jSONObject.put("once", randomString);
jSONObject.put("version", API_VERSION);
jSONObject.put("sdk_from", "java");
jSONObject.put("authcode", LoginInfoSP.getAuthcode(this.mContext));
jSONObject.put(AuthnConstants.REQ_HEADER_KEY_SIGNATURE, signature);
jSONObject.put("client_version", ApplicationUtils.getVersionName(App.b()));
jSONObject.put("device_id", ApplicationUtils.getUUID(App.b()));
jSONObject.put("clientType", "4");
String a2 = f.a(this.mContext, BASE_URL + "mobilecard/userInfo.json", jSONObject.toString());
bm.d("OneCardLoginController", "queryUserInfo---" + a2.toString());
JSONObject jSONObject2 = new JSONObject(a2);
int optInt = jSONObject2.optInt(Telephony.TextBasedSmsColumns.ERROR_CODE, -1);
if (optInt == 0) {
bm.d("OneCardLoginController", "queryUserInfo---成功");
} else {
new AccessTokenController(App.b()).ProblemToGetAccessToken(optInt);
}
String optString = jSONObject2.optString("error_msg", "");
if (!TextUtils.isEmpty(optString)) {
bm.a("OneCardLoginController", "queryUserInfo---" + optString);
}
String optString2 = jSONObject2.optString("subPhoneList", "");
if (!TextUtils.isEmpty(optString2)) {
bm.a("OneCardLoginController", "queryUserInfo---" + optString2);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
public static String getRandomString(int i) {
return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 12);
}
}