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
要bind this,要不然,里边的this 指向的是oAuth
new OAuth(app.appid, app.secret, ctx.service.wechat.getToken.bind(this), ctx.service.wechat.setToken.bind(this), true);
// service/wechatToken.js
async getToken(openid) { const res = await this.ctx.model.WechatToken.findOne({ openid }); return res; } async setToken(openid, token) { // 有则更新,无则添加 var query = { openid: openid }; var options = { upsert: true }; await this.ctx.model.WechatToken.update(query, token, options); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
要bind this,要不然,里边的this 指向的是oAuth
// service/wechatToken.js
The text was updated successfully, but these errors were encountered: