mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-12 08:42:28 +08:00
将小程序获取ak的方式也抽象出来
This commit is contained in:
@@ -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}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user