【7.0.4】【c】增加通过secretKey获取用户信息的方法

pull/22/head
fengshuonan 2021-07-20 11:00:13 +08:00
parent 4c5626298f
commit 0f8c640b67
2 changed files with 31 additions and 0 deletions

View File

@ -44,6 +44,14 @@ public interface CustomerApi {
*/
CustomerInfo getCustomerInfoById(Long customerId);
/**
* secretKey
*
* @author fengshuonan
* @date 2021/7/20 10:51
*/
CustomerInfo getCustomerInfoBySecretKey(String secretKey);
/**
*
*

View File

@ -373,6 +373,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
wrapper.eq(Customer::getCustomerId, userId);
this.update(wrapper);
// 清除缓存中的用户信息
customerInfoCacheOperatorApi.remove(String.valueOf(userId));
return uuid;
}
@ -418,6 +421,26 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
return result;
}
@Override
public CustomerInfo getCustomerInfoBySecretKey(String secretKey) {
if (StrUtil.isEmpty(secretKey)) {
return null;
}
// 先通过secretKey获取用户id
LambdaQueryWrapper<Customer> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Customer::getSecretKey, secretKey);
wrapper.select(Customer::getCustomerId);
Customer customer = this.getOne(wrapper, false);
if (customer == null) {
return null;
}
// 再通过用户id获取用户的信息
return this.getCustomerInfoById(customer.getCustomerId());
}
@Override
public void updateMemberExpiryDate(Long customerId, Date expiryDate) {
LambdaUpdateWrapper<Customer> wrapper = new LambdaUpdateWrapper<>();