sms

package
v0.3.12 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 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 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              `json:"debug,default=false"`
	Length    int               `json:"length,default=6"`
	Life      int64             `json:"life,default=300"`
	MagicCode string            `json:"magicCode,omitempty,optional"`
	TestUsers []string          `json:"testUsers,omitempty,optional"`
	Template  map[string]string `json:"template,omitempty,optional"`
}

type VCodeTypeEnum

type VCodeTypeEnum int

Jump to

Keyboard shortcuts

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