response

package
v0.0.0-...-4877452 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

被动响应消息.

Index

Constants

View Source
const (
	MsgTypeText  = "text"  // 文本消息
	MsgTypeImage = "image" // 图片消息
	MsgTypeVoice = "voice" // 语音消息
	MsgTypeVideo = "video" // 视频消息
	MsgTypeNews  = "news"  // 图文消息
)
View Source
const (
	NewsArticleCountLimit = 10 // 被动回复图文消息的文章数据最大数
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	Title       string `xml:"Title,omitempty"       json:"Title,omitempty"`       // 图文消息标题
	Description string `xml:"Description,omitempty" json:"Description,omitempty"` // 图文消息描述
	PicURL      string `xml:"PicUrl,omitempty"      json:"PicUrl,omitempty"`      // 图片链接,支持JPG、PNG格式,较好的效果为大图360*200,小图200*200
	URL         string `xml:"Url,omitempty"         json:"Url,omitempty"`         // 点击图文消息跳转链接
}

type CommonMessageHeader

type CommonMessageHeader struct {
	ToUserName   string `xml:"ToUserName"   json:"ToUserName"`
	FromUserName string `xml:"FromUserName" json:"FromUserName"`
	CreateTime   int64  `xml:"CreateTime"   json:"CreateTime"`
	MsgType      string `xml:"MsgType"      json:"MsgType"`
}

type Image

type Image struct {
	XMLName struct{} `xml:"xml" json:"-"`
	CommonMessageHeader

	Image struct {
		MediaId string `xml:"MediaId" json:"MediaId"` // 图片文件id,可以调用上传媒体文件接口获取
	} `xml:"Image" json:"Image"`
}

func NewImage

func NewImage(to, from string, timestamp int64, mediaId string) (image *Image)

type News

type News struct {
	XMLName struct{} `xml:"xml" json:"-"`
	CommonMessageHeader

	ArticleCount int       `xml:"ArticleCount"            json:"ArticleCount"` // 图文条数,默认第一条为大图。图文数不能超过10,否则将会无响应
	Articles     []Article `xml:"Articles>item,omitempty" json:"Articles,omitempty"`
}

func NewNews

func NewNews(to, from string, timestamp int64, articles []Article) (news *News)

func (*News) CheckValid

func (news *News) CheckValid() (err error)

检查 News 是否有效,有效返回 nil,否则返回错误信息

type Text

type Text struct {
	XMLName struct{} `xml:"xml" json:"-"`
	CommonMessageHeader

	Content string `xml:"Content" json:"Content"` // 文本消息内容
}

func NewText

func NewText(to, from string, timestamp int64, content string) (text *Text)

type Video

type Video struct {
	XMLName struct{} `xml:"xml" json:"-"`
	CommonMessageHeader

	Video struct {
		MediaId     string `xml:"MediaId"               json:"MediaId"`               // 视频文件id,可以调用上传媒体文件接口获取
		Title       string `xml:"Title,omitempty"       json:"Title,omitempty"`       // 视频消息的标题
		Description string `xml:"Description,omitempty" json:"Description,omitempty"` // 视频消息的描述
	} `xml:"Video" json:"Video"`
}

func NewVideo

func NewVideo(to, from string, timestamp int64, mediaId, title, description string) (video *Video)

type Voice

type Voice struct {
	XMLName struct{} `xml:"xml" json:"-"`
	CommonMessageHeader

	Voice struct {
		MediaId string `xml:"MediaId" json:"MediaId"` // 语音文件id,可以调用上传媒体文件接口获取
	} `xml:"Voice" json:"Voice"`
}

func NewVoice

func NewVoice(to, from string, timestamp int64, mediaId string) (voice *Voice)

Jump to

Keyboard shortcuts

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