mirror of https://gitee.com/stylefeng/roses
【7.0.4】【c】增加通过secretKey获取用户信息的方法
parent
4c5626298f
commit
0f8c640b67
|
@ -44,6 +44,14 @@ public interface CustomerApi {
|
|||
*/
|
||||
CustomerInfo getCustomerInfoById(Long customerId);
|
||||
|
||||
/**
|
||||
* 获取用户信息,通过用户的secretKey字段
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/7/20 10:51
|
||||
*/
|
||||
CustomerInfo getCustomerInfoBySecretKey(String secretKey);
|
||||
|
||||
/**
|
||||
* 更新用户会员时间
|
||||
*
|
||||
|
|
|
@ -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<>();
|
||||
|
|
Loading…
Reference in New Issue