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
频繁的读取不太好,可以试试缓存在内存里或者写在文件里
The text was updated successfully, but these errors were encountered:
通过access_token推送服务通知之后,还可以继续使用原来的access_token么?之前我试了会报失效,所以每次都重新获取。
access_token
如果支持多次使用的话,是可以放到内存或者文件里,但这属于业务或者框架的事情,跟本插件无关。
Sorry, something went wrong.
自己改下即可。
async getToken() { let token = await this.service.cache.get('access_token'); if (token) return token; const { appId, appSecret } = this.app.config.mp; const url = `${tokenUri}?grant_type=client_credential&appid=${appId}&secret=${appSecret}`; const res = await this.ctx.curl(url, { dataType: 'json', }); token = this.app._.get(res, 'data.access_token'); if (!token) throw new Error('获取公众号access_token失败'); this.service.cache.set('access_token', token, 7200 - 100); return token; }
No branches or pull requests
频繁的读取不太好,可以试试缓存在内存里或者写在文件里
The text was updated successfully, but these errors were encountered: