mass2all

package
v0.0.0-...-7011273 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

群发消息给所有用户.

Index

Constants

View Source
const (
	MsgTypeText  = "text"
	MsgTypeImage = "image"
	MsgTypeVoice = "voice"
	MsgTypeVideo = "mpvideo"
	MsgTypeNews  = "mpnews"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*mp.WechatClient
}

func NewClient

func NewClient(AccessTokenServer mp.AccessTokenServer, httpClient *http.Client) Client

兼容保留, 建議實際項目全局維護一個 *mp.WechatClient

func (Client) SendImage

func (clt Client) SendImage(msg *Image) (msgid int64, err error)

func (Client) SendNews

func (clt Client) SendNews(msg *News) (msgid int64, err error)

func (Client) SendText

func (clt Client) SendText(msg *Text) (msgid int64, err error)

func (Client) SendVideo

func (clt Client) SendVideo(msg *Video) (msgid int64, err error)

func (Client) SendVoice

func (clt Client) SendVoice(msg *Voice) (msgid int64, err error)

type CommonMessageHeader

type CommonMessageHeader struct {
	Filter struct {
		IsToAll bool `json:"is_to_all"`
	} `json:"filter"`
	MsgType string `json:"msgtype"`
}

type Image

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

func NewImage

func NewImage(mediaId string) *Image

type News

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

图文消息

func NewNews

func NewNews(mediaId string) *News

新建图文消息

NOTE: mediaId 应该通过 media.Client.CreateNews 得到

type Text

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

func NewText

func NewText(content string) *Text

type Video

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

func NewVideo

func NewVideo(mediaId string) *Video

新建视频消息

NOTE: mediaId 应该通过 media.Client.CreateVideo 得到

type Voice

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

func NewVoice

func NewVoice(mediaId string) *Voice

Jump to

Keyboard shortcuts

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