提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.enums.social; |
H |
2 |
|
|
3 |
import cn.hutool.core.util.ArrayUtil; |
|
4 |
import com.iailab.framework.common.core.IntArrayValuable; |
|
5 |
import lombok.AllArgsConstructor; |
|
6 |
import lombok.Getter; |
|
7 |
|
|
8 |
import java.util.Arrays; |
|
9 |
|
|
10 |
/** |
|
11 |
* 社交平台的类型枚举 |
|
12 |
* |
|
13 |
* @author iailab |
|
14 |
*/ |
|
15 |
@Getter |
|
16 |
@AllArgsConstructor |
|
17 |
public enum SocialTypeEnum implements IntArrayValuable { |
|
18 |
|
|
19 |
/** |
|
20 |
* Gitee |
|
21 |
* |
|
22 |
* @see <a href="https://gitee.com/api/v5/oauth_doc#/">接入文档</a> |
|
23 |
*/ |
|
24 |
GITEE(10, "GITEE"), |
|
25 |
/** |
|
26 |
* 钉钉 |
|
27 |
* |
|
28 |
* @see <a href="https://developers.dingtalk.com/document/app/obtain-identity-credentials">接入文档</a> |
|
29 |
*/ |
|
30 |
DINGTALK(20, "DINGTALK"), |
|
31 |
|
|
32 |
/** |
|
33 |
* 企业微信 |
|
34 |
* |
|
35 |
* @see <a href="https://xkcoding.com/2019/08/06/use-justauth-integration-wechat-enterprise.html">接入文档</a> |
|
36 |
*/ |
|
37 |
WECHAT_ENTERPRISE(30, "WECHAT_ENTERPRISE"), |
|
38 |
/** |
|
39 |
* 微信公众平台 - 移动端 H5 |
|
40 |
* |
|
41 |
* @see <a href="https://www.cnblogs.com/juewuzhe/p/11905461.html">接入文档</a> |
|
42 |
*/ |
|
43 |
WECHAT_MP(31, "WECHAT_MP"), |
|
44 |
/** |
|
45 |
* 微信开放平台 - 网站应用 PC 端扫码授权登录 |
|
46 |
* |
|
47 |
* @see <a href="https://justauth.wiki/guide/oauth/wechat_open/#_2-申请开发者资质认证">接入文档</a> |
|
48 |
*/ |
|
49 |
WECHAT_OPEN(32, "WECHAT_OPEN"), |
|
50 |
/** |
|
51 |
* 微信小程序 |
|
52 |
* |
|
53 |
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html">接入文档</a> |
|
54 |
*/ |
|
55 |
WECHAT_MINI_APP(34, "WECHAT_MINI_APP"), |
|
56 |
; |
|
57 |
|
|
58 |
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(SocialTypeEnum::getType).toArray(); |
|
59 |
|
|
60 |
/** |
|
61 |
* 类型 |
|
62 |
*/ |
|
63 |
private final Integer type; |
|
64 |
/** |
|
65 |
* 类型的标识 |
|
66 |
*/ |
|
67 |
private final String source; |
|
68 |
|
|
69 |
@Override |
|
70 |
public int[] array() { |
|
71 |
return ARRAYS; |
|
72 |
} |
|
73 |
|
|
74 |
public static SocialTypeEnum valueOfType(Integer type) { |
|
75 |
return ArrayUtil.firstMatch(o -> o.getType().equals(type), values()); |
|
76 |
} |
|
77 |
|
|
78 |
} |