实名认证接口修改

This commit is contained in:
张松
2025-01-06 11:28:56 +08:00
parent f2114650db
commit 6639e37fd4
2 changed files with 31 additions and 26 deletions

View File

@@ -113,15 +113,15 @@ public class AppController {
if (count > 0) { if (count > 0) {
errMsg = "支付宝信息修改失败: 一个支付宝账号仅可绑定一个用户"; errMsg = "支付宝信息修改失败: 一个支付宝账号仅可绑定一个用户";
} }
if (StrUtil.isNotBlank(userInfo.getCertName()) && !certName.equals(userInfo.getCertName())) { if (errMsg == null && StrUtil.isNotBlank(userInfo.getCertName()) && !certName.equals(userInfo.getCertName())) {
errMsg = "支付宝信息修改失败: 姓名与实名认证信息不相符"; errMsg = "支付宝信息修改失败: 姓名与实名认证信息不相符";
} }
if (!DataLimitUtil.isAccessAllowed(zhiFuBao+certName, Integer.parseInt(commonRepository.findOne(924).getValue()), "month")) { if (errMsg == null && !DataLimitUtil.isAccessAllowed(zhiFuBao+certName, Integer.parseInt(commonRepository.findOne(924).getValue()), "month")) {
errMsg = "支付宝信息修改失败: 相同支付宝账号每月可绑定次数已用完"; errMsg = "支付宝信息修改失败: 相同支付宝账号每月可绑定次数已用完";
} }
if (!ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", Integer.parseInt(commonRepository.findOne(925).getValue()), "month")) { if (errMsg == null && !ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", Integer.parseInt(commonRepository.findOne(925).getValue()), "month")) {
errMsg = "支付宝信息修改失败: 每月可修改次数已用完,请联系管理员"; errMsg = "支付宝信息修改失败: 每月可修改次数已用完,请联系管理员";
} }
@@ -133,42 +133,47 @@ public class AppController {
} }
String authErrMsg = null;
if (StrUtil.isNotBlank(certNum) && !certNum.equals(userInfo.getCertNo())) { if (StrUtil.isNotBlank(certNum) && !certNum.equals(userInfo.getCertNo())) {
if (StrUtil.isNotBlank(userEntity.getZhiFuBaoName()) && !certName.equals(userEntity.getZhiFuBaoName())) { if (StrUtil.isNotBlank(userEntity.getZhiFuBaoName()) && !certName.equals(userEntity.getZhiFuBaoName())) {
errMsg = "实名修改失败: 姓名与绑定支付宝信息不相符"; authErrMsg = "实名修改失败: 姓名与绑定支付宝信息不相符";
} }
if (!IdcardUtil.isValidCard(certNum)) { if (authErrMsg == null && !IdcardUtil.isValidCard(certNum)) {
errMsg = "实名修改失败: 身份证号码有误"; authErrMsg = "实名修改失败: 身份证号码有误";
} }
Integer idCount = userInfoService.countCertCount(certName, certNum); if (authErrMsg == null) {
if (idCount > 1) { Integer idCount = userInfoService.countCertCount(certName, certNum);
errMsg = "实名修改失败: 此实名信息已存在"; if (idCount > 1) {
authErrMsg = "实名修改失败: 此实名信息已存在";
}
} }
if (!ApiAccessLimitUtil.isAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month")) { if (authErrMsg == null && !ApiAccessLimitUtil.isAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month")) {
errMsg = "实名修改失败: 每月可修改次数已用完,请联系管理员"; authErrMsg = "实名修改失败: 账号每月可修改次数已用完,请联系管理员";
} }
try { if (authErrMsg == null && !ApiAccessLimitUtil.isAccessAllowed(certName, "updateAuthCertInfoByIdCard", 1, "month")) {
aliService.authCertNo(certName, certNum); authErrMsg = "实名修改失败: 此身份证信息次月已绑定过,请联系管理员";
}catch (Exception e) {
ApiAccessLimitUtil.removeKey(String.valueOf(userId), "updateAuthCertInfo");
errMsg = "实名修改失败: 身份证信息不匹配";
} }
if (errMsg != null && errMsg.contains("实名修改失败")) { if (authErrMsg == null) {
return Result.error(errMsg); try {
aliService.authCertNo(certName, certNum);
userInfo.setCertName(certName);
userInfo.setCertNo(certNum);
userInfo.setUpdateTime(DateUtil.date());
userInfoService.update(userInfo, new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, userId));
}catch (Exception e) {
ApiAccessLimitUtil.removeKey(String.valueOf(userId), "updateAuthCertInfo");
ApiAccessLimitUtil.removeKey(certName, "updateAuthCertInfoByIdCard");
authErrMsg = "实名修改失败: 身份证信息不匹配";
}
} }
userInfo.setCertName(certName);
userInfo.setCertNo(certNum);
userInfo.setUpdateTime(DateUtil.date());
userInfoService.update(userInfo, new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, userId));
} }
if (errMsg != null) { if (errMsg != null || authErrMsg != null) {
return Result.error(errMsg); return Result.error(errMsg + " " + authErrMsg);
} }
return Result.success(); return Result.success();
// 去除首绑支付宝奖励 // 去除首绑支付宝奖励

View File

@@ -146,7 +146,7 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
} else { } else {
course.setViewCounts(course.getViewCounts() + 1); course.setViewCounts(course.getViewCounts() + 1);
} }
if (ApiAccessLimitUtil.isAccessAllowed("setCourseView:" + course.getCourseId(), "updateAuthCertInfo", 1, 600)) { if (ApiAccessLimitUtil.isAccessAllowed(course.getCourseId().toString(), "updateWeekCourseView", 1, 600)) {
int courseViewCount = redisServiceImpl.getCourseWeekViewCount(course.getCourseId()); int courseViewCount = redisServiceImpl.getCourseWeekViewCount(course.getCourseId());
course.setWeekView(courseViewCount); course.setWeekView(courseViewCount);
} }