adapter

package
v0.0.0-...-6a44d15 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DriverAdapter

type DriverAdapter interface {
	// 创建对应的发短信表
	CreateTable(db *gorose.Engin) (err error)
	// 生成短信记录入库
	GenerateSms(db *gorose.Engin, sms *Sms) (pkid int64, err error)
	// 更新短信发送结果信息
	UpdateSmsSendResult(db *gorose.Engin, sms *Sms) (pkid int64, err error)
	// 根据条件获取最新一条发送结果
	GetLatestSms(db *gorose.Engin, sms *Sms) (err error)
	// 核销短息
	VerifySms(db *gorose.Engin, sms *Sms) (affected_rows int64, err error)
}

type SdkAdapter

type SdkAdapter interface {
	SendSMS(*Sms) SmsResponse
	CheckSMS(*Sms) SmsResponse
}

type Sms

type Sms struct {
	Id         int64  `gorose:"id" json:"id"`
	Code       string `gorose:"code" json:"code"`               // 验证码
	SmsStatus  int64  `gorose:"sms_status" json:"sms_status"`   // 状态:默认0发送失败,1发送成功,2已核销
	MobilePre  int64  `gorose:"mobile_pre" json:"mobile_pre"`   // 国家代码
	Mobile     string `gorose:"mobile" json:"mobile"`           // 手机号
	Ip         string `gorose:"ip" json:"ip"`                   // ip
	OrderNo    string `gorose:"order_no" json:"order_no"`       // 唯一编号
	SendResult string `gorose:"send_result" json:"send_result"` // 原始返回的结果
	CreatedAt  string `gorose:"created_at" json:"created_at"`
}

func (Sms) TableName

func (Sms) TableName() string

type SmsResponse

type SmsResponse struct {
	Result  interface{}
	OrderNo string
	Error   error
}

SmsResponse 发送短信后的返回结构体

Directories

Path Synopsis
documents: https://www.twilio.com/blog/2014/06/sending-sms-from-your-go-app.html author: kevin
documents: https://www.twilio.com/blog/2014/06/sending-sms-from-your-go-app.html author: kevin

Jump to

Keyboard shortcuts

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