Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MockCode = "123456"
MockCode 模拟验证码
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Provider string // 提供方 SendPeriod int `json:",default=60"` // 发送时间段(与发送配额搭配,如发送时间段为 60,发送配额为 1,表示 60s 内对同一接收方只允许发送 1 次) SendQuota int `json:",default=1"` // 发送时间段内发送配额 VerifyPeriod int `json:",default=60"` // 验证时间段(与验证配额搭配,如验证时间段为 60,验证配额为 1,表示 60s 内对同一接收方只允许验证 1 次) VerifyQuota int `json:",default=3"` // 验证时间内段验证配额 ReceiverQuota int `json:",default=15"` // 一天内同一接收方配额 IPSourceQuota int `json:",default=30"` // 一天内同一IP来源配额 ProviderQuota int `json:",default=10000"` // 一天内该提供方配额 }
Config 通知服务配置
type Notify ¶
type Notify struct {
// contains filtered or unexported fields
}
Notify 通知服务
func MustNewNotify ¶
func MustNewNotify(c Config, smsClients notifytypes.SmsClientPicker, emailClients notifytypes.EmailClientPicker, kvStore *xkv.Store) *Notify
MustNewNotify 新建通知服务
func NewNotify ¶
func NewNotify(c Config, smsClients notifytypes.SmsClientPicker, emailClients notifytypes.EmailClientPicker, kvStore *xkv.Store) (*Notify, error)
NewNotify 新建通知服务
func (*Notify) SendEmailCode ¶
func (n *Notify) SendEmailCode(p *notifytypes.SendParams) error
SendEmailCode 发送邮件验证码
func (*Notify) SendSmsCode ¶
func (n *Notify) SendSmsCode(p *notifytypes.SendParams) error
SendSmsCode 发送短信验证码
func (*Notify) VerifyEmailCode ¶
func (n *Notify) VerifyEmailCode(p *notifytypes.VerifyParams) error
VerifyEmailCode 校验邮箱验证码
func (*Notify) VerifySmsCode ¶
func (n *Notify) VerifySmsCode(p *notifytypes.VerifyParams) error
VerifySmsCode 校验短信验证码
Click to show internal directories.
Click to hide internal directories.