preview

package
v0.0.0-...-683899a Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2016 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

预览消息.

Index

Constants

View Source
const (
	MsgTypeText   core.MsgType = "text"
	MsgTypeImage  core.MsgType = "image"
	MsgTypeVoice  core.MsgType = "voice"
	MsgTypeVideo  core.MsgType = "mpvideo"
	MsgTypeNews   core.MsgType = "mpnews"
	MsgTypeWxCard core.MsgType = "wxcard"
)

Variables

This section is empty.

Functions

func Send

func Send(clt *core.Client, msg interface{}) (err error)

Send 发送消息, msg 是经过 encoding/json.Marshal 得到的结果符合微信消息格式的任何数据结构.

Types

type Image

type Image struct {
	MsgHeader
	Image struct {
		MediaId string `json:"media_id"`
	} `json:"image"`
}

func NewImage

func NewImage(touser, mediaId string) *Image

func NewImage2

func NewImage2(towxname, mediaId string) *Image

type MsgHeader

type MsgHeader struct {
	ToWxName string       `json:"towxname,omitempty"`
	ToUser   string       `json:"touser,omitempty"`
	MsgType  core.MsgType `json:"msgtype"`
}

type News

type News struct {
	MsgHeader
	News struct {
		MediaId string `json:"media_id"`
	} `json:"mpnews"`
}

图文消息

func NewNews

func NewNews(touser, mediaId string) *News

新建图文消息

NOTE: 对于临时素材, mediaId 应该通过 media.UploadNews 得到

func NewNews2

func NewNews2(towxname, mediaId string) *News

新建图文消息

NOTE: 对于临时素材, mediaId 应该通过 media.UploadNews 得到

type Text

type Text struct {
	MsgHeader
	Text struct {
		Content string `json:"content"`
	} `json:"text"`
}

func NewText

func NewText(touser, content string) *Text

func NewText2

func NewText2(towxname, content string) *Text

type Video

type Video struct {
	MsgHeader
	Video struct {
		MediaId string `json:"media_id"`
	} `json:"mpvideo"`
}

func NewVideo

func NewVideo(touser, mediaId string) *Video

新建视频消息

NOTE: 对于临时素材, mediaId 应该通过 media.UploadVideo2 得到

func NewVideo2

func NewVideo2(towxname, mediaId string) *Video

新建视频消息

NOTE: 对于临时素材, mediaId 应该通过 media.UploadVideo2 得到

type Voice

type Voice struct {
	MsgHeader
	Voice struct {
		MediaId string `json:"media_id"`
	} `json:"voice"`
}

func NewVoice

func NewVoice(touser, mediaId string) *Voice

func NewVoice2

func NewVoice2(towxname, mediaId string) *Voice

type WxCard

type WxCard struct {
	MsgHeader
	WxCard struct {
		CardId  string `json:"card_id"`
		CardExt string `json:"card_ext,omitempty"`
	} `json:"wxcard"`
}

卡券消息

func NewWxCard

func NewWxCard(toUser, cardId, cardExt string) *WxCard

新建卡券, 特别注意: 目前该接口仅支持填入非自定义code的卡券和预存模式的自定义code卡券.

func NewWxCard2

func NewWxCard2(towxname, cardId, cardExt string) *WxCard

新建卡券, 特别注意: 目前该接口仅支持填入非自定义code的卡券和预存模式的自定义code卡券.

cardExt 可以为空

Jump to

Keyboard shortcuts

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