context

package
v0.0.0-...-cdf81b2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//AccessTokenURL 获取access_token的接口
	AccessTokenURL = "https://api.weixin.qq.com/cgi-bin/token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	AppID          string
	AppSecret      string
	Token          string
	EncodingAESKey string

	Cache cache.Cache

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

Context struct

func (*Context) GetAccessToken

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

GetAccessToken 获取access_token

func (*Context) GetAccessTokenFromServer

func (ctx *Context) GetAccessTokenFromServer() (resAccessToken ResAccessToken, err error)

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

func (*Context) GetJsAPITicketLock

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

GetJsAPITicketLock 获取jsAPITicket 的lock

func (*Context) GetQuery

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

GetQuery is like Query(), it returns the keyed url query value

func (*Context) Query

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

Query returns the keyed url query value if it exists

func (*Context) Render

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

Render render from bytes

func (*Context) SetAccessTokenLock

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

SetAccessTokenLock 设置读写锁(一个appID一个读写锁)

func (*Context) SetJsAPITicketLock

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

SetJsAPITicketLock 设置jsAPITicket的lock

func (*Context) String

func (ctx *Context) String(str string)

String render from string

func (*Context) XML

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

XML render to xml

type ResAccessToken

type ResAccessToken struct {
	util.CommonError

	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
}

ResAccessToken struct

Jump to

Keyboard shortcuts

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