member:优化部分变量的命名

This commit is contained in:
YunaiV
2023-10-22 16:35:48 +08:00
parent 94c2ad5d1d
commit 728308cbc0
25 changed files with 80 additions and 87 deletions

View File

@ -14,12 +14,12 @@ public interface SocialClientApi {
/**
* 获得社交平台的授权 URL
*
* @param type 社交平台的类型 {@link SocialTypeEnum}
* @param socialType 社交平台的类型 {@link SocialTypeEnum}
* @param userType 用户类型
* @param redirectUri 重定向 URL
* @return 社交平台的授权 URL
*/
String getAuthorizeUrl(Integer type, Integer userType, String redirectUri);
String getAuthorizeUrl(Integer socialType, Integer userType, String redirectUri);
/**
* 创建微信公众号 JS SDK 初始化所需的签名

View File

@ -35,12 +35,12 @@ public interface SocialUserApi {
* 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
*
* @param userType 用户类型
* @param type 社交平台的类型
* @param socialType 社交平台的类型
* @param code 授权码
* @param state state
* @return 社交用户
*/
SocialUserRespDTO getSocialUser(Integer userType, Integer type,
SocialUserRespDTO getSocialUser(Integer userType, Integer socialType,
String code, String state);
}

View File

@ -24,8 +24,8 @@ public class SocialClientApiImpl implements SocialClientApi {
private SocialClientService socialClientService;
@Override
public String getAuthorizeUrl(Integer type, Integer userType, String redirectUri) {
return socialClientService.getAuthorizeUrl(type, userType, redirectUri);
public String getAuthorizeUrl(Integer socialType, Integer userType, String redirectUri) {
return socialClientService.getAuthorizeUrl(socialType, userType, redirectUri);
}
@Override

View File

@ -33,8 +33,8 @@ public class SocialUserApiImpl implements SocialUserApi {
}
@Override
public SocialUserRespDTO getSocialUser(Integer userType, Integer type, String code, String state) {
return socialUserService.getSocialUser(userType, type, code, state);
public SocialUserRespDTO getSocialUser(Integer userType, Integer socialType, String code, String state) {
return socialUserService.getSocialUser(userType, socialType, code, state);
}
}

View File

@ -148,7 +148,8 @@ public class AuthController {
})
public CommonResult<String> socialLogin(@RequestParam("type") Integer type,
@RequestParam("redirectUri") String redirectUri) {
return success(socialClientService.getAuthorizeUrl(type, UserTypeEnum.ADMIN.getValue(), redirectUri));
return success(socialClientService.getAuthorizeUrl(
type, UserTypeEnum.ADMIN.getValue(), redirectUri));
}
@PostMapping("/social-login")

View File

@ -16,7 +16,6 @@ import java.util.List;
*/
public interface SocialUserService {
// TODO @芋艿:需要传递 userType
/**
* 获得指定用户的社交用户列表
*
@ -39,10 +38,10 @@ public interface SocialUserService {
*
* @param userId 用户编号
* @param userType 全局用户类型
* @param type 社交平台的类型 {@link SocialTypeEnum}
* @param socialType 社交平台的类型 {@link SocialTypeEnum}
* @param openid 社交平台的 openid
*/
void unbindSocialUser(Long userId, Integer userType, Integer type, String openid);
void unbindSocialUser(Long userId, Integer userType, Integer socialType, String openid);
/**
* 获得社交用户
@ -50,11 +49,11 @@ public interface SocialUserService {
* 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
*
* @param userType 用户类型
* @param type 社交平台的类型
* @param socialType 社交平台的类型
* @param code 授权码
* @param state state
* @return 社交用户
*/
SocialUserRespDTO getSocialUser(Integer userType, Integer type, String code, String state);
SocialUserRespDTO getSocialUser(Integer userType, Integer socialType, String code, String state);
}

View File

@ -80,9 +80,9 @@ public class SocialUserServiceImpl implements SocialUserService {
}
@Override
public void unbindSocialUser(Long userId, Integer userType, Integer type, String openid) {
public void unbindSocialUser(Long userId, Integer userType, Integer socialType, String openid) {
// 获得 openid 对应的 SocialUserDO 社交用户
SocialUserDO socialUser = socialUserMapper.selectByTypeAndOpenid(type, openid);
SocialUserDO socialUser = socialUserMapper.selectByTypeAndOpenid(socialType, openid);
if (socialUser == null) {
throw exception(SOCIAL_USER_NOT_FOUND);
}
@ -92,9 +92,9 @@ public class SocialUserServiceImpl implements SocialUserService {
}
@Override
public SocialUserRespDTO getSocialUser(Integer userType, Integer type, String code, String state) {
public SocialUserRespDTO getSocialUser(Integer userType, Integer socialType, String code, String state) {
// 获得社交用户
SocialUserDO socialUser = authSocialUser(type, userType, code, state);
SocialUserDO socialUser = authSocialUser(socialType, userType, code, state);
Assert.notNull(socialUser, "社交用户不能为空");
// 如果未绑定的社交用户,则无法自动登录,进行报错