mirror of https://gitee.com/stylefeng/roses
【7.1.6】更新一个秘钥校验
parent
1ce8a831e8
commit
95fb290e11
|
@ -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", "秘钥已过期");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误编码
|
* 错误编码
|
||||||
|
|
|
@ -53,6 +53,11 @@ public class CustomerInfo {
|
||||||
*/
|
*/
|
||||||
private Integer score;
|
private Integer score;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户秘钥
|
||||||
|
*/
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是会员
|
* 是否是会员
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -373,6 +373,17 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||||
return null;
|
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);
|
String randomString = RandomUtil.randomString(32);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue