sms

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GangaoParamSpid     = "spid"     // 客户代码,不能为空
	GangaoParamPwd      = "pwd"      // 密码,不能为空
	GangaoParamId       = "id"       // 客户短信ID,int64型,用于返回对应回执,保证唯一值
	GangaoParamEntityId = "entityid" // 机构ID,int型,可为空
	GangaoParamOwnerId  = "ownerid"  // 用户ID,int型,可为空
	GangaoParamMobiles  = "mobiles"  // 手机号码列表,不能为空,长度不限制,多个手机号码用英文逗号分隔
	GangaoParamSms      = "sms"      // 短信内容,不能为空,最大支持700字节,内容进行Base64编码,再URLENCODE编码
	GangaoParamExt      = "ext"      // 特服号扩展码,数字,可为空,不要超过6位
	GangaoParamPri      = "pri"      // 发送优先级别,0-9,数字越大越优先发送
	GangaoParamChannel  = "channel"  // 通道代码,可为空
	GangaoParamSeq      = "seq"      // 流水号,int64型,要求唯一值,预防重复发送。如果不用,可为空
)

Variables

This section is empty.

Functions

func CreateClient

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

*

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

Types

type AwsSms

type AwsSms struct {
}

aws sms

func (*AwsSms) Name

func (s *AwsSms) Name() string

func (*AwsSms) Send

func (s *AwsSms) Send(msg *Message) (*SmsResult, error)

type DySms

type DySms struct {
}

* 阿里大鱼短信

func (DySms) SendSms

func (d DySms) SendSms(accessKeyID, accessSecret, phoneNumbers, signName, templateParam, templateCode string) (*SendSmsReply, error)

SendSms 发送短信

type GangaoRes

type GangaoRes struct {
	Result int32  `json:"result" xml:"Result"`
	Desc   string `json:"desc" xml:"Desc"` // base64编码
}

短信调用响应

func (*GangaoRes) GetDescText

func (r *GangaoRes) GetDescText() string

获取返回的明文信息

type GangaoSms

type GangaoSms struct {
}

港澳短信接口

func (*GangaoSms) Name

func (s *GangaoSms) Name() string

func (*GangaoSms) Send

func (s *GangaoSms) Send(msg *Message) (*SmsResult, error)

type Message

type Message struct {
	SourceId  string `json:"sourceId"`  // 短信的源Id, 用于追踪
	Phone     string `json:"phone"`     // 接收短信的电话
	Content   string `json:"content"`   // 内容
	Signature string `json:"signature"` // 短信签名
}

type SendSmsReply

type SendSmsReply struct {
	Code    string `json:"Code,omitempty"`
	Message string `json:"Message,omitempty"`
}

SendSmsReply 发送短信返回

type Sms

type Sms interface {
	// 短信接口名称
	Name() string
	Send(msg *Message) (*SmsResult, error)
}

func New

func New() Sms

type SmsResult

type SmsResult struct {
	MessageId string `json:"messageId"` // 短信平台商返回的消息Id
	Message   string `json:"message"`
	Success   bool   `json:"success"`
	ResData   string `json:"resData"` // 原始返回数据
}

短信发送接口

Jump to

Keyboard shortcuts

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