|
@@ -62,7 +62,7 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String bindSocialUser(SocialUserBindReqDTO reqDTO) {
|
|
|
// 获得社交用户
|
|
|
- SocialUserDO socialUser = authSocialUser(reqDTO.getSocialType(), reqDTO.getUserType(),
|
|
|
+ SocialUserDO socialUser = authSocialUser(reqDTO.getApplication(),reqDTO.getSocialType(), reqDTO.getUserType(),
|
|
|
reqDTO.getCode(), reqDTO.getState());
|
|
|
Assert.notNull(socialUser, "社交用户不能为空");
|
|
|
|
|
@@ -110,7 +110,7 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
|
@Override
|
|
|
public SocialUserRespDTO getSocialUserByCode(Integer userType, Integer socialType, String code, String state) {
|
|
|
// 获得社交用户
|
|
|
- SocialUserDO socialUser = authSocialUser(socialType, userType, code, state);
|
|
|
+ SocialUserDO socialUser = authSocialUser(null,socialType, userType, code, state);
|
|
|
Assert.notNull(socialUser, "社交用户不能为空");
|
|
|
|
|
|
// 获得绑定用户
|
|
@@ -124,7 +124,7 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
|
public SocialUserRespDTO getSocialUserByApplicationCode(String application, String code, String state) {
|
|
|
SocialClientDO socialClient = socialClientService.getSocialClientByApplication(application);
|
|
|
// 获得社交用户
|
|
|
- SocialUserDO socialUser = authSocialUser(socialClient.getSocialType(), socialClient.getUserType(), code, state);
|
|
|
+ SocialUserDO socialUser = authSocialUser(application,socialClient.getSocialType(), socialClient.getUserType(), code, state);
|
|
|
Assert.notNull(socialUser, "社交用户不能为空");
|
|
|
// 获得绑定用户
|
|
|
SocialUserBindDO socialUserBind = socialUserBindMapper.selectByUserTypeAndSocialUserId(socialClient.getUserType(),
|
|
@@ -161,7 +161,7 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
|
* @return 授权用户
|
|
|
*/
|
|
|
@NotNull
|
|
|
- public SocialUserDO authSocialUser(Integer socialType, Integer userType, String code, String state) {
|
|
|
+ public SocialUserDO authSocialUser(String application,Integer socialType, Integer userType, String code, String state) {
|
|
|
// 优先从 DB 中获取,因为 code 有且可以使用一次。
|
|
|
// 在社交登录时,当未绑定 User 时,需要绑定登录,此时需要 code 使用两次
|
|
|
SocialUserDO socialUser = socialUserMapper.selectByTypeAndCodeAnState(socialType, code, state);
|
|
@@ -170,7 +170,7 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
|
}
|
|
|
|
|
|
// 请求获取
|
|
|
- AuthUser authUser = socialClientService.getAuthUser(null, socialType, userType, code, state);
|
|
|
+ AuthUser authUser = socialClientService.getAuthUser(application, socialType, userType, code, state);
|
|
|
Assert.notNull(authUser, "三方用户不能为空");
|
|
|
|
|
|
// 保存到 DB 中
|