Help us shape the future of Go! Take the 2026 Go Developer Survey

context

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2018 License: Apache-2.0 Imports: 9 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
	PayMchID       string
	PayNotifyURL   string
	PayKey         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) GetQyAccessToken

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

GetQyAccessToken 获取access_token

func (*Context) GetQyAccessTokenFromServer

func (ctx *Context) GetQyAccessTokenFromServer() (resQyAccessToken ResQyAccessToken, err error)

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

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) SetQyAccessTokenLock

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

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

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

type ResQyAccessToken

type ResQyAccessToken struct {
	util.CommonError

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

ResQyAccessToken struct

Jump to

Keyboard shortcuts

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