weapp
weapp copied to clipboard
access_token 缓存 key 有计划放开自定义吗?
系统中有调用多个小程序需求,能放开自定义,或者 key里面加上 appid
func (cli *Client) tokenCacheKey() string {
return fmt.Sprintf("weapp.access.token.%s", cli.appid)
}
这个应该可以
package main
import (
"github.com/medivhzhan/weapp/v3"
)
func main() {
tokenGetter := func() (token string, expireIn uint) {
expireIn = 1000
token = "your-custom-token"
return token, expireIn
}
sdk := weapp.NewClient(
"your-appid",
"your-secret",
weapp.WithAccessTokenSetter(tokenGetter),
)
}
v3.6.4 版本也已经把appid加入缓存key
好的,感谢!