services

package
v0.0.0-...-a14fa2b Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(code, sign string, conf *Config, db *sql.DB) error

Check 根据sign和验证码,返回nil表示成功

func Code

func Code(size int) string

Code 生成x位数字验证码

func Send

func Send(mobile, sign string, conf *Config, db *sql.DB) error

Send 根据手机号和id生成时间和验证码,并发送后存入数据库

func UID

func UID() string

UID 生成uid

func VailMobile

func VailMobile(mobile string) error

VailMobile 可行的手机号

Types

type Config

type Config struct {
	Host           string
	Appcode        string
	Digits         int
	ResendInterval int
	OnCheck        SMSVerify
}

Config -

type Controller

type Controller struct {
	DB   *sql.DB
	Conf Config
}

Controller -

func NewController

func NewController(db *sql.DB, Conf *Config) *Controller

NewController -

type SMS

type SMS struct {
	Mobile string
	Date   int64
	Code   string
	Sign   string
}

SMS -

type SMSVerify

type SMSVerify interface {
	OnVerifySucceed(targetID, mobile string)
	OnVerifyFailed(targetID, mobile string)
}

SMSVerify -

type SendSmsReply

type SendSmsReply struct {
	Message   string `json:"Message,omitempty"`
	RequestID string `json:"RequestId,omitempty"`
	BizID     string `json:"BizId,omitempty"`
	Code      string `json:"Code,omitempty"`
}

SendSmsReply -

Jump to

Keyboard shortcuts

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