mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-14 02:55:07 +08:00
✨ Member:社交登录逻辑调整,如果登录时无用户,则自动创建用户,保持和各 App 统一逻辑
This commit is contained in:
@ -158,7 +158,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
// 使用 code 授权码,进行登录。然后,获得到绑定的用户编号
|
||||
SocialUserRespDTO socialUser = socialUserService.getSocialUser(UserTypeEnum.ADMIN.getValue(), reqVO.getType(),
|
||||
reqVO.getCode(), reqVO.getState());
|
||||
if (socialUser == null) {
|
||||
if (socialUser == null || socialUser.getUserId() == null) {
|
||||
throw exception(AUTH_THIRD_LOGIN_NOT_BIND);
|
||||
}
|
||||
|
||||
|
@ -99,13 +99,11 @@ public class SocialUserServiceImpl implements SocialUserService {
|
||||
SocialUserDO socialUser = authSocialUser(socialType, userType, code, state);
|
||||
Assert.notNull(socialUser, "社交用户不能为空");
|
||||
|
||||
// 如果未绑定的社交用户,则无法自动登录,进行报错
|
||||
// 获得绑定用户
|
||||
SocialUserBindDO socialUserBind = socialUserBindMapper.selectByUserTypeAndSocialUserId(userType,
|
||||
socialUser.getId());
|
||||
if (socialUserBind == null) {
|
||||
throw exception(AUTH_THIRD_LOGIN_NOT_BIND);
|
||||
}
|
||||
return new SocialUserRespDTO(socialUser.getOpenid(), socialUserBind.getUserId());
|
||||
return new SocialUserRespDTO(socialUser.getOpenid(), socialUser.getNickname(), socialUser.getAvatar(),
|
||||
socialUserBind != null ? socialUserBind.getUserId() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user