qcloudsms

package module
v0.0.0-...-195af50 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: MIT Imports: 13 Imported by: 9

README

腾讯云短信 Go SDK

Build Status Build status GoDoc Go Report Card license

Overview

此 SDK 为非官方版本,命名和结构上与官方版本有一些区别。

海外短信和国内短信使用同一接口,只需替换相应的国家码与手机号码,每次请求群发接口手机号码需全部为国内或者海外手机号码。

语音通知目前支持语音验证码以及语音通知功能。

Features

短信
  • 单发短信
  • 指定模板单发短信
  • 群发短信
  • 群发模板短信
  • 短信下发状态通知
  • 短信回复
  • 拉取短信状态
  • 拉取单个手机短信状态
语音
  • 发送语音验证码
  • 发送语音通知
  • 语音验证码状态通知
  • 语音通知状态通知
  • 语音通知按键通知
  • 语音送达失败原因推送
模板
  • 添加模板
  • 修改模板
  • 删除模板
  • 模板状态查询
签名
  • 添加签名
  • 修改签名
  • 删除签名
  • 短信签名状态查询
统计
  • 发送数据统计
  • 回执数据统计

Getting Start

准备

在开始开发云短信应用之前,需要准备如下信息:

  • 申请APPID以及APPKey

云短信应用SDK AppIDAppKey可在短信控制台的应用信息里获取,如您尚未添加应用,请到短信控制台中添加应用。

  • 申请签名

一个完整的短信由短信签名和短信正文内容两部分组成,短信签名须申请和审核,签名可在短信控制台的相应服务模块内容配置中进行申请。

  • 申请模板

同样短信或语音正文内容模板须申请和审核,模板可在短信控制台的相应服务模块内容配置中进行申请。

完成以上三项便可开始代码开发。

安装

go get github.com/qichengzx/qcloudsms_go

用法


import "github.com/qichengzx/qcloudsms_go"

opt := qcloudsms.NewOptions("yourappid","yourappkey","yoursign")

var client = qcloudsms.NewClient(opt)
client.SetDebug(true)

更多示例可在 Examplegodoc 查看

注意:example.go 中的示例代码,调用 NewOptions(),NewClient(opt) 时没有加包名,在实际调用中需要加入,或 import 时加入省略包名的操作。

Documentation

完整文档

License

This project is under the MIT License.

Documentation

Overview

Package qcloudsms 是针对 腾讯云短信平台 开发的一套 Go 语言 SDK

产品文档:https://cloud.tencent.com/document/product/382

Index

Constants

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

	// 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"

	// SENDSMS 发送短信
	SENDSMS string = "sendsms"

	// MULTISMS 群发短信
	MULTISMS string = "sendmultisms2"

	// SENDVOICE 发送语音验证码
	SENDVOICE string = "sendvoice"

	// PROMPTVOICE 发送语音通知
	PROMPTVOICE string = "sendvoiceprompt"

	// ADDTEMPLATE 添加模板
	ADDTEMPLATE string = "add_template"

	// GETTEMPLATE 查询模板状态
	GETTEMPLATE string = "get_template"

	// DELTEMPLATE 查询模板
	DELTEMPLATE string = "del_template"

	// MODTEMPLATE 修改模板
	MODTEMPLATE string = "mod_template"

	// ADDSIGN 添加签名
	ADDSIGN string = "add_sign"

	// GETSIGN 查询签名状态
	GETSIGN string = "get_sign"

	// MODSIGN 查询签名状态
	MODSIGN string = "mod_sign"

	// DELSIGN 查询签名状态
	DELSIGN string = "del_sign"

	// PULLSTATUS 拉取短信状态
	PULLSTATUS string = "pullstatus"

	// MOBILESTATUS 拉取单个手机短信状态(下发状态,短信回复等)
	MOBILESTATUS string = "pullstatus4mobile"

	// PULLSENDSTATUS 发送数据统计
	PULLSENDSTATUS string = "pullsendstatus"

	// PULLCBSTATUS 回执数据统计
	PULLCBSTATUS string = "pullcallbackstatus"

	// SUCCESS 请求成功的状态码
	SUCCESS uint = 0

	// MSGTYPE 普通短信类型
	MSGTYPE uint = 0
	// MSGTYPEAD 营销短信类型
	MSGTYPEAD uint = 1

	// MULTISMSMAX 群发短信单批次最大手机号数量
	MULTISMSMAX int = 200

	// PROMPTVOICETYPE 语音类型,为2表示语音通知
	PROMPTVOICETYPE uint = 2
	//根据模板发送语音基本url
	VSVR = "https://cloud.tim.qq.com/v5/"
	//	模板发送语音
	TVOICE = "sendtvoice"
)

Variables

View Source
var (
	//ErrMultiCount 群发号码数量错误
	ErrMultiCount = errors.New("单次提交不超过200个手机号")
	//ErrRequest 请求失败
	ErrRequest = errors.New("请求失败")
)

Functions

func ExampleNewClient

func ExampleNewClient()

func ExampleQcloudSMSVoiceTemplateSend

func ExampleQcloudSMSVoiceTemplateSend()

选择腾讯云上面配置的语音模板发送语音

func ExampleQcloudSMS_DelSign

func ExampleQcloudSMS_DelSign()

func ExampleQcloudSMS_GetTemplateByPage

func ExampleQcloudSMS_GetTemplateByPage()

func ExampleQcloudSMS_ModTemplate

func ExampleQcloudSMS_ModTemplate()

func ExampleQcloudSMS_NewSign

func ExampleQcloudSMS_NewSign()

func ExampleQcloudSMS_SendSMSSingle

func ExampleQcloudSMS_SendSMSSingle()

func ExampleQcloudSMS_SendVoice

func ExampleQcloudSMS_SendVoice()

Types

type Options

type Options struct {
	// 腾讯云短信appid
	APPID string
	// 腾讯云短信appkey
	APPKEY string
	// 表示短信签名
	SIGN string

	// 请求随机数长度
	RandomLen int
	UserAgent string

	HTTP struct {
		Timeout time.Duration
	}

	// 是否开启Debug
	Debug bool
}

Options 用来构造请求的参数结构

func NewOptions

func NewOptions(appid, appkey, sign string) *Options

NewOptions 返回一个新的 *Options

type PullReplyResult

type PullReplyResult struct {
	Result int    `json:"result"`
	Errmsg string `json:"errmsg"`
	// result为0时有效,返回的信息条数
	Count int              `json:"count"`
	Data  []SMSReplyResult `json:"data"`
}

PullReplyResult 拉取短信回复返回数据结构

type PullStatusReq

type PullStatusReq struct {
	Sig  string `json:"sig"`
	Time int64  `json:"time"`
	// 0 1分别代表 短信下发状态,短信回复
	Type int `json:"type"`
	// 最大条数 最多100
	Max int `json:"max"`
}

PullStatusReq 拉取短信状态请求结构

type PullStatusResult

type PullStatusResult struct {
	Result int    `json:"result"`
	Errmsg string `json:"errmsg"`
	// result为0时有效,返回的信息条数
	Count int               `json:"count"`
	Data  []SMSStatusResult `json:"data"`
}

PullStatusResult 拉取下发状态返回数据结构

type QcloudClient

type QcloudClient interface {
	NewRandom(l int) *QcloudSMS
	NewSig(m string) *QcloudSMS
	NewUrl(api string) *QcloudSMS
	NewRequest(params interface{}) ([]byte, error)

	SetAPPID(appid string) *QcloudSMS
	SetAPPKEY(appkey string) *QcloudSMS
	SetSIGN(sign string) *QcloudSMS
	SetLogger(logger *log.Logger) *QcloudSMS
}

QcloudClient 用来构造请求,设置各项参数,和执行请求的接口

type QcloudSMS

type QcloudSMS struct {
	Random  string
	Sig     string
	URL     string
	ReqTime int64
	Options Options
	Logger  *log.Logger
}

QcloudSMS 是请求的结构 一次请求具体功能由 QcloudClient 接口实现

func NewClient

func NewClient(o *Options) *QcloudSMS

NewClient 生成一个新的 client 实例

func (*QcloudSMS) DelSign

func (c *QcloudSMS) DelSign(signid []uint) (SignResult, error)

DelSign 删除短信签名 参数是要删除签名的ID数组

https://cloud.tencent.com/document/product/382/6039

func (*QcloudSMS) DelTemplate

func (c *QcloudSMS) DelTemplate(id []uint) (TemplateResult, error)

DelTemplate 删除模板 参数是一个uint数组,表示模板ID

https://cloud.tencent.com/document/product/382/5818

func (*QcloudSMS) GetReplyForMobile

func (c *QcloudSMS) GetReplyForMobile(smr StatusMobileReq) (StatusReplyResult, error)

GetReplyForMobile 拉取单个手机短信状态(短信回复)

https://cloud.tencent.com/document/product/382/5811

func (*QcloudSMS) GetSendStatus

func (c *QcloudSMS) GetSendStatus(begin, end uint32) (SendStatusResult, error)

GetSendStatus 发送数据统计

https://cloud.tencent.com/document/product/382/7755

func (*QcloudSMS) GetSign

func (c *QcloudSMS) GetSign(signid []uint) (SignStatusResult, error)

GetSign 短信签名状态查询 参数是要删除签名的ID数组

https://cloud.tencent.com/document/product/382/6040

func (*QcloudSMS) GetStatus

func (c *QcloudSMS) GetStatus(begin, end uint32) (StatusResult, error)

GetStatus 回执数据统计

https://cloud.tencent.com/document/product/382/7756

func (*QcloudSMS) GetStatusForMobile

func (c *QcloudSMS) GetStatusForMobile(smr StatusMobileReq) (StatusMobileResult, error)

GetStatusForMobile 拉取单个手机短信状态(下发状态)

https://cloud.tencent.com/document/product/382/5811

func (*QcloudSMS) GetStatusMQ

func (c *QcloudSMS) GetStatusMQ(psr PullStatusReq) (StatusMobileResult, error)

GetStatusMQ 拉取短信状态(下发状态,短信回复) 已拉取过的数据将不会再返回

https://cloud.tencent.com/document/product/382/5810

func (*QcloudSMS) GetTemplateByID

func (c *QcloudSMS) GetTemplateByID(id []uint) (TemplateGetResult, error)

GetTemplateByID 根据模板ID查询模板状态 将需要查询的模板ID以数组方式传入

https://cloud.tencent.com/document/product/382/5819

func (*QcloudSMS) GetTemplateByPage

func (c *QcloudSMS) GetTemplateByPage(offset, max uint) (TemplateGetResult, error)

GetTemplateByPage 用于批量获取模板数据 参数为偏移量,拉取条数

func (*QcloudSMS) ModSign

func (c *QcloudSMS) ModSign(s SignReq) (SignResult, error)

ModSign 修改签名 参数是一个 SignReq 结构

https://cloud.tencent.com/document/product/382/8650

func (*QcloudSMS) ModTemplate

func (c *QcloudSMS) ModTemplate(t TemplateNew) (TemplateResult, error)

ModTemplate 修改模板 参数是一个 TemplateNew 结构

https://cloud.tencent.com/document/product/382/8649

func (*QcloudSMS) NewRandom

func (c *QcloudSMS) NewRandom(l int) *QcloudSMS

NewRandom 为实例生成新的随机数

func (*QcloudSMS) NewRequest

func (c *QcloudSMS) NewRequest(params interface{}) ([]byte, error)

NewRequest 执行实例发送请求

func (*QcloudSMS) NewSig

func (c *QcloudSMS) NewSig(m string) *QcloudSMS

NewSig 为实例生成 sig

func (*QcloudSMS) NewSign

func (c *QcloudSMS) NewSign(s SignReq) (SignResult, error)

NewSign 添加签名

https://cloud.tencent.com/document/product/382/6038

func (*QcloudSMS) NewTemplate

func (c *QcloudSMS) NewTemplate(t TemplateNew) (TemplateResult, error)

NewTemplate 新建模板 参数是一个 TemplateNew 结构

https://cloud.tencent.com/document/product/382/5817

func (*QcloudSMS) NewURL

func (c *QcloudSMS) NewURL(api string) *QcloudSMS

NewURL 为实例设置 URL

func (*QcloudSMS) SendSMSMulti

func (c *QcloudSMS) SendSMSMulti(sms SMSMultiReq) (bool, error)

SendSMSMulti 群发短信

func (*QcloudSMS) SendSMSSingle

func (c *QcloudSMS) SendSMSSingle(ss SMSSingleReq) (bool, error)

SendSMSSingle 发送单条短信

func (*QcloudSMS) SendVoice

func (c *QcloudSMS) SendVoice(v VoiceReq) (bool, error)

SendVoice 执行发送语音的逻辑

此接口整合了语音验证码和语音通知,使用时根据相应的参数构造请求体即可。

func (*QcloudSMS) SetAPPID

func (c *QcloudSMS) SetAPPID(appid string) *QcloudSMS

SetAPPID 为实例设置 APPID

func (*QcloudSMS) SetAPPKEY

func (c *QcloudSMS) SetAPPKEY(appkey string) *QcloudSMS

SetAPPKEY 为实例设置 APPKEY

func (*QcloudSMS) SetDebug

func (c *QcloudSMS) SetDebug(debug bool) *QcloudSMS

SetDebug 为实例设置调试模式

func (*QcloudSMS) SetLogger

func (c *QcloudSMS) SetLogger(logger *log.Logger) *QcloudSMS

SetLogger 为实例设置 logger

func (*QcloudSMS) SetSIGN

func (c *QcloudSMS) SetSIGN(sign string) *QcloudSMS

SetSIGN 为实例设置 SIGN

func (*QcloudSMS) VoiceTemplateSend

func (c *QcloudSMS) VoiceTemplateSend(s SMSVoiceTemplate) (bool, error)

根据配置好的模板进行语音发送

type SMSMultiReq

type SMSMultiReq struct {
	Tel    []SMSTel `json:"tel"`
	Type   uint     `json:"type,omitempty"`
	Sign   string   `json:"sign,omitempty"`
	TplID  uint     `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"`
}

SMSMultiReq 群发短信请求结构

将普通短信和模板短信统一到了一个结构体里,构造请求时为对应请求的必传字段赋值即可

普通 https://cloud.tencent.com/document/product/382/5806

模板 https://cloud.tencent.com/document/product/382/5977

type SMSMultiResult

type SMSMultiResult struct {
	Result uint   `json:"result"`
	Errmsg string `json:"errmsg"`
	Ext    string `json:"ext"`
	Detail []struct {
		Result     uint   `json:"result"`
		Errmsg     string `json:"errmsg"`
		Mobile     string `json:"mobile"`
		Nationcode string `json:"nationcode"`
		Sid        string `json:"sid,omitempty"`
		Fee        uint   `json:"fee,omitempty"`
	} `json:"detail"`
}

SMSMultiResult 群发短信返回结构

type SMSReplyResult

type SMSReplyResult struct {
	Nationcode string `json:"nationcode"`
	Mobile     string `json:"mobile"`
	Text       string `json:"text"`
	Sign       string `json:"sign"`
	Time       int64  `json:"time"`
	Extend     string `json:"extend"`
}

SMSReplyResult 短信回复列表结构

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"`
}

SMSResult 发送短信返回结构

type SMSSingleReq

type SMSSingleReq 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"`
}

SMSSingleReq 发送单条短信请求结构

将单发短信和模板短信统一到了一个结构体里,构造请求时为对应请求的必传字段赋值即可

单发 https://cloud.tencent.com/document/product/382/5808

模板 https://cloud.tencent.com/document/product/382/5976

type SMSStatusResult

type SMSStatusResult struct {
	UserReceiveTime string `json:"user_receive_time"`
	Nationcode      string `json:"nationcode"`
	Mobile          string `json:"mobile"`
	ReportStatus    string `json:"report_status"`
	Errmsg          string `json:"errmsg"`
	Description     string `json:"description"`
	Sid             string `json:"sid"`
}

SMSStatusResult 单个手机短信状态结构

type SMSTel

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

SMSTel 国家码,手机号

type SMSVoiceTemplate

type SMSVoiceTemplate struct {
	// 手机号码结构
	Tel struct {
		Nationcode string `json:"nationcode"`
		Mobile     string `json:"mobile"`
	} `json:"tel"`
	//参数对应模板的{1} {2}...
	Params []string `json:"params"`
	TplId  int      `json:"tpl_id"`
	// 播放次数
	Playtimes uint   `json:"playtimes"`
	Sig       string `json:"sig"`
	Time      int64  `json:"time"`
	Ext       string `json:"ext"`
}

选择模板发送语音的参数

type SendStatusReq

type SendStatusReq struct {
	Sig       string `json:"sig"`
	Time      int64  `json:"time"`
	BeginDate uint32 `json:"begin_date"`
	EndDate   uint32 `json:"end_date"`
}

SendStatusReq 发送数据统计请求结构

type SendStatusResult

type SendStatusResult struct {
	Result uint   `json:"result"`
	Errmsg string `json:"errmsg"`
	Data   struct {
		Request    uint `json:"request"`
		Success    uint `json:"success"`
		BillNumber uint `json:"bill_number"`
	} `json:"data"`
}

SendStatusResult 发送数据统计返回结构

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 短信签名状态返回结构体

type StatusMobileReq

type StatusMobileReq struct {
	Sig  string `json:"sig"`
	Time int64  `json:"time"`
	// 0 1分别代表 短信下发状态,短信回复
	Type int `json:"type"`
	// 最大条数 最多100
	Max        int    `json:"max"`
	BeginTime  int64  `json:"begin_time"`
	EndTime    int64  `json:"end_time"`
	Nationcode string `json:"nationcode"`
	Mobile     string `json:"mobile"`
}

StatusMobileReq 拉取单个手机短信状态请求结构

type StatusMobileResult

type StatusMobileResult struct {
	Result int               `json:"result"`
	Errmsg string            `json:"errmsg"`
	Count  int               `json:"count"`
	Data   []SMSStatusResult `json:"data"`
}

StatusMobileResult 拉取单个手机短信状态的返回结构

type StatusReplyResult

type StatusReplyResult struct {
	Result int              `json:"result"`
	Errmsg string           `json:"errmsg"`
	Count  int              `json:"count"`
	Data   []SMSReplyResult `json:"data"`
}

StatusReplyResult 短信回复结构

type StatusReq

type StatusReq struct {
	Sig       string `json:"sig"`
	Time      int64  `json:"time"`
	BeginDate uint32 `json:"begin_date"`
	EndDate   uint32 `json:"end_date"`
}

StatusReq 查询回执数据请求结构

type StatusResult

type StatusResult struct {
	Result uint   `json:"result"`
	Errmsg string `json:"errmsg"`
	Data   struct {
		// 短信提交成功量
		Success uint `json:"success"`
		// 短信回执量
		Status uint `json:"status"`
		// 短信回执成功量
		StatusSuccess uint `json:"status_success"`
		// 短信回执失败量
		StatusFail uint `json:"status_fail"`
		// 运营商内部错误
		StatusFail0 uint `json:"status_fail_0"`
		// 号码无效或空号
		StatusFail1 uint `json:"status_fail_1"`
		// 停机、关机等
		StatusFail2 uint `json:"status_fail_2"`
		// 黑名单
		StatusFail3 uint `json:"status_fail_3"`
		// 运营商频率限制
		StatusFail4 uint `json:"status_fail_4"`
	} `json:"data"`
}

StatusResult 回执数据结构

type Template

type Template struct {
	ID            uint   `json:"id"`
	Text          string `json:"text"`
	Status        uint   `json:"status"`
	Reply         string `json:"reply"`
	Type          uint   `json:"type"`
	International uint   `json:"international"`
	ApplyTime     string `json:"apply_time"`
}

Template 模板结构

type TemplateDelReq

type TemplateDelReq struct {
	Sig   string `json:"sig"`
	Time  int64  `json:"time"`
	TplID []uint `json:"tpl_id"`
}

TemplateDelReq 删除模板请求结构

type TemplateGetReq

type TemplateGetReq struct {
	Sig     string `json:"sig"`
	Time    int64  `json:"time"`
	TplID   []uint `json:"tpl_id,omitempty"`
	TplPage struct {
		Offset uint `json:"offset"`
		Max    uint `json:"max"`
	} `json:"tpl_page,omitempty"`
}

TemplateGetReq 查询模板状态请求结构

type TemplateGetResult

type TemplateGetResult struct {
	Result uint       `json:"result"`
	Msg    string     `json:"msg"`
	Total  uint       `json:"total"`
	Count  uint       `json:"count"`
	Data   []Template `json:"data"`
}

TemplateGetResult 查询模板状态返回结构

type TemplateNew

type TemplateNew struct {
	Sig           string `json:"sig"`
	Time          int64  `json:"time"`
	Title         string `json:"title"`
	Remark        string `json:"remark"`
	International uint   `json:"international"`
	Text          string `json:"text"`
	TplID         uint   `json:"tpl_id,omitempty"`
	Type          uint   `json:"type"`
}

TemplateNew 新增,修改模板的请求结构 其中,新增时TplID为空,修改时传入指定要修改的模板ID

type TemplateResult

type TemplateResult struct {
	Result uint     `json:"result"`
	Msg    string   `json:"msg"`
	Data   Template `json:"data,omitempty"`
}

TemplateResult 新增,修改,删除模板返回结构 以上几种操作共用此结构,唯一区别在于返回值中的data可能不同

type VoiceReq

type VoiceReq struct {
	// 手机号码结构
	Tel struct {
		Nationcode string `json:"nationcode"`
		Mobile     string `json:"mobile"`
	} `json:"tel"`

	// 语音类型,为2表示语音通知
	Prompttype uint `json:"prompttype,omitempty"`

	// 语音内容,语音类型为通知时有效
	Promptfile string `json:"promptfile,omitempty"`

	// 语音内容,语音类型为验证码通知时有效
	Msg string `json:"msg,omitempty"`

	// 播放次数
	Playtimes uint   `json:"playtimes"`
	Sig       string `json:"sig"`
	Time      int64  `json:"time"`
	Ext       string `json:"ext"`
}

VoiceReq 语音接口请求结构

type VoiceResult

type VoiceResult struct {
	Result uint   `json:"result"`
	Errmsg string `json:"errmsg"`
	Ext    string `json:"ext"`
	Callid string `json:"callid"`
}

VoiceResult 语音发送后返回结果的结构

Jump to

Keyboard shortcuts

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