goupan
2024-04-03 5506e9a45e717ffcb67ec313b5a4e8206d9b3a39
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package cn.stylefeng.roses.kernel.customer.api.expander;
 
 
import cn.stylefeng.roses.kernel.config.api.context.ConfigContext;
 
/**
 * C端用户的配置
 *
 * @author fengshuonan
 * @date 2021/6/7 15:38
 */
public class CustomerConfigExpander {
 
    /**
     * 获取注册邮件的标题
     *
     * @author fengshuonan
     * @date 2021/6/7 15:42
     */
    public static String getRegMailTitle() {
        return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_REG_EMAIL_TITLE", String.class, "Guns官方论坛-激活");
    }
 
    /**
     * 获取注册邮件的内容模板
     *
     * @author fengshuonan
     * @date 2021/6/7 15:42
     */
    public static String getRegMailContent() {
        return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_REG_EMAIL_CONTENT", String.class, "感谢您注册Guns官方论坛,请点击此激活链接激活您的账户:<a href=\"http://localhost:8080/customer/active?verifyCode={}\">http://localhost:8080/customer/active?verifyCode={} </a>");
    }
 
    /**
     * 获取重置密码的邮件标题
     *
     * @author fengshuonan
     * @date 2021/6/7 15:42
     */
    public static String getResetPwdMailTitle() {
        return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_RESET_PWD_EMAIL_TITLE", String.class, "Guns官网验证");
    }
 
    /**
     * 获取重置密码的邮件内容
     *
     * @author fengshuonan
     * @date 2021/6/7 15:42
     */
    public static String getResetPwdMailContent() {
        return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_RESET_PWD_EMAIL_CONTENT", String.class, "您的验证码是【{}】,此验证码用于修改登录密码,请不要泄露给他人,如果不是您本人操作,请忽略此邮件。");
    }
 
    /**
     * 存放用户头像的bucket的名称
     *
     * @author fengshuonan
     * @date 2021/6/7 15:42
     */
    public static String getCustomerBucket() {
        return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_FILE_BUCKET", String.class, "customer-bucket");
    }
 
    /**
     * 存放用户头像的bucket的名称的过期时间
     *
     * @author fengshuonan
     * @date 2021/6/7 15:42
     */
    public static Long getCustomerBucketExpiredSeconds() {
        return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_FILE_BUCKET_EXPIRED_SECONDS", Long.class, 600L);
    }
 
    /**
     * 获取用户缓存的过期时间
     *
     * @author fengshuonan
     * @date 2021/6/7 15:42
     */
    public static Long getCustomerCacheExpiredSeconds() {
        return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_CACHE_EXPIRED_SECONDS", Long.class, 3600L);
    }
 
    /**
     * 是否开启旧版密码校验
     *
     * @author fengshuonan
     * @date 2021/7/6 22:00
     */
    public static Boolean getOldPasswordValidate() {
        return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_OPEN_OLD_PASSWORD_VALIDATE", Boolean.class, Boolean.FALSE);
    }
 
    /**
     * 获取是否开启了发送邮件的开关
     * <p>
     * 如果开启了,则发送用户注册、找回密码等业务的邮件,未开启则不发送
     *
     * @author fengshuonan
     * @date 2022/6/28 15:38
     */
    public static boolean getSendEmailFlag() {
        return ConfigContext.me().getSysConfigValueWithDefault("SYS_CUSTOMER_SEND_EMAIL", Boolean.class, false);
    }
 
}