We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Pls Check
https://github.com/ArtisanCloud/PowerWeChat/releases/tag/v3.0.64
The text was updated successfully, but these errors were encountered:
你好 我在学习PowerWechat这个框架,看到了这个机制,目前PowerWechat存放的access_token是json格式,如果我需要修改成仅仅存储一个字符串。在实现GetCustomToken 的时候需要手动实现获取access_token的相关逻辑,不知道框架内是否有api可以直接调用,或者后续会增加相关的api吗? 谢谢
func InitClient() { cache := kernel.NewRedisClient(&kernel.UniversalOptions{ Addrs: []string{"127.0.0.1:6379"}, Password: "", DB: 0, }) client, _ := miniProgram.NewMiniProgram(&miniProgram.UserConfig{ AppID: "", Secret: "", HttpDebug: true, // 可选,不传默认走程序内存 Cache: cache, }) client.AccessToken.SetCacheKey("access_token") client.AccessToken.SetCustomToken = func(token *response.ResponseGetToken) interface{} { return token.AccessToken } client.AccessToken.GetCustomToken = func(key string, refresh bool) object.HashMap { if !refresh && cache.Has(key) { value, err := cache.Get(key, nil) if err == nil && value != nil { return object.HashMap{ "access_token": value, "expires_in": float64(7200), } } } // 请求access_token return object.HashMap{} } }
Sorry, something went wrong.
No branches or pull requests
Pls Check
https://github.com/ArtisanCloud/PowerWeChat/releases/tag/v3.0.64
The text was updated successfully, but these errors were encountered: