weixin

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Wechat

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

func NewWechat

func NewWechat(tokenRefreshTime int64, cache cache.Provider, logger log.Logger) *Wechat

func (*Wechat) AddBatchReceivingAdapter

func (w *Wechat) AddBatchReceivingAdapter(ad interface{}) *Wechat

AddBatchReceivingAdapter 批量设置回调消息处理引擎

func (*Wechat) AddMiniProgram

func (w *Wechat) AddMiniProgram(cfg mini.MiniProgramConfig) *mini.MiniProgram

AddMiniProgram 增加小程序实例

func (*Wechat) AddOfficialAccounts

AddOfficialAccounts 增加公众号实例

func (*Wechat) AddOfficialAccountsReceivingAdapter

func (w *Wechat) AddOfficialAccountsReceivingAdapter(ora offiaccount.OfficialAccountsReceivingAdapter) *Wechat

AddOfficialAccountsReceivingAdapter 批量设置公众号回调消息处理引擎

func (*Wechat) AddReceivingAdapter

func (w *Wechat) AddReceivingAdapter(a common.Adapter) *Wechat

AddReceivingAdapter 增加回调信息处理适配器

func (*Wechat) AddThirdPlatform

func (w *Wechat) AddThirdPlatform(cfg open.ThirdPlatformConfig) *open.ThirdPlatform

AddThirdPlatform 增加第三方平台处理实例

func (*Wechat) AddThirdPlatformAdapter

func (w *Wechat) AddThirdPlatformAdapter(tra open.ThirdPlatformAdapter) *Wechat

AddThirdPlatformAdapter 批量设置第三方平台回调消息处理引擎

func (*Wechat) Callback

func (w *Wechat) Callback(openId, appId string, extra map[string]string, req *http.Request) (str string, err error)

Callback 获取微信回调的信息 概述 当关注者与已授权公众号/小程序进行交互时,第三方平台将接收到相应的消息推送、事件推送。由于第三方平台一般帮助众多公众号/小程序进行业务运营,所以为了加强安全性,微信服务器将对此过程进行 2 个措施:

在接收已授权公众号消息和事件的URL中,增加2个参数(此前已有 2 个参数,为时间戳 timestamp,随机数 nonce),分别是 encrypt_type(加密类型,为 aes)和 msg_signature(消息体签名,用于验证消息体的正确性) postdata 中的 XML 体,将使用第三方平台申请时的接收消息的加密 symmetric_key(也称为 EncodingAESKey)来进行加密。 ok 是否正确返回 msgSignature 加密后信息 timestamp 签名时间 noce 随机数

func (*Wechat) CheckRefreshToken

func (w *Wechat) CheckRefreshToken(appId string) bool

CheckRefreshToken 检测是否需要刷新token,返回true代表token已经过期

func (*Wechat) Crypter

func (w *Wechat) Crypter(appId string) *common.WeChatThirdCrypter

Crypter 根据appId获取加密引擎

func (*Wechat) MiniProgram

func (w *Wechat) MiniProgram(appId string) (bool, *mini.MiniProgram)

MiniProgram 根据appId获取公众号实例

func (*Wechat) OfficialAccounts

func (w *Wechat) OfficialAccounts(appId string) (bool, *offiaccount.OfficialAccounts)

OfficialAccounts 根据appId获取公众号实例

func (*Wechat) OfficialAccountsCallback

func (w *Wechat) OfficialAccountsCallback(openId, appId string, extra map[string]string, req *http.Request) (string, error)

OfficialAccountsCallback 处理公众号回调事件

func (*Wechat) ThirdPlatform

func (w *Wechat) ThirdPlatform(appId string) (bool, *open.ThirdPlatform)

ThirdPlatform 根据appId获取三方平台实例

func (*Wechat) ThirdPlatformAuthorization

func (w *Wechat) ThirdPlatformAuthorization(req *http.Request) (ok bool, aim open.AuthorizationInfoModel)

ThirdPlatformAuthorization 处理小程序或者公众号授权给第三方平台的技术实现流程仅适用于平台型第三方平台

func (*Wechat) ThirdPlatformAuthorizationUrl

func (w *Wechat) ThirdPlatformAuthorizationUrl(appId string) (bool, string)

ThirdPlatformAuthorizationUrl 生成第三方平台(为服务商型)为“微信公众号授权”或者“小程序授权”授权页网址

func (*Wechat) ThirdPlatformCallback

func (w *Wechat) ThirdPlatformCallback(req *http.Request, extra map[string]string) (string, error)

ThirdPlatformCallback 处理第三方平台回调事件解密回调的信息 为了加强安全性,post data 中的 xml 将使用服务申请时的加解密 key 来进行加密,具体请见《加密解密技术方案》(https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Message_Encryption/Technical_Plan.html), 在收到推送后需进行解密(详细请见《消息加解密接入指引》https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Message_Encryption/Message_encryption_and_decryption.html)。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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