mass2users

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: 4 Imported by: 0

Documentation

Overview

根据OpenID列表群发消息.

Index

Constants

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

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 {
	ToUser  []string `json:"touser,omitempty"` // 长度不能超过 ToUserCountLimit
	MsgType string   `json:"msgtype"`
}

func (*CommonMessageHeader) CheckValid

func (header *CommonMessageHeader) CheckValid() (err error)

type Image

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

func NewImage

func NewImage(toUser []string, mediaId string) *Image

type News

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

图文消息

func NewNews

func NewNews(toUser []string, 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(toUser []string, content string) *Text

type Video

type Video struct {
	CommonMessageHeader
	Video struct {
		MediaId     string `json:"media_id"`
		Title       string `json:"title,omitempty"`
		Description string `json:"description,omitempty"`
	} `json:"video"`
}

func NewVideo

func NewVideo(toUser []string, mediaId, title, description string) *Video

新建视频消息.

NOTE:
MediaId 应该通过 media.Client.CreateVideo 得到;
title, description 可以为空.

type Voice

type Voice struct {
	CommonMessageHeader
	Voice struct {
		MediaId string `json:"media_id"` // mediaId 通过上传多媒体文件得到
	} `json:"voice"`
}

func NewVoice

func NewVoice(toUser []string, mediaId string) *Voice

Jump to

Keyboard shortcuts

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