重构社交登录,完善单元测试

This commit is contained in:
YunaiV
2022-04-26 02:17:38 +08:00
parent 89df5b3cf6
commit 878445a238
8 changed files with 110 additions and 187 deletions

View File

@ -23,33 +23,33 @@ public enum SocialTypeEnum implements IntArrayValuable {
* Gitee
* 文档链接https://gitee.com/api/v5/oauth_doc#/
*/
GITEE(10, 1, "GITEE"),
GITEE(10, "GITEE"),
/**
* 钉钉
* 文档链接https://developers.dingtalk.com/document/app/obtain-identity-credentials
*/
DINGTALK(20, 2, "DINGTALK"),
DINGTALK(20, "DINGTALK"),
/**
* 企业微信
* 文档链接https://xkcoding.com/2019/08/06/use-justauth-integration-wechat-enterprise.html
*/
WECHAT_ENTERPRISE(30, 3, "WECHAT_ENTERPRISE"),
WECHAT_ENTERPRISE(30, "WECHAT_ENTERPRISE"),
/**
* 微信公众平台 - 移动端 H5
* 文档链接https://www.cnblogs.com/juewuzhe/p/11905461.html
*/
WECHAT_MP(31, 3, "WECHAT_MP"),
WECHAT_MP(31, "WECHAT_MP"),
/**
* 微信开放平台 - 网站应用 PC 端扫码授权登录
* 文档链接https://justauth.wiki/guide/oauth/wechat_open/#_2-申请开发者资质认证
*/
WECHAT_OPEN(32, 3, "WECHAT_OPEN"),
WECHAT_OPEN(32, "WECHAT_OPEN"),
/**
* 微信小程序
* 文档链接https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html
*/
WECHAT_MINI_PROGRAM(33, 3, "WECHAT_MINI_PROGRAM"),
WECHAT_MINI_PROGRAM(33, "WECHAT_MINI_PROGRAM"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(SocialTypeEnum::getType).toArray();
@ -58,12 +58,6 @@ public enum SocialTypeEnum implements IntArrayValuable {
* 类型
*/
private final Integer type;
/**
* 平台
*
* 例如说,微信平台下,有企业微信、公众平台、开放平台、小程序等
*/
private final Integer platform;
/**
* 类型的标识
*/
@ -78,11 +72,4 @@ public enum SocialTypeEnum implements IntArrayValuable {
return ArrayUtil.firstMatch(o -> o.getType().equals(type), values());
}
public static Set<Integer> getTypes(Collection<Integer> platforms) {
return Arrays.stream(values())
.filter(socialTypeEnum -> platforms.contains(socialTypeEnum.getPlatform()))
.map(SocialTypeEnum::getType)
.collect(Collectors.toSet());
}
}