登录:社交登录时,额外返回 openid

This commit is contained in:
YunaiV
2023-09-10 18:01:53 +08:00
parent 4265441e1d
commit 40e1a879e3
13 changed files with 111 additions and 46 deletions

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.api.social;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserUnbindReqDTO;
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
@ -27,8 +28,9 @@ public interface SocialUserApi {
* 绑定社交用户
*
* @param reqDTO 绑定信息
* @return 社交用户 openid
*/
void bindSocialUser(@Valid SocialUserBindReqDTO reqDTO);
String bindSocialUser(@Valid SocialUserBindReqDTO reqDTO);
/**
* 取消绑定社交用户
@ -38,16 +40,17 @@ public interface SocialUserApi {
void unbindSocialUser(@Valid SocialUserUnbindReqDTO reqDTO);
/**
* 获得社交用户的绑定用户编号
* 注意,返回的是 MemberUser 或者 AdminUser 的 id 编号!
* 获得社交用户
*
* 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
*
* @param userType 用户类型
* @param type 社交平台的类型
* @param code 授权码
* @param state state
* @return 绑定用户编号
* @return 社交用户
*/
Long getBindUserId(Integer userType, Integer type, String code, String state);
SocialUserRespDTO getSocialUser(Integer userType, Integer type,
String code, String state);
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.system.api.social.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 社交用户 Response DTO
*
* @author 芋道源码
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SocialUserRespDTO {
/**
* 社交用户 openid
*/
private String openid;
/**
* 关联的用户编号
*/
private Long userId;
}