Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

officeaccount 和 miniprogram 添加UseStableAK 配置项 #788

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

cyjaysong
Copy link

允许创建OfficialAccount和MiniProgram实例时直接使用StableAccessToken

@@ -34,7 +34,13 @@ type MiniProgram struct {

// NewMiniProgram 实例化小程序 API
func NewMiniProgram(cfg *config.Config) *MiniProgram {
defaultAkHandle := credential.NewDefaultAccessToken(cfg.AppID, cfg.AppSecret, credential.CacheKeyMiniProgramPrefix, cfg.Cache)
var defaultAkHandle credential.AccessTokenContextHandle
const cacheKeyPrefix = credential.CacheKeyMiniProgramPrefix
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用同一个key 有覆盖的可能吗?比如某处用了 UseStable 其他地方用了非 UseStable,这个key 是否区分一下呢?

Copy link
Author

@cyjaysong cyjaysong Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个跟key没关系。你至于你说的不同地方用的不一样我想应该不常见吧,单机应用的话,一般会全局一个单例,分布式部署的话即便是非StableAK,开发者也得考虑多机共享ak,对于微信来说,无论你有多少个模块,它只允许你只有一个ak。所以跟这个无关

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants