sms

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION         = "0.16 beta"
	ContentType     = "text/json"
	CacheSize   int = 64
	WriteBuffer int = 32
	Maxsendtime     = 60
)

Variables

View Source
var SenderMap = make(map[string]func() Sender)

Functions

func AddCallbackTask

func AddCallbackTask(sms *SMS, flag string)

func BytesToInt64

func BytesToInt64(b []byte) (tmp int64)

[]byte转换int64

func BytesTouInt64

func BytesTouInt64(b []byte) (tmp uint64)

[]byte转换uint64

func BytesTouInt8

func BytesTouInt8(b []byte) (tmp uint8)

[]byte转换uint8

func CreateClient

func CreateClient(accessKeyId *string, accessKeySecret *string) (_result *dysmsapi20170525.Client, _err error)

*

  • 使用AK&SK初始化账号Client
  • @param accessKeyId
  • @param accessKeySecret
  • @return Client
  • @throws Exception

func Init

func Init()

func Int64ToBytes

func Int64ToBytes(n int64) (b []byte)

int64转[]byte

func NewApplication

func NewApplication() sms.Sms

func RunCallbackTask

func RunCallbackTask()

func Uint64ToBytes

func Uint64ToBytes(n uint64) (b []byte)

uint64转[]byte

func VailCode

func VailCode(code string) error

func VailMobile

func VailMobile(mobile string) error

func VailUid

func VailUid(uid string) error

Types

type Alidayu

type Alidayu struct {
	// contains filtered or unexported fields
}

func (*Alidayu) Send

func (a *Alidayu) Send(sms *SMS) error

type Application

type Application struct {
}

type Callback

type Callback struct {
	Url  string
	Data url.Values
	// contains filtered or unexported fields
}

func (*Callback) Do

func (c *Callback) Do(cbs <-chan *Callback)

type Model

type Model struct {
	// contains filtered or unexported fields
}

func NewModel

func NewModel(sms *SMS) (SMSModel *Model)

func (*Model) DelSmsUid

func (m *Model) DelSmsUid()

* 删除Uid group:mobile *

func (*Model) GetMobileArea

func (m *Model) GetMobileArea() (string, error)

func (*Model) GetMobileInfo

func (m *Model) GetMobileInfo() (*phonedata.PhoneRecord, error)

func (*Model) GetSendTime

func (m *Model) GetSendTime() (int64, error)

* 获取发送时间 group:signname:mobile *

func (*Model) GetSmsCode

func (m *Model) GetSmsCode() (code string, uxtime int64, err error)

* 获取code group:servicename:signname:mobile *

func (*Model) GetSmsUid

func (m *Model) GetSmsUid() (string, error)

* 获取Uid group:mobile *

func (*Model) GetTodaySendNums

func (m *Model) GetTodaySendNums() (uint64, error)

* 获取当天发送数量 group:service:signname:mobile:date *

func (*Model) SetSendTime

func (m *Model) SetSendTime()

* 设置发送时间 group:signname:mobile *

func (*Model) SetSmsCode

func (m *Model) SetSmsCode()

* 设置code group:servicename:signname:mobile *

func (*Model) SetSmsUid

func (m *Model) SetSmsUid()

* 设置Uid group:mobile *

func (*Model) SetTodaySendNums

func (m *Model) SetTodaySendNums(num uint64)

* 设置当天发送数量 group:service:signname:mobile:date *

type SMS

type SMS struct {
	Mobile string
	Code   string
	Uid    string

	Config     *ServiceConfig
	ConfigisOK bool
	NowTime    time.Time
	// contains filtered or unexported fields
}

func NewSms

func NewSms() *SMS

func (*SMS) CheckCode

func (sms *SMS) CheckCode(mobile, code string) error

func (*SMS) DelUid

func (sms *SMS) DelUid(mobile, uid string) error

func (*SMS) Info

func (sms *SMS) Info(mobile string) (map[string]interface{}, error)

func (*SMS) Send

func (sms *SMS) Send(mobile string) error

发送短信 需保证在高并发下同一个手机号相同短信服务send操作是同步的,确保后续规则校验可以依次进行;

func (*SMS) SetServiceConfig

func (sms *SMS) SetServiceConfig(serviceName string) *SMS

设置服务配置文件,根据register/resetpwd选择不同短信模板,暂时使用同一模板,

func (*SMS) SetUid

func (sms *SMS) SetUid(mobile, uid string) error

type Sender

type Sender interface {
	Send(sms *SMS) error
}

type ServiceConfig

type ServiceConfig struct {
	Vendor      string
	Group       string
	Tpl         string
	Signname    string
	Allowcity   []string
	MaxSendNums int    //每天最大发送数量
	Callback    string //成功后回调URL
	Mode        byte
	Validtime   int
	Outformat   string
}

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (sms *ServiceProvider) Boot()

func (*ServiceProvider) Register

func (sms *ServiceProvider) Register()

Jump to

Keyboard shortcuts

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