feat: 解耦认证逻辑
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.webgame.webgamebackend.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.webgame.webgamebackend.common.auth.AuthenticationProvider;
|
||||
import com.webgame.webgamebackend.common.dto.user.UpdateStatusRequest;
|
||||
import com.webgame.webgamebackend.common.dto.user.UpdateUserInfoRequest;
|
||||
import com.webgame.webgamebackend.common.dto.user.UserInfoResponse;
|
||||
@@ -48,10 +48,11 @@ public class UserServiceImpl implements UserService {
|
||||
private static final long MAX_AVATAR_SIZE = 2 * 1024 * 1024;
|
||||
|
||||
private final UserRepository userRepository;
|
||||
private final AuthenticationProvider authProvider;
|
||||
|
||||
@Override
|
||||
public UserInfoResponse getCurrentUserInfo() {
|
||||
String accountId = StpUtil.getLoginIdAsString();
|
||||
String accountId = authProvider.getCurrentUserId();
|
||||
log.info("[用户服务] 获取当前登录用户信息, accountId: {}", accountId);
|
||||
UserEntity user = userRepository.findByAccountId(accountId)
|
||||
.orElseThrow(() -> new BusinessException(ErrorCode.USER_NOT_FOUND));
|
||||
|
||||
Reference in New Issue
Block a user