qiyewx

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// CacheKeyOfficialAccountPrefix 微信公众号cache key前缀
	CacheKeyOfficialAccountPrefix = "gowechat_officialaccount_"
	// CacheKeyMiniProgramPrefix 小程序cache key前缀
	CacheKeyMiniProgramPrefix = "gowechat_miniprogram_"
	// CacheKeyWorkPrefix 企业微信cache key前缀
	CacheKeyWorkPrefix = "gowechat_work_"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenHandle

type AccessTokenHandle interface {
	// GetAccessToken 直接换取accessToken(服务器对服务器应用)
	GetAccessToken() (accessToken string, err error)
}

func NewWorkAccessToken

func NewWorkAccessToken(opts ...Option) AccessTokenHandle

NewWorkAccessToken new WorkAccessToken

type BaseHandler

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

type CommonError

type CommonError struct {
	ErrCode int64  `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
	// contains filtered or unexported fields
}

type Option

type Option func(handler *BaseHandler)

func WithAuth

func WithAuth(appID string, appSecret string) Option

func WithCache

func WithCache(c cache.C) Option

type ResAccessToken

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

ResAccessToken struct

func GetTokenFromServer

func GetTokenFromServer(url string) (resAccessToken ResAccessToken, err error)

GetTokenFromServer 强制从微信服务器获取token

type WorkAccessToken

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

WorkAccessToken 企业微信AccessToken 获取

func (*WorkAccessToken) GetAccessToken

func (ak *WorkAccessToken) GetAccessToken() (accessToken string, err error)

GetAccessToken 企业微信获取access_token,先从cache中获取,没有则从服务端获取

Jump to

Keyboard shortcuts

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