sms

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AliYun = iota
	QCloud
)

Variables

This section is empty.

Functions

func RandCode

func RandCode(length int) string

RandCode 生成随机数

Types

type AliConf

type AliConf struct {
	RegionId     string
	AccessKeyId  string
	AccessSecret string
	SignName     string
}

type AliSms

type AliSms struct {
	Conf   AliConf
	Client *dysmsapi.Client
}

func NewAliSms

func NewAliSms(conf AliConf) *AliSms

func (*AliSms) SendCode

func (s *AliSms) SendCode(template string, phone string, code string) error

type Template

type Template struct {
	Reg string
}

type VCode

type VCode struct {
	Config VCodeConf
	Cache  cache.Cache
	AliSms *AliSms
}

func NewVCode

func NewVCode(config VCodeConf, cacheConf cache.CacheConf) *VCode

func (*VCode) Check

func (v *VCode) Check(template string, mobile string, code string) error

Check 验证

func (*VCode) Send

func (v *VCode) Send(template string, mobile string) error

Send 发送

type VCodeConf

type VCodeConf struct {
	AliConf   AliConf
	Type      VCodeTypeEnum
	Debug     bool
	Length    int
	Life      int64
	MagicCode string
	TestUsers []string
	Template  Template
}

type VCodeTypeEnum

type VCodeTypeEnum int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL