peter
2026-01-11 9c638d29f43035bb224996f3183a58d761cd526e
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
package com.nq.utils.smsUtil;
 
 
import com.nq.common.ServerResponse;
 
public interface SMSProvider {
    /**
     * 发送单条短信
     *
     * @param mobile  手机号
     * @param content 短信内容
     * @return
     * @throws Exception
     */
    ServerResponse sendSingleMessage(String mobile, String content) throws Exception;
 
    /**
     * 发送单条短信
     *
     * @param mobile  手机号
     * @param content 短信内容
     * @return
     * @throws Exception
     */
    ServerResponse sendMessageByTempId(String mobile, String content,String templateId) throws Exception;
 
    /**
     * 发送自定义短信
     * @param mobile
     * @param content
     * @return
     * @throws Exception
     */
    ServerResponse sendCustomMessage(String mobile, String content) throws Exception;
 
    /**
     * 发送验证码短信
     *
     * @param mobile     手机号
     * @param verifyCode 验证码
     * @return
     * @throws Exception
     */
    default ServerResponse sendVerifyMessage(String mobile, String verifyCode) throws Exception {
        return sendSingleMessage(mobile, formatVerifyCode(verifyCode));
    }
 
    /**
     * 获取验证码信息格式
     *
     * @param code
     * @return
     */
    default String formatVerifyCode(String code) {
        return String.format("%s", code);
    }
 
    /**
     * 发送国际短信
     *
     * @param content
     * @param phone
     * @return
     */
    ServerResponse sendInternationalMessage(String content,  String phone) throws Exception;
}