Michael Yang
2025-05-07 5afa5041ea166f462a90a996d5264c64837f4341
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
package tech.aiflowy.common.sms;
 
import tech.aiflowy.common.util.SpringContextUtil;
 
public class SmsSenderManager {
 
 
    public static boolean sendSmsCode(String mobile) {
        SmsConfig smsConfig = SmsConfig.getInstance();
        SmsSender smsSender = SpringContextUtil.getBean(smsConfig.getSender(), SmsSender.class);
        String smsCode = SmsUtil.generateSmsCode();
        if (smsSender.sendCode(mobile, smsCode)) {
            SmsCodeCache.put(mobile, smsCode);
            return true;
        } else {
            return false;
        }
    }
 
 
    public static boolean isMobileInLimitation(String mobile) {
        return SmsCodeCache.get(mobile) != null;
    }
 
}