mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-11 05:19:00 +08:00
🔥 Removing code or files. 删除社交登录 缓存查询逻辑 避免无用 cache
This commit is contained in:
1 parent
ba93f6c291
commit
38018c3c70
1 file changed
+1
-16
+1
-16
@@ -18,14 +18,11 @@ package com.pig4cloud.pigx.common.security.service;
|
||||
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserInfo;
|
||||
import com.pig4cloud.pigx.admin.api.feign.RemoteUserService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
|
||||
@@ -42,8 +39,6 @@ public class PigxAppUserDetailsServiceImpl implements PigxUserDetailsService {
|
||||
|
||||
private final RemoteUserService remoteUserService;
|
||||
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
/**
|
||||
* 手机号登录
|
||||
* @param phone 手机号
|
||||
@@ -52,18 +47,8 @@ public class PigxAppUserDetailsServiceImpl implements PigxUserDetailsService {
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public UserDetails loadUserByUsername(String phone) {
|
||||
Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS);
|
||||
if (cache != null && cache.get(phone) != null) {
|
||||
return (PigxUser) cache.get(phone).get();
|
||||
}
|
||||
|
||||
R<UserInfo> result = remoteUserService.social(phone, SecurityConstants.FROM_IN);
|
||||
|
||||
UserDetails userDetails = getUserDetails(result);
|
||||
if (cache != null) {
|
||||
cache.put(phone, userDetails);
|
||||
}
|
||||
return userDetails;
|
||||
return getUserDetails(result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user