wechat_oa

package module
v0.0.0-...-3f83fe3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 24 Imported by: 0

README

wechat_official_accounts

golang GitHub release pkg.go.dev MIT license

🔥 微信公众号 Go 🚀🚀🚀

使用

import "github.com/shenghui0779/wechat_oa"

Documentation

Index

Constants

View Source
const (
	CgiBinAccessTokenURL = "https://api.weixin.qq.com/cgi-bin/token"
	CgiBinTicketURL      = "https://api.weixin.qq.com/cgi-bin/ticket/getticket"
)

cgi-bin

View Source
const (
	MenuCreateURL            = "https://api.weixin.qq.com/cgi-bin/menu/create"
	MenuAddConditionalURL    = "https://api.weixin.qq.com/cgi-bin/menu/addconditional"
	MenuListURL              = "https://api.weixin.qq.com/cgi-bin/menu/get"
	MenuDeleteURL            = "https://api.weixin.qq.com/cgi-bin/menu/delete"
	MenuDeleteConditionalURL = "https://api.weixin.qq.com/cgi-bin/menu/delconditional"
)

menu

View Source
const (
	SnsCode2TokenURL         = "https://api.weixin.qq.com/sns/oauth2/access_token"
	SnsCheckAccessTokenURL   = "https://api.weixin.qq.com/sns/auth"
	SnsRefreshAccessTokenURL = "https://api.weixin.qq.com/sns/oauth2/refresh_token"
	SnsUserInfoURL           = "https://api.weixin.qq.com/sns/userinfo"
)

sns

View Source
const (
	SubscriberGetURL      = "https://api.weixin.qq.com/cgi-bin/user/info"
	SubscriberBatchGetURL = "https://api.weixin.qq.com/cgi-bin/user/info/batchget"
	SubscriberListURL     = "https://api.weixin.qq.com/cgi-bin/user/get"
	BlackListGetURL       = "https://api.weixin.qq.com/cgi-bin/tags/members/getblacklist"
	BatchBlackListURL     = "https://api.weixin.qq.com/cgi-bin/tags/members/batchblacklist"
	BatchUnBlackListURL   = "https://api.weixin.qq.com/cgi-bin/tags/members/batchunblacklist"
	UserRemarkSetURL      = "https://api.weixin.qq.com/cgi-bin/user/info/updateremark"
)

subscriber

View Source
const (
	MediaUploadURL         = "https://api.weixin.qq.com/cgi-bin/media/upload"
	MediaGetURL            = "https://api.weixin.qq.com/cgi-bin/media/get"
	MaterialNewsUploadURL  = "https://api.weixin.qq.com/cgi-bin/material/add_news"
	MaterialImageUploadURL = "https://api.weixin.qq.com/cgi-bin/media/uploadimg"
)

media

View Source
const DefaultReply = "success"

DefaultReply 公众号默认回复

View Source
const MaxSubscriberListCount = 10000

MaxSubscriberListCount 公众号订阅者列表的最大数目

View Source
const (
	TemplateMessageSendURL = "https://api.weixin.qq.com/cgi-bin/message/template/send"
)

message

Variables

This section is empty.

Functions

func DecodeBytesToUint32

func DecodeBytesToUint32(b []byte) uint32

DecodeBytesToUint32 从 4 字节的网络字节序里解析出整数 uint32

func EncodeUint32ToBytes

func EncodeUint32ToBytes(i uint32) []byte

EncodeUint32ToBytes 把整数 uint32 格式化成 4 字节的网络字节序

Types

type AESCBCCrypto

type AESCBCCrypto struct {
	// contains filtered or unexported fields
}

AESCBCCrypto aes-cbc crypto

func NewAESCBCCrypto

func NewAESCBCCrypto(key, iv []byte) *AESCBCCrypto

NewAESCBCCrypto returns new aes-cbc crypto

func (*AESCBCCrypto) Decrypt

func (c *AESCBCCrypto) Decrypt(cipherText []byte, mode AESPaddingMode) ([]byte, error)

Decrypt aes-cbc decrypt with PKCS#7 padding

func (*AESCBCCrypto) Encrypt

func (c *AESCBCCrypto) Encrypt(plainText []byte, mode AESPaddingMode) ([]byte, error)

Encrypt aes-cbc encrypt with PKCS#7 padding

type AESPaddingMode

type AESPaddingMode string

AESPaddingMode aes padding mode

const (
	// PKCS5 PKCS#5 padding mode
	PKCS5 AESPaddingMode = "PKCS#5"
	// PKCS7 PKCS#7 padding mode
	PKCS7 AESPaddingMode = "PKCS#7"
)

type AccessToken

type AccessToken struct {
	Token     string `json:"access_token"`
	ExpiresIn int64  `json:"expires_in"`
}

AccessToken 公众号普通AccessToken

type Action

type Action interface {
	Body() HTTPBody
	URL() func(accessToken string) string
	Decode() func(resp []byte) error
}

Action defines action

func BatchBlackList

func BatchBlackList(openids []string) Action

BatchBlackList 拉黑用户

func BatchGetSubscriberInfo

func BatchGetSubscriberInfo(openids []string, receiver *[]SubscriberInfo) Action

BatchGetSubscriberInfo 批量获取微信公众号订阅者信息

func BatchUnBlackList

func BatchUnBlackList(openids []string) Action

BatchUnBlackList 取消拉黑用户

func CheckAuthToken

func CheckAuthToken(openid string) Action

CheckAuthToken 校验网页授权AccessToken是否有效

func CreateConditionalMenu

func CreateConditionalMenu(matchRule *MenuMatchRule, buttons ...Button) Action

CreateConditionalMenu 个性化菜单

func CreateMenu

func CreateMenu(buttons ...Button) Action

CreateMenu 自定义菜单

func DeleteConditionalMenu

func DeleteConditionalMenu(menuID string) Action

DeleteConditional 删除个性化菜单

func DeleteMenu

func DeleteMenu() Action

Delete 删除自定义菜单

func GetAuthUser

func GetAuthUser(openid string, receiver *AuthUser) Action

GetAuthUser 获取授权微信用户信息(注意:使用网页授权的access_token)

func GetBlackList

func GetBlackList(beginOpenID string, receiver *SubscriberList) Action

GetBlackList 获取用户黑名单列表

func GetJSAPITicket

func GetJSAPITicket(receiver *JSAPITicket) Action

GetJSAPITicket 获取 jsapi ticket (注意:使用普通access_token)

func GetMenuList

func GetMenuList(receiver *MenuList) Action

GetMenuList 查询自定义菜单

func GetSubscriberInfo

func GetSubscriberInfo(openid string, receiver *SubscriberInfo) Action

GetSubscriberInfo 获取微信公众号订阅者信息

func GetSubscriberList

func GetSubscriberList(nextOpenID string, receiver *SubscriberList) Action

GetSubscriberList 获取微信公众号订阅者列表

func SendTemplateMessage

func SendTemplateMessage(msg *TemplateMessage) Action

SendTemplateMessage 发送模板消息

func SetUserRemark

func SetUserRemark(openid, remark string) Action

SetUserRemark 设置用户备注名(该接口暂时开放给微信认证的服务号)

func UploadMaterialImage

func UploadMaterialImage(filename string, receiver *MaterialUploadResult) Action

UploadMaterialImage 上传图文消息内的图片(不受公众号的素材库中图片数量的100000个的限制)

func UploadMaterialNews

func UploadMaterialNews(articles []*MaterialArticle, receiver *MaterialUploadResult) Action

UploadMaterialNews 上传永久图文素材(公众号的素材库保存总数量有上限:图文消息素材、图片素材上限为100000,其他类型为1000)

func UploadMedia

func UploadMedia(mediaType MediaType, filename string, receiver *MediaUploadResult) Action

UploadMedia 上传临时素材到微信服务器

type Article

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

Article 公众号图文

type AuthToken

type AuthToken struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int64  `json:"expires_in"`
	OpenID       string `json:"openid"`
	Scope        string `json:"scope"`
}

AuthToken 公众号网页授权Token

type AuthUser

type AuthUser struct {
	OpenID    string   `json:"openid"`
	UnionID   string   `json:"unionid"`
	Nickname  string   `json:"nickname"`
	Gender    int      `json:"sex"`
	Province  string   `json:"province"`
	City      string   `json:"city"`
	Country   string   `json:"country"`
	Avatar    string   `json:"headimgurl"`
	Privilege []string `json:"privilege"`
}

AuthUser 授权微信用户信息

type BatchSubscriberInfo

type BatchSubscriberInfo struct {
	UserInfoList []*SubscriberInfo `json:"user_info_list"`
}

BatchSubscriberInfo 微信公众号批量订阅者信息

type Button

type Button map[string]interface{}

Button 菜单按钮

func ClickButton

func ClickButton(name, key string) Button

ClickButton 点击事件按钮

func GroupButton

func GroupButton(name string, buttons ...Button) Button

GroupButton 组合按钮

func LocationSelectButton

func LocationSelectButton(name, key string) Button

LocationSelectButton 发送位置按钮

func MPButton

func MPButton(name, appid, pagePath, url string) Button

MPButton 小程序跳转按钮

func MediaButton

func MediaButton(name, mediaID string) Button

MediaButton 素材按钮

func PicPhotoOrAlbumButton

func PicPhotoOrAlbumButton(name, key string) Button

PicPhotoOrAlbum 拍照或者相册发图按钮

func PicSysphotoButton

func PicSysphotoButton(name, key string) Button

PicSysphotoButton 系统拍照发图按钮

func PicWeixinButton

func PicWeixinButton(name, key string) Button

PicWeixinButton 微信相册发图按钮

func ScancodePushButton

func ScancodePushButton(name, key string) Button

ScancodePushButton 扫码推事件按钮

func ScancodeWaitMsgButton

func ScancodeWaitMsgButton(name, key string) Button

ScancodeWaitMsgButton 扫码带提示按钮

func ViewButton

func ViewButton(name, url string) Button

ViewButton 跳转URL按钮

func ViewLimitedButton

func ViewLimitedButton(name, mediaID string) Button

ViewLimitedButton 图文消息按钮

type CDATA

type CDATA string

CDATA XML CDATA section which is defined as blocks of text that are not parsed by the parser, but are otherwise recognized as markup.

func (CDATA) MarshalXML

func (c CDATA) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML encodes the receiver as zero or more XML elements.

type ConditionalMenu

type ConditionalMenu struct {
	Button    []*MenuButton  `json:"button"`
	MenuID    int64          `json:"menuid"`
	MatchRule *MenuMatchRule `json:"matchrule"`
}

ConditionalMenu 个性化菜单

type DefaultMenu

type DefaultMenu struct {
	Button []*MenuButton `json:"button"`
	MenuID int64         `json:"menuid"`
}

DefaultMenu 默认菜单

type EventMessage

type EventMessage struct {
	ToUserName   string  `xml:"ToUserName"`
	FromUserName string  `xml:"FromUserName"`
	CreateTime   int64   `xml:"CreateTime"`
	MsgType      string  `xml:"MsgType"`
	MsgID        int64   `xml:"MsgId"`
	Content      string  `xml:"Content"`
	PicURL       string  `xml:"PicUrl"`
	MediaID      string  `xml:"MediaId"`
	Format       string  `xml:"Format"`
	Recognition  string  `xml:"Recognition"`
	ThumbMediaID string  `xml:"ThumbMediaId"`
	LocationX    float64 `xml:"Location_X"`
	LocationY    float64 `xml:"Location_Y"`
	Scale        int     `xml:"Scale"`
	Label        string  `xml:"Label"`
	Title        string  `xml:"Title"`
	Description  string  `xml:"Description"`
	URL          string  `xml:"Url"`
	Event        string  `xml:"Event"`
	EventKey     string  `xml:"EventKey"`
	Ticket       string  `xml:"Ticket"`
	Latitude     float64 `xml:"Latitude"`
	Longitude    float64 `xml:"Longitude"`
	Precision    float64 `xml:"Precision"`
}

EventMessage 微信公众号事件推送消息

type HTTPBody

type HTTPBody interface {
	FieldName() string
	FileName() string
	Bytes() func() ([]byte, error)
}

HTTPBody defines http body

type HTTPClient

type HTTPClient interface {
	Get(reqURL string, options ...HTTPOption) ([]byte, error)
	Post(reqURL string, body []byte, options ...HTTPOption) ([]byte, error)
}

func NewHTTPClient

func NewHTTPClient(tlsCfg ...*tls.Config) HTTPClient

NewHTTPClient returns a new http client

type HTTPOption

type HTTPOption interface {
	// contains filtered or unexported methods
}

HTTPOption configures how we set up the http request

func WithHTTPClose

func WithHTTPClose() HTTPOption

WithHTTPClose specifies close the connection after replying to this request (for servers) or after sending this request and reading its response (for clients).

func WithHTTPCookies

func WithHTTPCookies(cookies ...*http.Cookie) HTTPOption

WithHTTPCookies specifies the cookies to http request.

func WithHTTPHeader

func WithHTTPHeader(key, value string) HTTPOption

WithHTTPHeader specifies the headers to http request.

func WithHTTPTimeout

func WithHTTPTimeout(d time.Duration) HTTPOption

WithHTTPTimeout specifies the timeout to http request.

type ImageReply

type ImageReply struct {
	XMLName xml.Name `xml:"xml"`
	ReplyHeader
	Image struct {
		MediaID CDATA `xml:"MediaId"` // 通过素材管理接口上传多媒体文件得到 MediaId
	} `xml:"Image"`
}

ImageReply 公众号图片回复消息

func (*ImageReply) Bytes

func (r *ImageReply) Bytes(from, to string) ([]byte, error)

type JSAPITicket

type JSAPITicket struct {
	Ticket    string `json:"ticket"`
	ExpiresIn int64  `json:"expires_in"`
}

JSAPITicket 公众号 jsapi ticket

type MaterialArticle

type MaterialArticle struct {
	Title              string `json:"title"`
	ThumbMediaID       string `json:"thumb_media_id"`
	Author             string `json:"author"`
	Digest             string `json:"digest"`
	ShowCoverPic       string `json:"show_cover_pic"`
	Content            string `json:"content"`
	ContentSourceURL   string `json:"content_source_url"`
	NeedOpenComment    int    `json:"need_open_comment"`
	OnlyFansCanComment int    `json:"only_fans_can_comment"`
}

MaterialArticle 文章素材

type MaterialUploadResult

type MaterialUploadResult struct {
	MediaID string `json:"media_id"`
	URL     string `json:"url"`
}

MaterialUploadResult 永久素材上传结果

type MediaType

type MediaType string

MediaType 素材类型

var (
	// MediaImage 图片素材
	MediaImage MediaType = "image"
	// MediaVoice 音频素材
	MediaVoice MediaType = "voice"
	// MediaVideo 视频素材
	MediaVideo MediaType = "video"
	// MediaThumb 缩略图素材
	MediaThumb MediaType = "thumb"
)

type MediaUploadResult

type MediaUploadResult struct {
	Type      string `json:"type"`
	MediaID   string `json:"media_id"`
	CreatedAt int64  `json:"created_at"`
}

MediaUploadResult 临时素材上传结果

type MenuButton struct {
	Type      string        `json:"type"`
	Name      string        `json:"name"`
	Key       string        `json:"key,omitempty"`
	URL       string        `json:"url,omitempty"`
	AppID     string        `json:"appid,omitempty"`
	PagePath  string        `json:"page_path,omitempty"`
	MediaID   string        `json:"media_id,omitempty"`
	SubButton []*MenuButton `json:"sub_button,omitempty"`
}

MenuButton 菜单按钮

type MenuList struct {
	DefaultMenu     *DefaultMenu       `json:"menu"`
	ConditionalMenu []*ConditionalMenu `json:"conditionalmenu"`
}

MenuList 菜单列表

type MenuMatchRule struct {
	TagID              int64  `json:"tag_id"`
	Sex                int    `json:"sex"`
	Country            string `json:"country"`
	Province           string `json:"province"`
	City               string `json:"city"`
	ClientPlatformType int    `json:"client_platform_type"`
}

MenuMatchRule 菜单匹配规则

type MessageBody

type MessageBody map[string]map[string]string

MessageBody 消息内容体

type MusicReply

type MusicReply struct {
	XMLName xml.Name `xml:"xml"`
	ReplyHeader
	Music struct {
		Title        CDATA `xml:"Title,omitempty"`       // 音乐标题
		Description  CDATA `xml:"Description,omitempty"` // 音乐描述
		MusicURL     CDATA `xml:"MusicUrl,omitempty"`    // 音乐链接
		HQMusicURL   CDATA `xml:"HQMusicUrl,omitempty"`  // 高质量音乐链接, WIFI环境优先使用该链接播放音乐
		ThumbMediaID CDATA `xml:"ThumbMediaId"`          // 通过素材管理接口上传多媒体文件得到 ThumbMediaId
	} `xml:"Music"`
}

MusicReply 公众号音乐回复

func (*MusicReply) Bytes

func (r *MusicReply) Bytes(from, to string) ([]byte, error)

type NewsReply

type NewsReply struct {
	XMLName xml.Name `xml:"xml"`
	ReplyHeader
	ArticleCount int       `xml:"ArticleCount"`  // 图文消息个数, 限制为10条以内
	Articles     []Article `xml:"Articles>item"` // 多条图文消息信息, 默认第一个item为大图, 注意, 如果图文数超过10, 则将会无响应
}

NewsReply 公众号图文回复

func (*NewsReply) Bytes

func (r *NewsReply) Bytes(from, to string) ([]byte, error)

type PostBody

type PostBody struct {
	// contains filtered or unexported fields
}

PostBody implements http body

func (*PostBody) Bytes

func (b *PostBody) Bytes() func() ([]byte, error)

Bytes returns bytes closure

func (*PostBody) FieldName

func (b *PostBody) FieldName() string

FieldName returns multipart fieldname

func (*PostBody) FileName

func (b *PostBody) FileName() string

FileName returns multipart filename

type Reply

type Reply interface {
	Bytes(from, to string) ([]byte, error)
}

func NewArticleReply

func NewArticleReply(count int, articles ...Article) Reply

NewArticleReply returns article reply

func NewImageReply

func NewImageReply(mediaID string) Reply

NewImageReply returns image reply

func NewMusicReply

func NewMusicReply(mediaID, title, desc, url, HQUrl string) Reply

NewMusicReply returns music reply

func NewTextReply

func NewTextReply(content string) Reply

NewTextReply returns text reply

func NewTransfer2KFReply

func NewTransfer2KFReply(kfAccount ...string) Reply

NewTransfer2KFReply returns transfer to kf reply

func NewVideoReply

func NewVideoReply(mediaID, title, desc string) Reply

NewVideoReply returns video reply

func NewVoiceReply

func NewVoiceReply(mediaID string) Reply

NewVoiceReply returns voice reply

type ReplyHeader

type ReplyHeader struct {
	FromUserName CDATA `xml:"FromUserName"`
	ToUserName   CDATA `xml:"ToUserName"`
	CreateTime   int64 `xml:"CreateTime"`
	MsgType      CDATA `xml:"MsgType"`
}

ReplyHeader 公众号消息回复公共头

type ReplyMessage

type ReplyMessage struct {
	XMLName      xml.Name `xml:"xml"`
	Encrypt      CDATA    `xml:"Encrypt"`
	MsgSignature CDATA    `xml:"MsgSignature"`
	TimeStamp    int64    `xml:"TimeStamp"`
	Nonce        CDATA    `xml:"Nonce"`
}

ReplyMessage 公众号回复

type SubscriberInfo

type SubscriberInfo struct {
	Subscribe      int     `json:"subscribe"`
	OpenID         string  `json:"openid"`
	NickName       string  `json:"nickname"`
	Sex            int     `json:"sex"`
	Language       string  `json:"language"`
	City           string  `json:"city"`
	Province       string  `json:"province"`
	Country        string  `json:"country"`
	AvatarURL      string  `json:"headimgurl"`
	SubscribeTime  int64   `json:"subscribe_time"`
	UnionID        string  `json:"unionid"`
	Remark         string  `json:"remark"`
	GroupID        int64   `json:"groupid"`
	TagidList      []int64 `json:"tagid_list"`
	SubscribeScene string  `json:"subscribe_scene"`
	QRScene        int64   `json:"qr_scene"`
	QRSceneStr     string  `json:"qr_scene_str"`
}

SubscriberInfo 微信公众号订阅者信息

type SubscriberList

type SubscriberList struct {
	Total      int                 `json:"total"`
	Count      int                 `json:"count"`
	Data       *SubscriberListData `json:"data"`
	NextOpenID string              `json:"next_openid"`
}

SubscriberList 微信公众号订阅者列表

type SubscriberListData

type SubscriberListData struct {
	OpenID []string `json:"openid"`
}

SubscriberListData 微信公众号订阅者列表数据

type TemplateMessage

type TemplateMessage struct {
	OpenID      string      // 接收者(用户)的 openid
	TemplateID  string      // 模板ID
	RedirectURL string      // 模板跳转链接(海外帐号没有跳转能力)
	MPAppID     string      // 所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系,暂不支持小游戏)
	MPPagePath  string      // 所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar),要求该小程序已发布,暂不支持小游戏
	Data        MessageBody // 模板内容,格式形如:{"key1": {"value": any}, "key2": {"value": any}}
	Color       string      // 模板内容字体颜色,不填默认为黑色
}

TemplateMessage 公众号模板消息

type TextReply

type TextReply struct {
	XMLName xml.Name `xml:"xml"`
	ReplyHeader
	Content CDATA `xml:"Content"`
}

TextReply 公众号文本回复

func (*TextReply) Bytes

func (r *TextReply) Bytes(from, to string) ([]byte, error)

type TransInfo

type TransInfo struct {
	KfAccount CDATA `xml:"KfAccount"`
}

TransInfo 转发客服账号

type Transfer2KFReply

type Transfer2KFReply struct {
	XMLName xml.Name `xml:"xml"`
	ReplyHeader
	TransInfo *TransInfo `xml:"TransInfo,omitempty"`
}

Transfer2KFReply 公众号消息转客服

func (*Transfer2KFReply) Bytes

func (r *Transfer2KFReply) Bytes(from, to string) ([]byte, error)

type VideoReply

type VideoReply struct {
	XMLName xml.Name `xml:"xml"`
	ReplyHeader
	Video struct {
		MediaID     CDATA `xml:"MediaId"`               // 通过素材管理接口上传多媒体文件得到 MediaId
		Title       CDATA `xml:"Title,omitempty"`       // 视频消息的标题, 可以为空
		Description CDATA `xml:"Description,omitempty"` // 视频消息的描述, 可以为空
	} `xml:"Video" json:"Video"`
}

VideoReply 公众号视频回复

func (*VideoReply) Bytes

func (r *VideoReply) Bytes(from, to string) ([]byte, error)

type VoiceReply

type VoiceReply struct {
	XMLName xml.Name `xml:"xml"`
	ReplyHeader
	Voice struct {
		MediaID CDATA `xml:"MediaId"` // 通过素材管理接口上传多媒体文件得到 MediaId
	} `xml:"Voice"`
}

VoiceReply 公众号语音回复

func (*VoiceReply) Bytes

func (r *VoiceReply) Bytes(from, to string) ([]byte, error)

type WXClient

type WXClient struct {
	// contains filtered or unexported fields
}

func (*WXClient) Get

func (c *WXClient) Get(reqURL string, options ...HTTPOption) ([]byte, error)

func (*WXClient) Post

func (c *WXClient) Post(reqURL string, body []byte, options ...HTTPOption) ([]byte, error)

type WechatAPI

type WechatAPI struct {
	// contains filtered or unexported fields
}

WechatAPI implements action

func (*WechatAPI) Body

func (a *WechatAPI) Body() HTTPBody

Body returns http body

func (*WechatAPI) Decode

func (a *WechatAPI) Decode() func(resp []byte) error

Decode returns decode closure

func (*WechatAPI) URL

func (a *WechatAPI) URL() func(accessToken string) string

URL returns url closure

type WechatOA

type WechatOA struct {
	// contains filtered or unexported fields
}

WechatOA 微信公众号

func New

func New(appid, appsecret string) *WechatOA

New returns new WechatOA

func (*WechatOA) AccessToken

func (w *WechatOA) AccessToken(options ...HTTPOption) (*AccessToken, error)

AccessToken 获取普通AccessToken

func (*WechatOA) Code2AuthToken

func (w *WechatOA) Code2AuthToken(code string, options ...HTTPOption) (*AuthToken, error)

Code2AuthToken 获取公众号网页授权AccessToken

func (*WechatOA) DecryptEvent

func (w *WechatOA) DecryptEvent(cipherText string) (*EventMessage, error)

DecryptEvent 事件推送解密

func (*WechatOA) Do

func (w *WechatOA) Do(accessToken string, action Action, options ...HTTPOption) error

Do exec action

func (*WechatOA) EncryptReply

func (w *WechatOA) EncryptReply(from, to string, reply Reply) (*ReplyMessage, error)

EncryptReply 消息回复加密

func (*WechatOA) RefreshAuthToken

func (w *WechatOA) RefreshAuthToken(refreshToken string, options ...HTTPOption) (*AuthToken, error)

RefreshAuthToken 刷新网页授权AccessToken

func (*WechatOA) SetEncodingAESKey

func (w *WechatOA) SetEncodingAESKey(aesKey string)

SetEncodingAESKey 服务器配置EncodingAESKey

func (*WechatOA) SetSignToken

func (w *WechatOA) SetSignToken(token string)

SetSignToken 服务器配置Token

type X

type X map[string]interface{}

X is a convenient alias for a map[string]interface{}.

Jump to

Keyboard shortcuts

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