1.实名接口修改
This commit is contained in:
parent
a9d195ed96
commit
758c1aabbb
|
|
@ -101,67 +101,65 @@ public class AppController {
|
||||||
UserInfo userInfo = userInfoService.getByUserId(userId);
|
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||||
UserEntity userEntity = userService.getById(userId);
|
UserEntity userEntity = userService.getById(userId);
|
||||||
|
|
||||||
int count = userService.count(new QueryWrapper<UserEntity>()
|
String errMsg = null;
|
||||||
.ne("user_id", userId)
|
|
||||||
.eq("zhi_fu_bao_name", certName)
|
|
||||||
.eq("zhi_fu_bao", zhiFuBao));
|
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(zhiFuBao) && count > 0) {
|
|
||||||
return Result.error("一个支付宝账号仅可绑定一个用户");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(zhiFuBao)) {
|
if (StrUtil.isNotBlank(zhiFuBao)) {
|
||||||
|
int count = userService.count(new QueryWrapper<UserEntity>()
|
||||||
|
.ne("user_id", userId)
|
||||||
|
.eq("zhi_fu_bao_name", certName)
|
||||||
|
.eq("zhi_fu_bao", zhiFuBao));
|
||||||
|
if (count > 0) {
|
||||||
|
errMsg = "支付宝信息修改失败: 一个支付宝账号仅可绑定一个用户";
|
||||||
|
}
|
||||||
if (StrUtil.isNotBlank(userInfo.getCertName()) && !certName.equals(userInfo.getCertName())) {
|
if (StrUtil.isNotBlank(userInfo.getCertName()) && !certName.equals(userInfo.getCertName())) {
|
||||||
return Result.error("姓名与实名认证信息不相符");
|
errMsg = "支付宝信息修改失败: 姓名与实名认证信息不相符";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DataLimitUtil.isAccessAllowed(zhiFuBao+certName, Integer.parseInt(commonRepository.findOne(924).getValue()), "month")) {
|
if (!DataLimitUtil.isAccessAllowed(zhiFuBao+certName, Integer.parseInt(commonRepository.findOne(924).getValue()), "month")) {
|
||||||
return Result.error("修改失败,相同支付宝账号每月可绑定次数已用完");
|
errMsg = "支付宝信息修改失败: 相同支付宝账号每月可绑定次数已用完";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", Integer.parseInt(commonRepository.findOne(925).getValue()), "month")) {
|
if (!ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", Integer.parseInt(commonRepository.findOne(925).getValue()), "month")) {
|
||||||
return Result.error("每月可修改次数已用完,请联系管理员");
|
errMsg = "支付宝信息修改失败: 每月可修改次数已用完,请联系管理员";
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(certNum)) {
|
|
||||||
if (StrUtil.isNotBlank(userEntity.getZhiFuBaoName()) && !certName.equals(userEntity.getZhiFuBaoName())) {
|
|
||||||
return Result.error("姓名与绑定支付宝信息不相符");
|
|
||||||
}
|
|
||||||
if (!IdcardUtil.isValidCard(certNum)) {
|
|
||||||
throw new SqxException("身份证号码有误");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer idCount = userInfoService.countCertCount(certName, certNum);
|
|
||||||
if (idCount > 1) {
|
|
||||||
throw new SqxException("此实名信息已存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ApiAccessLimitUtil.isAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month")) {
|
|
||||||
return Result.error("每月可修改次数已用完,请联系管理员");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(zhiFuBao)) {
|
|
||||||
userEntity.setZhiFuBao(zhiFuBao);
|
userEntity.setZhiFuBao(zhiFuBao);
|
||||||
userEntity.setZhiFuBaoName(certName);
|
userEntity.setZhiFuBaoName(certName);
|
||||||
userService.updateById(userEntity);
|
userService.updateById(userEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(certNum)) {
|
if (StrUtil.isNotBlank(certNum)) {
|
||||||
|
if (StrUtil.isNotBlank(userEntity.getZhiFuBaoName()) && !certName.equals(userEntity.getZhiFuBaoName())) {
|
||||||
|
errMsg = "实名修改失败: 姓名与绑定支付宝信息不相符";
|
||||||
|
}
|
||||||
|
if (!IdcardUtil.isValidCard(certNum)) {
|
||||||
|
errMsg = "实名修改失败: 身份证号码有误";
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer idCount = userInfoService.countCertCount(certName, certNum);
|
||||||
|
if (idCount > 1) {
|
||||||
|
errMsg = "实名修改失败: 此实名信息已存在";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ApiAccessLimitUtil.isAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month")) {
|
||||||
|
errMsg = "实名修改失败: 每月可修改次数已用完,请联系管理员";
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
aliService.authCertNo(certName, certNum);
|
aliService.authCertNo(certName, certNum);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
ApiAccessLimitUtil.removeKey(String.valueOf(userId), "updateAuthCertInfo");
|
ApiAccessLimitUtil.removeKey(String.valueOf(userId), "updateAuthCertInfo");
|
||||||
return Result.error(e.getMessage());
|
errMsg = "实名修改失败: " + e.getMessage();
|
||||||
}
|
}
|
||||||
userInfo.setCertName(certName);
|
userInfo.setCertName(certName);
|
||||||
userInfo.setCertNo(certNum);
|
userInfo.setCertNo(certNum);
|
||||||
userInfo.setUpdateTime(DateUtil.date());
|
userInfo.setUpdateTime(DateUtil.date());
|
||||||
userInfoService.updateById(userInfo);
|
userInfoService.updateById(userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errMsg != null) {
|
||||||
|
return Result.error(errMsg);
|
||||||
|
}
|
||||||
return Result.success();
|
return Result.success();
|
||||||
// 去除首绑支付宝奖励
|
// 去除首绑支付宝奖励
|
||||||
// if (bool && isFirstBind) {
|
// if (bool && isFirstBind) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue