Upd:App用户个人设置绑定手机发送短信,手机国家编码字段处理

master
duLingLing 6 years ago
parent 028d764b5a
commit a6845d6c3c

@ -2125,7 +2125,7 @@ public class RetailAppServiceImp implements RetailAppService {
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 1 minutes."); throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 1 minutes.");
} }
String codeKeyValue = RandomStringUtils.random(6, false, true); String codeKeyValue = RandomStringUtils.random(6, false, true);
String nationCode = phone.getString("nation_code"); String nationCode = phone.getString("nation_code").contains("+")?phone.getString("nation_code").substring(1):phone.getString("nation_code");
String phoneNumber = phone.getString("contact_phone"); String phoneNumber = phone.getString("contact_phone");
ArrayList<String> param = new ArrayList<>(); ArrayList<String> param = new ArrayList<>();
param.add("绑定手机号"); param.add("绑定手机号");
@ -2188,14 +2188,14 @@ public class RetailAppServiceImp implements RetailAppService {
} }
@Override @Override
public JSONObject unbindAccountPhone(JSONObject device, JSONObject phone) { public JSONObject unbindAccountPhone(JSONObject device, JSONObject params) {
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get(); String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
if (codeKeyValueRedis == null) { if (codeKeyValueRedis == null) {
throw new BadRequestException("Captcha has expired"); throw new BadRequestException("Captcha has expired");
} }
String captcha = codeKeyValueRedis.split("&")[0]; String captcha = codeKeyValueRedis.split("&")[0];
if (!StringUtils.equals(captcha, phone.getString("captcha"))) { if (!StringUtils.equals(captcha, params.getString("captcha"))) {
throw new BadRequestException(""); throw new BadRequestException("Verification code is wrong");
} }
JSONObject account = new JSONObject(); JSONObject account = new JSONObject();
account.put("account_id", device.getString("account_id")); account.put("account_id", device.getString("account_id"));
@ -2244,12 +2244,14 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getAccountBindInfos(JSONObject device) { public JSONObject getAccountBindInfos(JSONObject device) {
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("phone_bind_status",!account.containsValue("contact_phone")); result.put("phone_bind_status",account.containsKey("contact_phone"));
if(!account.containsValue("contact_phone")){ if(account.containsKey("contact_phone")){
result.put("contact_phone",account.getString("contact_phone")); result.put("contact_phone",account.getString("contact_phone"));
result.put("naticon_code",account.getString("naticon_code")); String contact_phone = account.getString("contact_phone").replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2");
result.put("remark_contact_phone",contact_phone);
result.put("naticon_code",account.getString("nation_code"));
} }
result.put("wechat_bind_status",!account.containsValue("wechat_openid")); result.put("wechat_bind_status",account.containsKey("wechat_openid"));
return result; return result;
} }

Loading…
Cancel
Save