1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-04 12:52:27 +08:00

符合gilint规范

This commit is contained in:
wenzl
2016-09-19 20:00:01 +08:00
parent 6a8dc6c3ea
commit 85fa02b00d
5 changed files with 19 additions and 17 deletions

View File

@@ -22,8 +22,8 @@ type Context struct {
//accessTokenLock 读写锁 同一个AppID一个
accessTokenLock *sync.RWMutex
//jsapiTicket 读写锁 同一个AppID一个
jsApiTicketLock *sync.RWMutex
//jsAPITicket 读写锁 同一个AppID一个
jsAPITicketLock *sync.RWMutex
}
// Query returns the keyed url query value if it exists
@@ -41,11 +41,12 @@ func (ctx *Context) GetQuery(key string) (string, bool) {
return "", false
}
//SetJsApiTicket 设置jsApiTicket的lock
func (ctx *Context) SetJsApiTicketLock(lock *sync.RWMutex) {
ctx.jsApiTicketLock = lock
//SetJsAPITicketLock 设置jsAPITicket的lock
func (ctx *Context) SetJsAPITicketLock(lock *sync.RWMutex) {
ctx.jsAPITicketLock = lock
}
func (ctx *Context) GetJsApiTicketLock() *sync.RWMutex {
return ctx.jsApiTicketLock
//GetJsAPITicketLock 获取jsAPITicket 的lock
func (ctx *Context) GetJsAPITicketLock() *sync.RWMutex {
return ctx.jsAPITicketLock
}

View File

@@ -63,8 +63,8 @@ func (js *Js) GetConfig(uri string) (config *Config, err error) {
//getTicket 获取jsapi_tocket全局缓存
func (js *Js) getTicket() (ticketStr string, err error) {
js.GetJsApiTicketLock().Lock()
defer js.GetJsApiTicketLock().Unlock()
js.GetJsAPITicketLock().Lock()
defer js.GetJsAPITicketLock().Unlock()
//先从cache中取
jsAPITicketCacheKey := fmt.Sprintf("jsapi_ticket_%s", js.AppID)

View File

@@ -80,13 +80,13 @@ type MixMessage struct {
URL string `xml:"Url"`
//事件相关
Event string `xml:"Event"`
EventKey string `xml:"EventKey"`
Ticket string `xml:"Ticket"`
Latitude string `xml:"Latitude"`
Longitude string `xml:"Longitude"`
Precision string `xml:"Precision"`
MenuID string `xml:"MenuId"`
Event EventType `xml:"Event"`
EventKey string `xml:"EventKey"`
Ticket string `xml:"Ticket"`
Latitude string `xml:"Latitude"`
Longitude string `xml:"Longitude"`
Precision string `xml:"Precision"`
MenuID string `xml:"MenuId"`
ScanCodeInfo struct {
ScanType string `xml:"ScanType"`

View File

@@ -1,5 +1,6 @@
package util
//CommonError 微信返回的通用错误json
type CommonError struct {
ErrCode int64 `json:"errcode"`
ErrMsg string `json:"errmsg"`

View File

@@ -41,7 +41,7 @@ func copyConfigToContext(cfg *Config, context *context.Context) {
context.EncodingAESKey = cfg.EncodingAESKey
context.Cache = cfg.Cache
context.SetAccessTokenLock(new(sync.RWMutex))
context.SetJsApiTicketLock(new(sync.RWMutex))
context.SetJsAPITicketLock(new(sync.RWMutex))
}
//GetServer 消息管理