Version: v0.0.0-...-4e81a15 Latest Latest

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

Go to latest
Published: Nov 15, 2017 License: GPL-3.0 Imports: 17 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type SmsIdentity

type SmsIdentity struct {
	AppKey       string // 身份验证key
	AppSecret    string // 身份验证secret
	FreeSignName string // 身份验证签名
	TemplateCode string // 身份验证模板CODE
	Product      string // 身份验证项目名称

SmsIdentity 短信身份验证信息

type VerifyCode

type VerifyCode struct {
	Active       bool      `json:"active" db:"active"`              // 是否有效
	MobileNumber string    `json:"mobileNumber" db:"mobile_number"` // 手机号
	Code         string    `json:"code" db:"code"`                  // 验证码
	ExpireAt     time.Time `json:"expireAt" db:"expire_at"`         // 过期时间

VerifyCode 验证码机构体

type VerifyDB

type VerifyDB struct {
	DB    *sqlx.DB
	Redis *redis.Redis

func (*VerifyDB) UpdateCode

func (db *VerifyDB) UpdateCode(mobileNumber, code string) error

UpdateCode 修改验证码

func (*VerifyDB) UpdateCodeRedis

func (db *VerifyDB) UpdateCodeRedis(mobileNumber, code string) error

UpdateCodeRedis 修改验证码

func (*VerifyDB) ValidateCode

func (db *VerifyDB) ValidateCode(mobileNumber, code string) (*VerifyCode, error)

ValidateCode 验证验证码有效性,验证后自动废弃验证码

func (*VerifyDB) ValidateCodeRedis

func (db *VerifyDB) ValidateCodeRedis(mobileNumber, code string) (*VerifyCode, error)

ValidateCodeRedis 验证验证码有效性,验证后自动废弃验证码

type VerifyTx

type VerifyTx struct {
	Tx    *sqlx.Tx
	Redis *redis.Redis

func (*VerifyTx) DayuVerifyCode

func (tx *VerifyTx) DayuVerifyCode(mobileNumber string) (string, error)

DayuVerifyCode 发送验证码

func (*VerifyTx) SendBatchSMS

func (tx *VerifyTx) SendBatchSMS(apikey, text string, mobiles ...string) error

SendBatchSMS 使用云片API批量发送短信

func (*VerifyTx) SendSMS

func (tx *VerifyTx) SendSMS(apikey, tplID, mobile, code string) error

SendSMS 使用云片API发送短信

func (*VerifyTx) SendSMSCode

func (tx *VerifyTx) SendSMSCode(i *SmsIdentity, mobile, code string) error

SendSMSCode 发送短信

func (*VerifyTx) YunPianVerifyCode

func (tx *VerifyTx) YunPianVerifyCode(mobileNumber string) (string, error)

YunPianVerifyCode 使用云片API发送验证码,apikey云片key,tplID云片模版ID

func (*VerifyTx) YunPianVerifyCodeRedis

func (tx *VerifyTx) YunPianVerifyCodeRedis(mobileNumber string) (string, error)

YunPianVerifyCodeRedis 使用云片API发送验证码,apikey云片key,tplID云片模版ID

Jump to

Keyboard shortcuts

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