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

实现access_token获取

This commit is contained in:
wenzl
2016-09-11 13:16:15 +08:00
parent 33f2b2ef60
commit d9075933c1
7 changed files with 195 additions and 4 deletions

View File

@@ -2,7 +2,9 @@ package wechat
import (
"net/http"
"sync"
"github.com/silenceper/wechat/cache"
"github.com/silenceper/wechat/context"
"github.com/silenceper/wechat/server"
)
@@ -18,6 +20,7 @@ type Config struct {
AppSecret string
Token string
EncodingAESKey string
Cache cache.Cache
}
//NewWechat init
@@ -32,6 +35,8 @@ func copyConfigToContext(cfg *Config, context *context.Context) {
context.AppSecret = cfg.AppSecret
context.Token = cfg.Token
context.EncodingAESKey = cfg.EncodingAESKey
context.Cache = cfg.Cache
context.SetAccessTokenLock(new(sync.RWMutex))
}
//GetServer init