【7.1.6】更新一个秘钥校验

pull/23/head
fengshuonan 2021-11-27 20:03:03 +08:00
parent 1ce8a831e8
commit 95fb290e11
3 changed files with 27 additions and 1 deletions

View File

@ -81,7 +81,17 @@ public enum CustomerExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
PWD_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + CustomerConstants.CUSTOMER_EXCEPTION_STEP_CODE + "08", "更改密码失败,原密码错误!");
PWD_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + CustomerConstants.CUSTOMER_EXCEPTION_STEP_CODE + "08", "更改密码失败,原密码错误!"),
/**
*
*/
NO_SECRET(RuleConstants.BUSINESS_ERROR_TYPE_CODE + CustomerConstants.CUSTOMER_EXCEPTION_STEP_CODE + "09", "尚未开通秘钥"),
/**
*
*/
SECRET_EXPIRED(RuleConstants.BUSINESS_ERROR_TYPE_CODE + CustomerConstants.CUSTOMER_EXCEPTION_STEP_CODE + "10", "秘钥已过期");
/**
*

View File

@ -53,6 +53,11 @@ public class CustomerInfo {
*/
private Integer score;
/**
*
*/
private String secretKey;
/**
*
*/

View File

@ -373,6 +373,17 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
return null;
}
// 查看当前用户是否有秘钥
Customer customer = this.getById(customerId);
if (StrUtil.isEmpty(customer.getSecretKey())) {
throw new CustomerException(CustomerExceptionEnum.NO_SECRET);
}
// 判断秘钥是否过期
if (customer.getMemberExpireTime().before(new Date())) {
throw new CustomerException(CustomerExceptionEnum.SECRET_EXPIRED);
}
// 重新生成秘钥
String randomString = RandomUtil.randomString(32);