为了账号安全,请及时绑定邮箱和手机立即绑定

node.js第二天的this是什么意思?

node.js第二天的this是什么意思?

macheng617 2016-08-28 22:40:28
'use strict'var Promise = require('bluebird')var request = Promise.promisify(require('request'))var util = require('./util')var prefix = 'https://api.weixin.qq.com/cgi-bin/'var api = { accessToken: prefix + 'token?grant_type=client_credential'}function Wechat(opts) { var that = this this.appID = opts.appID this.appSecret = opts.appSecret this.getAccessToken = opts.getAccessToken this.saveAccessToken = opts.saveAccessToken this.getAccessToken() .then(function(data) { try { data = JSON.parse(data) } catch(e) { return that.updataAccessToken() } if (that.isValidAccessToken(data)) { Promise.resolve(data) } }) .then(function(data) { that.access_token = data.access_token that.expires_in = data.expires_in that.saveAccessToken(data) })}this.appID中的this是指哪个= =?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1671 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信