|
发表于 2023-6-29 01:53:53
|
显示全部楼层
package com.wowi.nanoweb.services;
import android.content.Context;
import android.os.SystemProperties;
import android.provider.Settings.Global;
import com.alibaba.fastjson.JSONObject;
import com.wowi.nanoweb.JsonApi;
import com.wowi.nanoweb.services.field.mobile.Imei;
import com.wowi.nanoweb.services.field.mobile.SimCardCurrent;
public class SwitchSimCard extends JsonApi {
public static Context ctx;
public String call(JSONObject json) {
JSONObject jFields = json.getJSONObject("fields");
String password = jFields.getString("password");
String simswitchpd = "";
String changedPwd = Global.getString(ctx.getContentResolver(), "switchSimPwd");
if (changedPwd == null || changedPwd.length() <= 0) {
simswitchpd = SystemProperties.get("persist.ufi.ft.simswitchpword");
} else {
simswitchpd = changedPwd;
}
int simCardCurrent = jFields.getInteger("simCardCurrent").intValue();
String str = "";
String imei = (String) new Imei().query(str);
String str2 = "{ \"reply\": \"ok\" }";
if (simCardCurrent <= 0) {
if (!"0".equals(SystemProperties.get("persist.ufi.ft.simsw_pw"))) {
String str3 = "{ \"reply\": \"password error\" }";
if (simswitchpd == null || str.equals(simswitchpd) || "zx".equals(simswitchpd)) {
if (imei.length() < 6) {
return "{ \"reply\": \"device info error\" }";
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(imei.substring(imei.length() - 6));
stringBuilder.append("66");
if (!stringBuilder.toString().equals(password)) {
return str3;
}
new SimCardCurrent().set(str, Integer.valueOf(simCardCurrent));
return str2;
} else if (!simswitchpd.equals(password)) {
return str3;
} else {
new SimCardCurrent().set(str, Integer.valueOf(simCardCurrent));
return str2;
}
}
}
new SimCardCurrent().set(str, Integer.valueOf(simCardCurrent));
return str2;
}
} |
|