mirror of https://gitee.com/stylefeng/roses
【7.1.6】更新秘钥判断逻辑
parent
bec3356659
commit
7d77513eed
|
@ -364,17 +364,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||||
// 获取当前登录用户
|
// 获取当前登录用户
|
||||||
Long userId = LoginContext.me().getLoginUser().getUserId();
|
Long userId = LoginContext.me().getLoginUser().getUserId();
|
||||||
|
|
||||||
return this.createOrUpdateCustomerSecret(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String createOrUpdateCustomerSecret(Long customerId) {
|
|
||||||
if (customerId == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查看当前用户是否有秘钥
|
// 查看当前用户是否有秘钥
|
||||||
Customer customer = this.getById(customerId);
|
Customer customer = this.getById(userId);
|
||||||
if (StrUtil.isEmpty(customer.getSecretKey())) {
|
if (StrUtil.isEmpty(customer.getSecretKey())) {
|
||||||
throw new CustomerException(CustomerExceptionEnum.NO_SECRET);
|
throw new CustomerException(CustomerExceptionEnum.NO_SECRET);
|
||||||
}
|
}
|
||||||
|
@ -384,6 +375,15 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||||
throw new CustomerException(CustomerExceptionEnum.SECRET_EXPIRED);
|
throw new CustomerException(CustomerExceptionEnum.SECRET_EXPIRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this.createOrUpdateCustomerSecret(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createOrUpdateCustomerSecret(Long customerId) {
|
||||||
|
if (customerId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 重新生成秘钥
|
// 重新生成秘钥
|
||||||
String randomString = RandomUtil.randomString(32);
|
String randomString = RandomUtil.randomString(32);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue