Documentation
¶
Index ¶
- Variables
- func ReleaseSingleSendRequestBody(sb *SingleSendRequestBody)
- type ActiveFetchRequestBody
- type BatchSendItemResponseBody
- type BatchSendItemReuqestBody
- type BatchSendRequestBody
- type BatchSendResponseBody
- type DailyStatsRequestBody
- type SingleSendRequestBody
- type SmsSigner
- func (ss *SmsSigner) FetchStatus() ([]*StatusResultSingleItem, int64, error)
- func (ss *SmsSigner) FetchUpstream() ([]*UpstreamItem, int64, error)
- func (ss *SmsSigner) Send(b []byte, url string) ([]byte, error)
- func (ss *SmsSigner) SendMultiSms(smsItems []*BatchSendItemReuqestBody) (map[string]string, int64, error)
- func (ss *SmsSigner) SendSingleSms(content string, mobile string, extcode string, sid string) (string, error)
- func (ss *SmsSigner) SendWithHeader(b []byte, url string, m map[string]string) ([]byte, error)
- func (ss *SmsSigner) SignAgain(jsonByte []byte)
- type StatusResultResponseBody
- type StatusResultSingleItem
- type UpstreamItem
- type UpstreamItemResponseBody
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MaxBatchCount int = 100 SingleSendRequestBodyPool sync.Pool )
View Source
var GlobalHeaderMap = make(map[string]string)
Functions ¶
func ReleaseSingleSendRequestBody ¶
func ReleaseSingleSendRequestBody(sb *SingleSendRequestBody)
Types ¶
type ActiveFetchRequestBody ¶
type ActiveFetchRequestBody struct { //可选 默认500,支持范围[10, 1000],参数超出范围按照默认算 MaxSize int `json:"maxSize"` }
type BatchSendItemReuqestBody ¶
type BatchSendItemReuqestBody struct { //必须。最大长度1005。短信内容,例如: 【线上线下】您的验证码为123456,在10分钟内有效。 Content string `json:"content"` //必须。多个号码用,分隔开,号码数量<=10000 Mobile string `json:"mobile"` //可选。可选。扩展码,必须可解析为数字,最大长度12 ExtCode string `json:"extCode"` //自定义msgId,若不传,由我们平台生成一个msgId返回,若设置此值,平台将使用此msgId作为此次提交的唯一编号并返回此msgId MsgId string `json:"msgId"` }
短信群发,单条短信的结构
type BatchSendRequestBody ¶
type BatchSendRequestBody struct { UserId string `json:"userId"` Md5Password string `json:"md5password"` ContentArr []*BatchSendItemReuqestBody `json:"contentArr"` }
type BatchSendResponseBody ¶
type BatchSendResponseBody struct { Status string `json:"status"` Result []*BatchSendItemResponseBody `json:"result"` }
type DailyStatsRequestBody ¶
type DailyStatsRequestBody struct { //必选,最大长度8,日期格式化:yyyyMMdd 示例: 20200101 Date string `json:"date"` }
type SingleSendRequestBody ¶
type SingleSendRequestBody struct { //必须。最大长度1005。短信内容,例如: 【线上线下】您的验证码为123456,在10分钟内有效。 Content string `json:"content"` //必须。多个号码用,分隔开,号码数量<=10000 Mobile string `json:"mobile"` //可选。可选。扩展码,必须可解析为数字,最大长度12 ExtCode string `json:"extCode"` //可选。最大长度64。批次号,可用于客户侧按照批次号对短信进行分组 SId string `json:"sId"` }
短信单发
func AcquireSingleSendRequestBody ¶
func AcquireSingleSendRequestBody() *SingleSendRequestBody
func (*SingleSendRequestBody) Reset ¶
func (s *SingleSendRequestBody) Reset()
type SmsSigner ¶
type SmsSigner struct { //我方提供的发送账号的唯一标识 SpId string `json:"spId"` //共享spKey密钥 SpKey string `json:"spKey"` //SmsSendUrl 我方提供的短信发送Url地址,例如https://api-hw.onmsg.cn SmsSendUrl string `json:"BaseUrl"` //平台支持客户主动来获取短信的状态报告,我方提供主动获取短信报告的接口 SmsReportUrl string `json:"reportUrl"` }
func NewSmsSigner ¶
func (*SmsSigner) FetchStatus ¶
func (ss *SmsSigner) FetchStatus() ([]*StatusResultSingleItem, int64, error)
func (*SmsSigner) FetchUpstream ¶
func (ss *SmsSigner) FetchUpstream() ([]*UpstreamItem, int64, error)
func (*SmsSigner) SendMultiSms ¶
func (ss *SmsSigner) SendMultiSms(smsItems []*BatchSendItemReuqestBody) (map[string]string, int64, error)
成功MESSAGEid列表 ,失败message id 列表,失败
func (*SmsSigner) SendSingleSms ¶
func (ss *SmsSigner) SendSingleSms(content string, mobile string, extcode string, sid string) (string, error)
type SingleSendRequestBody struct { //必须。最大长度1005。短信内容,例如: 【线上线下】您的验证码为123456,在10分钟内有效。 Content string `json:"content"` //必须。多个号码用,分隔开,号码数量<=10000 Mobile string `json:"mobile"` //可选。可选。扩展码,必须可解析为数字,最大长度12 ExtCode string `json:"extCode"` //可选。最大长度64。批次号,可用于客户侧按照批次号对短信进行分组 SId string `json:"sId"` }
func (*SmsSigner) SendWithHeader ¶
type StatusResultResponseBody ¶
type StatusResultResponseBody struct { Status int `json:"status"` Result []*StatusResultSingleItem `json:"result"` }
{ "status" : 0, // 固定值0 "result" : [ { "phone" : "13921350591", // 手机号码 "msgid" : "-8629637681836384963", // 与提交中的msgid 一致 "status" : "DELIVRD" , // 短信状态,参考附表2 "donetime" : "20170816153922", // 短信到达时间 "fee" : 2, // 短信计费条数 "sId" : "123456789abcdefg" // 批次号 } //这里是数组会有多条,默认最大500条
,平台可配置
] }
type StatusResultSingleItem ¶
type UpstreamItem ¶
type UpstreamItemResponseBody ¶
type UpstreamItemResponseBody struct { Status int `json:"status"` Result []*UpstreamItem `json:"result"` }
Click to show internal directories.
Click to hide internal directories.