sms

package
v0.0.0-...-849f898 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SENDSMS 发送短信
	SENDSMS string = "sendsms"
	// MULTISMS 群发短信
	MULTISMS string = "sendmultisms2"
	// SENDVOICE 发送语音验证码
	SENDVOICE string = "sendvoice"
	// PROMPTVOICE 发送语音通知
	PROMPTVOICE string = "sendvoiceprompt"
	// ADDSIGN 添加签名
	ADDSIGN string = "add_sign"
)

api for qcloud sms functions

View Source
const (
	// SVR 是腾讯云短信各请求结构的基本 URL
	SVR string = "https://yun.tim.qq.com/v5/"
	// TLSSMSSVR 腾讯云短信业务主URL
	TLSSMSSVR string = "tlssmssvr/"
	// VOICESVR 腾讯云语音URL
	VOICESVR string = "tlsvoicesvr/"
	// TLSSMSSVRAfter 短信业务URL附加内容
	TLSSMSSVRAfter string = "?sdkappid=%s&random=%s"
)

url for qcloud sms functions

View Source
const (
	//SDKName SDK名称,当前主要用于 log 中
	SDKName = "qcloudsms-go-sdk"
	// SDKVersion 版本
	SDKVersion = "0.3.3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type QCloudSms

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

QCloudSms sms sender by qcloud

func (*QCloudSms) AddSign

func (s *QCloudSms) AddSign(req SignReq) (SignResult, error)

AddSign function for ADDSIGN

func (*QCloudSms) Init

func (s *QCloudSms) Init(appID, appKey, sign string, tplID int) error

Init initialize for QCloudSms

func (*QCloudSms) SendSMS

func (s *QCloudSms) SendSMS(nationCode, mobile, msg string) error

SendSMS send msg by phonenum

nationCode:
    cn: "86"

type SMSReq

type SMSReq struct {
	Tel    SMSTel   `json:"tel"`
	Type   int      `json:"type,omitempty"`
	Sign   string   `json:"sign,omitempty"`
	TplID  int      `json:"tpl_id,omitempty"`
	Params []string `json:"params"`
	Msg    string   `json:"msg,omitempty"`
	Sig    string   `json:"sig"`
	Time   int64    `json:"time"`
	Extend string   `json:"extend"`
	Ext    string   `json:"ext"`
}

SMSReq request for SENDSMS

type SMSResult

type SMSResult struct {
	Result       uint   `json:"result"`
	Errmsg       string `json:"errmsg"`
	Ext          string `json:"ext"`
	Sid          string `json:"sid,omitempty"`
	Fee          uint   `json:"fee,omitempty"`
	ActionStatus string `json:"ActionStatus"`
	ErrorCode    uint   `json:"ErrorCode"`
	ErrorInfo    string `json:"ErrorInfo"`
}

SMSResult 发送短信返回结构

type SMSTel

type SMSTel struct {
	Nationcode string `json:"nationcode"`
	Mobile     string `json:"mobile"`
}

SMSTel 国家码,手机号

type SignDelGet

type SignDelGet struct {
	Sig    string `json:"sig"`
	Time   int64  `json:"time"`
	SignID []uint `json:"sign_id"`
}

SignDelGet 查询/删除签名的请求结构

type SignReq

type SignReq struct {
	Sig    string `json:"sig"`
	Time   int64  `json:"time"`
	Remark string `json:"remark"`
	// 是否为国际短信签名,1=国际,0=国内
	International int `json:"international"`
	// 签名内容,不带"【】"
	Text string `json:"text"`
	// 签名内容相关的证件截图base64格式字符串,非必传参数
	Pic string `json:"pic,omitempty"`
	// 要修改的签名ID
	SignID uint `json:"sign_id,omitempty"`
}

SignReq 请求结构

type SignResult

type SignResult struct {
	Result uint   `json:"result"`
	Msg    string `json:"msg"`
	Data   struct {
		ID            uint   `json:"id"`
		International uint   `json:"international,omitempty"`
		Text          string `json:"text"`
		Status        uint   `json:"status"`
	} `json:"data,omitempty"`
}

SignResult 添加/修改/删除 的返回结构

type SignStatusResult

type SignStatusResult struct {
	Result uint   `json:"result"`
	Msg    string `json:"msg"`
	Count  uint   `json:"count"`
	Data   []struct {
		ID            uint   `json:"id"`
		Text          string `json:"text"`
		International uint   `json:"international,omitempty"`
		Status        uint   `json:"status"`
		Reply         string `json:"reply"`
		ApplyTime     string `json:"apply_time"`
	} `json:"data"`
}

SignStatusResult 短信签名状态返回结构体

Jump to

Keyboard shortcuts

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