提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.enums.sms; |
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 SmsSceneEnum implements IntArrayValuable { |
|
18 |
|
|
19 |
MEMBER_LOGIN(1, "user-sms-login", "会员用户 - 手机号登陆"), |
|
20 |
MEMBER_UPDATE_MOBILE(2, "user-update-mobile", "会员用户 - 修改手机"), |
|
21 |
MEMBER_UPDATE_PASSWORD(3, "user-update-password", "会员用户 - 修改密码"), |
|
22 |
MEMBER_RESET_PASSWORD(4, "user-reset-password", "会员用户 - 忘记密码"), |
|
23 |
|
|
24 |
ADMIN_MEMBER_LOGIN(21, "admin-sms-login", "后台用户 - 手机号登录"); |
|
25 |
|
|
26 |
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(SmsSceneEnum::getScene).toArray(); |
|
27 |
|
|
28 |
/** |
|
29 |
* 验证场景的编号 |
|
30 |
*/ |
|
31 |
private final Integer scene; |
|
32 |
/** |
|
33 |
* 模版编码 |
|
34 |
*/ |
|
35 |
private final String templateCode; |
|
36 |
/** |
|
37 |
* 描述 |
|
38 |
*/ |
|
39 |
private final String description; |
|
40 |
|
|
41 |
@Override |
|
42 |
public int[] array() { |
|
43 |
return ARRAYS; |
|
44 |
} |
|
45 |
|
|
46 |
public static SmsSceneEnum getCodeByScene(Integer scene) { |
|
47 |
return ArrayUtil.firstMatch(sceneEnum -> sceneEnum.getScene().equals(scene), |
|
48 |
values()); |
|
49 |
} |
|
50 |
|
|
51 |
} |