【7.1.6】更新秘钥判断逻辑

pull/24/MERGE
fengshuonan 2021-12-15 20:25:36 +08:00
parent bec3356659
commit 7d77513eed
1 changed files with 10 additions and 10 deletions

View File

@ -364,17 +364,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
// 获取当前登录用户
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())) {
throw new CustomerException(CustomerExceptionEnum.NO_SECRET);
}
@ -384,6 +375,15 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
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);