免登录功能
This commit is contained in:
parent
59e6c4871f
commit
1b4196ceef
@ -123,4 +123,10 @@ public class AppAuthController {
|
|||||||
return success(AuthConvert.INSTANCE.convert(signature));
|
return success(AuthConvert.INSTANCE.convert(signature));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/checkLogin")
|
||||||
|
@PermitAll
|
||||||
|
public CommonResult<Integer> checkLogin(@RequestBody @Valid AppAuthSocialLoginReqVO reqVO) {
|
||||||
|
return success(authService.checkLogin(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,4 +85,6 @@ public interface MemberAuthService {
|
|||||||
*/
|
*/
|
||||||
AppAuthLoginRespVO refreshToken(String refreshToken);
|
AppAuthLoginRespVO refreshToken(String refreshToken);
|
||||||
|
|
||||||
|
Integer checkLogin(AppAuthSocialLoginReqVO reqVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -258,6 +258,25 @@ public class MemberAuthServiceImpl implements MemberAuthService {
|
|||||||
return AuthConvert.INSTANCE.convert(accessTokenDO, null);
|
return AuthConvert.INSTANCE.convert(accessTokenDO, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer checkLogin(AppAuthSocialLoginReqVO reqVO) {
|
||||||
|
// 使用 code 授权码,进行登录。然后,获得到绑定的用户编号
|
||||||
|
SocialUserRespDTO socialUser = socialUserApi.getSocialUserByCode(UserTypeEnum.MEMBER.getValue(), reqVO.getType(),
|
||||||
|
reqVO.getCode(), reqVO.getState());
|
||||||
|
System.out.println(socialUser);
|
||||||
|
if (socialUser == null) {
|
||||||
|
System.out.println("111");
|
||||||
|
throw exception(AUTH_SOCIAL_USER_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断openid是否存在
|
||||||
|
// SocialUserRespDTO respDTO = socialUserApi.getSocialUserByOpenId(socialUser.getOpenid());
|
||||||
|
if (socialUser.getUserId() == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
private void createLogoutLog(Long userId) {
|
private void createLogoutLog(Long userId) {
|
||||||
LoginLogCreateReqDTO reqDTO = new LoginLogCreateReqDTO();
|
LoginLogCreateReqDTO reqDTO = new LoginLogCreateReqDTO();
|
||||||
reqDTO.setLogType(LoginLogTypeEnum.LOGOUT_SELF.getType());
|
reqDTO.setLogType(LoginLogTypeEnum.LOGOUT_SELF.getType());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user