core

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

微信公众号核心库

Index

Constants

View Source
const (
	AccessTokenURL              = "https://api.weixin.qq.com/cgi-bin/token"
	AccessTokenCachePrefix      = "wechat_mp_access_token_appid_"
	AccessTokenThirdCachePrefix = "wechat_mp_access_token_third_appid_"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenInfo

type AccessTokenInfo struct {
	util.WxError
	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
}

type Context

type Context struct {
	AppID            string
	AppSecret        string
	Token            string
	EncodingAESKey   string
	PayMchId         string
	PayNotifyUrl     string
	PayKey           string
	ThirdAccessToken bool

	CacheModel string      //缓存模式
	Cache      cache.Cache //缓存
	WXLog      flog.LoggerInterface
	ProxyUrl   string //代理地址

	Writer  http.ResponseWriter
	Request *http.Request
	// contains filtered or unexported fields
}

func (*Context) GetAccessToken

func (ctx *Context) GetAccessToken() (accessToken string, err error)

func (*Context) GetAccessTokenFromServer

func (ctx *Context) GetAccessTokenFromServer() (accessToken string, err error)

从微信服务器获取token

func (*Context) GetAccessTokenLock

func (ctx *Context) GetAccessTokenLock() *sync.RWMutex

func (*Context) GetJsAPITicketLock

func (ctx *Context) GetJsAPITicketLock() *sync.RWMutex

获取lock

func (*Context) GetQuery

func (ctx *Context) GetQuery(key string) (string, bool)

获取URL参数值,并返回是否存在key

func (*Context) Query

func (ctx *Context) Query(key string) string

获取RUL参数值

func (*Context) Render

func (ctx *Context) Render(bytes []byte)

render from bytes

func (*Context) ResponseXML

func (ctx *Context) ResponseXML(obj interface{}) string

func (*Context) SetAccessTokenLock

func (ctx *Context) SetAccessTokenLock(lock *sync.RWMutex)

func (*Context) SetJsAPITicketLock

func (ctx *Context) SetJsAPITicketLock(lock *sync.RWMutex)

设置lock

func (*Context) SetThirdAccessToken

func (ctx *Context) SetThirdAccessToken(thirdAccessToken string, expires int) (wxError util.WxError, err error)

设置共享的accessToken

func (*Context) String

func (ctx *Context) String(str string)

render from string

func (*Context) XML

func (ctx *Context) XML(obj interface{})

render to xml

Jump to

Keyboard shortcuts

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