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

将小程序获取ak的方式也抽象出来

This commit is contained in:
silenceper
2020-05-25 22:00:51 +08:00
parent b599e93c5b
commit 972dec0406
5 changed files with 15 additions and 104 deletions

View File

@@ -24,10 +24,10 @@ type OfficialAccount struct {
//NewOfficialAccount 实例化公众号API
func NewOfficialAccount(cfg *config.Config) *OfficialAccount {
defaultAK := credential.NewDefaultAccessToken(cfg.AppID, cfg.AppSecret, credential.CacheKeyOfficialAccountPrefix, cfg.Cache)
defaultAkHandle := credential.NewDefaultAccessToken(cfg.AppID, cfg.AppSecret, credential.CacheKeyOfficialAccountPrefix, cfg.Cache)
ctx := &context.Context{
Config: cfg,
AccessTokenHandle: defaultAK,
AccessTokenHandle: defaultAkHandle,
}
return &OfficialAccount{ctx: ctx}
}