sms

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: MIT Imports: 10 Imported by: 0

README

alidayu

alidayu golang package

SMS

send

package main

import (
	"fmt"

	"github.com/tiantour/alidayu/sms"
)

func init() {
	sms.AppKey = "xxx"
	sms.AppSecret = "xxx"
	sms.Sign = "xxx"
}
func main() {
	x, err := sms.NewSend().Do(
		"18910315767",
		"SMS_10271157",
		map[string]string{
			"number": "123456",
		})
	fmt.Println(x, err)
}

query

package main

import (
	"fmt"

	"github.com/tiantour/alidayu/sms"
)

func init() {
	sms.AppKey = "xxx"
	sms.AppSecret = "xxx"
	sms.Sign = "xxx"
}
func main() {
	x, err := sms.NewQuery().Do(
		"18910315767",
		"20170524",
		1,
		10,
	)
	fmt.Println(x, err)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AppKey appkey
	AppKey string

	// AppSecret appsecret
	AppSecret string

	// Sign sign
	Sign string
)

Functions

This section is empty.

Types

type Detail

type Detail struct {
	Extend          string `json:"extend"`            // 公共回传参数
	RecNum          string `json:"rec_num"`           // 短信接收号码
	ResultCode      string `json:"result_code"`       // 短信错误码
	SMSCode         string `json:"sms_code"`          // 模板编码
	SMSContent      string `json:"sms_content"`       // 短信发送内容
	SMSReceiverTime string `json:"sms_receiver_time"` // 短信接收时间
	SMSSendTime     string `json:"sms_send_time"`     // 短信发送时间
	SMSStatus       int    `json:"sms_status"`        // 发送状态 1:等待回执,2:发送失败,3:发送成功
}

Detail detail

type Fail

type Fail struct {
	SubMsg  string `json:"sub_msg"`  // 错误信息
	SubCode string `json:"sub_code"` // 错误解释
	Code    int    `json:"code"`     // 错误代码
	Msg     string `json:"msg"`      // 错误描述
}

Fail fail

type Message

type Message struct {
	Phone    int64  `json:"phone"`    // 号码
	Template string `json:"template"` // 模板
	Body     []byte `json:"data"`     // 内容
	Date     string `json:"date"`     // 日期
	Page     int    `json:"page"`     // 页码
	Size     int    `json:"size"`     // 数量
}

Message message

func NewMessage

func NewMessage() *Message

NewMessage new message

func (*Message) Query

func (m *Message) Query(args *Message) (*Response, error)

Query query message

func (*Message) Send

func (m *Message) Send(args *Message) (*Response, error)

Send send

type Partner

type Partner struct {
	FcPartnerSmsDetailDto []Detail `json:"fc_partner_sms_detail_dto"`
}

Partner partner

type Query

type Query struct {
	BizID       string `json:"biz_id" url:"biz_id,omitempty"`             // 否 流水号
	RecNum      string `json:"rec_num" url:"rec_num,omitempty"`           // 是 手机号码
	QueryDate   string `json:"query_date" url:"query_date,omitempty"`     // 是 日期 20170525
	CurrentPage int    `json:"current_page" url:"current_page,omitempty"` // 是 页码
	PageSize    int    `json:"page_size" url:"page_size,omitempty"`       // 是 数量
	Request
}

Query query

type Request

type Request struct {
	Method       string `json:"method" url:"method,omitempty"`                 // 是 接口名称
	AppKey       string `json:"app_key" url:"app_key,omitempty"`               // 是 app key
	TargetAppKey string `json:"target_app_key" url:"target_app_key,omitempty"` // 否 第三方 app key
	SignMethod   string `json:"sign_method" url:"sign_method,omitempty"`       // 是 签名 md5 hmac
	Sign         string `json:"sign" url:"sign,omitempty"`                     // 是 签名
	Session      string `json:"session" url:"session,omitempty"`               // 否 授权
	Timestamp    string `json:"timestamp" url:"timestamp,omitempty"`           // 是 时间 字符串
	Format       string `json:"format" url:"format,omitempty"`                 // 否 响应格式
	V            string `json:"v" url:"v,omitempty"`                           // 是 版本 2.0
	PartnerID    string `json:"partner_id" url:"partner_id,omitempty"`         // 否 合伙伙伴
	Simplify     string `json:"simplify" url:"simplify,omitempty"`             // 否 精简json
}

Request request

type Response

type Response struct {
	AlibabaAliqinFcSmsNumSendResponse  Result `json:"alibaba_aliqin_fc_sms_num_send_response"`  // 正确
	AlibabaAliqinFcSmsNumQueryResponse Value  `json:"alibaba_aliqin_fc_sms_num_query_response"` //
	ErrResponse                        Fail   `json:"error_response"`                           // 错误
}

Response response

type Result

type Result struct {
	Result Success `json:"result"` // 结果
}

Result result

type SMS

type SMS struct{}

SMS sms

func NewSMS

func NewSMS() *SMS

NewSMS new sms

type Send

type Send struct {
	Extend          string `json:"extend" url:"extend,omitempty"`                         // 否 拓展 会员id
	SmsType         string `json:"sms_type" url:"sms_type,omitempty"`                     // 是 类型 normal
	SmsFreeSignName string `json:"sms_free_sign_name" url:"sms_free_sign_name,omitempty"` // 是 短信签名
	SmsParam        string `json:"sms_param" url:"sms_param,omitempty"`                   // 否 模板变量
	RecNum          string `json:"rec_num" url:"rec_num,omitempty"`                       // 是 接收号码,英文逗号分割,最大200
	SmsTemplateCode string `json:"sms_template_code" url:"sms_template_code,omitempty"`   // 是 模板ID
	Request
}

Send send

type Success

type Success struct {
	ErrCode string `json:"err_code"` // 返回错误
	Model   string `json:"model"`    // 返回结果
	Success bool   `json:"success"`  // 返回状态
	Msg     string `json:"message"`  // 返回描述
}

Success success

type Value

type Value struct {
	CurrentPage int     `json:"current_page"` // 当前页码
	PageSize    int     `json:"page_size"`    // 每页数量
	TotalCount  int     `json:"total_count"`  // 总量
	TotalPage   int     `json:"total_page"`   // 总页数
	Values      Partner `json:"values"`
}

Value value

Jump to

Keyboard shortcuts

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