Cannot read property 'then' of undefined
来源:5-4 第五天 微信菜单-生成菜单
杰克大叔
2016-06-20
在执行deleteMenu()的时候,deleteMenu()里面的then错误,这是为什么?
Wechat.prototype.deleteMenu = function(){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.menu.del + 'access_token=' + data.access_token request({method: 'GET', url: url, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Get menu fails') } }) .catch(function(err){ reject(err) }) }) }) }
'use strict' var config = require('../config') var Wechat = require('../wechat/wechat') var menu = require('./menu') var wechatApi = new Wechat(config.wechat) var path = require('path') wechatApi.deleteMenu().then(function(){ return wechatApi.createMenu(menu) }) .then(function(msg){ console.log(msg) }) exports.reply = function* (next){ var message = this.weixin if (message.MsgType === 'event') { if (message.Event === 'subscribe') { if (message.EventKey) { console.log('扫描二维码进来的:' + message.EventKey + '' + message.ticket) } this.body = '哈哈,你订阅了微信号' } else if (message.Event === 'unsubscribe') { console.log('无情取关') this.body = '' } else if (message.Event === 'LOCATION') { this.body = '您上报的位置是:' + message.Latitude + '/' + message.Longitude + '-' + message.Precision } else if (message.Event === 'CLICK') { this.body = '您点击了菜单:' + message.EventKey } else if (message.Event === 'SCAN') { console.log('关注后扫二维码' + message.EventKey + ' ' + message.ticket) this.body = '看到你扫了一下哦' } else if (message.Event === 'VIEW') { this.body = '您点击了菜单中的链接:' + message.EventKey } else if (message.Event === 'scancode_push') { console.log(message.ScanCodeInfo.ScanType) console.log(message.ScanCodeInfo.ScanResult) this.body = '您点击了菜单中的链接:' + message.EventKey } else if (message.Event === 'scancode_waitmsg') { console.log(message.ScanCodeInfo.ScanType) console.log(message.ScanCodeInfo.ScanResult) this.body = '您点击了菜单中的链接:' + message.EventKey } else if (message.Event === 'pic_sysphoto') { console.log(message.SendPicsInfo.PicList) console.log(message.SendPicsInfo.Count) this.body = '您点击了菜单中的链接:' + message.EventKey } else if (message.Event === 'pic_photo_or_album') { console.log(message.SendPicsInfo.PicList) console.log(message.SendPicsInfo.Count) this.body = '您点击了菜单中的链接:' + message.EventKey } else if (message.Event === 'pic_weixin') { console.log(message.SendPicsInfo.PicList) console.log(message.SendPicsInfo.Count) this.body = '您点击了菜单中的链接:' + message.EventKey } else if (message.Event === 'location_select') { console.log(message.SendLocationInfo.Location_X) console.log(message.SendLocationInfo.Location_Y) console.log(message.SendLocationInfo.Scale) console.log(message.SendLocationInfo.Label) console.log(message.SendLocationInfo.Poiname) console.log(message.SendPicsInfo.Count) this.body = '您点击了菜单中的链接:' + message.EventKey } } else if (message.MsgType === 'text') { var content = message.Content var reply = '额,你说的“' + message.Content + '”太复杂了,我不懂。' if (content === '1') { reply = '天下第一吃大米' console.log(message) } else if (content === '2') { reply = '天下第一吃豆腐' } else if (content === '3') { reply = '天下第一吃仙丹' } else if (content === '张杨海是谁') { reply = '张' } else if (content === '4') { reply = [{ title: '技术改变世界', description: '只是个描述而已', picUrl: 'http://tu.dytt.com/20160426054059859.jpg', url:'http://virjay.com' }] } else if (content === '5') { var data = yield wechatApi.uploadMaterial('image', path.join(__dirname, '../2.jpg')) reply = { type: 'image', mediaId: data.media_id } } else if (content === '6') { var data = yield wechatApi.uploadMaterial('video', path.join(__dirname, '../6.mp4')) reply = { type: 'video', title: '蝙蝠侠:黑暗骑士', description: '蝙蝠侠与小丑的故事...', mediaId: data.media_id } } else if (content === '7') { var data = yield wechatApi.uploadMaterial('image', path.join(__dirname, '../2.jpg')) reply = { type: 'music', title: '音悦台', description: '放松一下...', musicUrl: 'http://virjay.com/7.mp3', thumbMediaId: data.media_id } } else if (content === '8') { var data = yield wechatApi.uploadMaterial('image', path.join(__dirname, '../2.jpg'),{type: 'image'}) reply = { type: 'image', mediaId: data.media_id } } else if (content === '9') { var data = yield wechatApi.uploadMaterial('image', path.join(__dirname, '../6.mp4'),{type: 'video', description: '{"title":"batman", "introduction": "batman..."}'}) reply = { type: 'video', title: '蝙蝠侠:黑暗骑士', description: '蝙蝠侠与小丑的故事...', mediaId: data.media_id } } else if (content === '10') { var picData = yield wechatApi.uploadMaterial('image', path.join(__dirname, '../2.jpg'),{}) var media = { articles: [{ title: 'tututu', thumb_media_id: picData.media_id, author: 'virjay', digest: '没有摘要', show_cover_pic: 1, content: '没有内容', content_source_url: 'http://www.virjay.com' },{ title: 'tututu2', thumb_media_id: picData.media_id, author: 'virjay', digest: '没有摘要', show_cover_pic: 1, content: '没有内容', content_source_url: 'http://www.virjay.com' }] } data = yield wechatApi.uploadMaterial('news', media, {}) data = yield wechatApi.fetchMaterial(data.media_id, 'news', {}) console.log(data) var items = data.news_item var news = [] items.forEach(function(items){ news.push({ title: items.title, description: items.digest, picUrl: picData.url, url: items.url }) }) reply = news } else if (content === '11') { var counts = yield wechatApi.countMaterial() console.log(JSON.stringify(counts)) var results = yield [ wechatApi.batchMaterial({ type: 'image', offset: 0, count: 10 }), wechatApi.batchMaterial({ type: 'video', offset: 0, count: 10 }), wechatApi.batchMaterial({ type: 'voice', offset: 0, count: 10 }), wechatApi.batchMaterial({ type: 'news', offset: 0, count: 10 }) ] console.log(JSON.stringify(results)) reply = '1' } else if (content === '12') { // var group = yield wechatApi.createGroup('wechat') // console.log('新分组 wechat:') // console.log(group) // var groups = yield wechatApi.fetchGroups() // console.log('加了 wechat 后的分组列表:') // console.log(groups) var group2 = yield wechatApi.checkGroup(message.FromUserName) console.log('查看自己的分组') console.log(group2) // var result = yield wechatApi.moveGroup(message.FromUserName,100) // console.log('移动到分组100') // console.log(result) // var result2 = yield wechatApi.moveGroup([message.FromUserName],101) // console.log('批量移动到分组101') // console.log(result2) var result3 = yield wechatApi.updateGroup(101, 'Custom') console.log('重命名结果:') console.log(result3) var groups3 = yield wechatApi.fetchGroups() console.log('更新后的分组列表:') console.log(groups3) // var result4 = yield wechatApi.deleteGroup(100) // console.log('删除100分组:') // console.log(result4) // var groups4 = yield wechatApi.fetchGroups() // console.log('更新后的分组列表:') // console.log(groups4) reply = 'Group done!' } else if (content === '13') { var user = yield wechatApi.fetchUsers(message.FromUserName, 'zh_CN') console.log(user) var openIds = [ { openid: message.FromUserName, lang: 'zh_CN' } ] var users = yield wechatApi.fetchUsers(openIds) console.log(users) reply = JSON.stringify(user) } else if (content === '14') { var userlist = yield wechatApi.listUsers() console.log(userlist) reply = userlist.total } else if (content === '15') { var mpnews = { media_id: 'eSjpAvdDK68FjK2nRbbq5zXB_hzzICx8TJ8wn3-Io7s' } var test = { 'content' : 'test' } var msgData = yield wechatApi.sendByGroup('image', mpnews, 101) console.log(msgData) reply = 'Yeah!' } else if (content === '16') { var mpnews = { media_id: 'eSjpAvdDK68FjK2nRbbq5zXB_hzzICx8TJ8wn3-Io7s' } // var test = { // 'content' : 'test' // } var msgData = yield wechatApi.previewMass('image', mpnews, 'oO2E0wZFvj4hcDAcwTc5NE79Ib04') console.log(msgData) reply = 'Yeah!' } else if (content === '17') { var msgData = yield wechatApi.checkMass('6297401665371273792') console.log(msgData) reply = 'Yeah!' } this.body = reply } yield next }
写回答
5回答
-
Scott
2016-06-22
把 response.body 换成 response[1] 试试,看看是不是这里的版本导致的问题。
我用你的代码模拟,
Unhandled rejection Error: Get menu fails at /Users/black/scott/wechat-movie-for-test/wechat/wechat.js:861:7
代码是在这里出了错误:
var url = api.menu.del + 'access_token=' + data.access_token request({url: url, json: true}).then(function(response){
我把 response.body 换成 response[1] 后就 ok 了,再检查下 app.js 里面引入的 reply 中间件是不是这一份文件。
012016-06-22 -
Scott
2016-06-21
把 wechat.js 这个构造函数的代码全部贴出来看一下,看是不是哪里少了 return
012016-06-21 -
小七努力变大牛
2016-08-27
我也是这边出问题了.... 找了好久 也木有看到... 麻烦能告诉一下 到底是哪里出问题了么?
00 -
杰克大叔
提问者
2016-06-21
'user strict' var Promise = require('bluebird') var _ = require('lodash') var request = Promise.promisify(require('request')) var util = require('./util') var fs = require('fs') var prefix = 'https://api.weixin.qq.com/cgi-bin/' var api = { accessToken: prefix + 'token?grant_type=client_credential', temporary: { upload: prefix + 'media/upload?', fetch: prefix + 'media/get?' }, permanent: { upload: prefix + 'material/add_material?', fetch : prefix + 'material/get_material?', uploadNews: prefix + 'material/add_news?', uploadNewsPic: prefix + 'media/uploadimg?', del: prefix + 'material/del_material?', update: prefix + 'material/update_news?', count: prefix + 'material/get_materialcount?', batch: prefix + 'material/batchget_material?' }, group: { create: prefix + 'groups/create?', fetch: prefix + 'groups/get?', check: prefix + 'groups/getid?', update: prefix + 'groups/update?', move: prefix + 'groups/members/update?', batchupdate: prefix + 'groups/members/batchupdate?',//移动分组 del: prefix + 'groups/delete?' }, user: { remark: prefix + 'user/info/updateremark?', fetch: prefix + 'user/info?', batchFetch: prefix + 'user/info/batchget?', list: prefix + 'user/get?' }, mass: { group: prefix + 'message/mass/sendall?', openId: prefix + 'message/mass/send?', del : prefix + 'message/mass/delete?', preview: prefix + 'message/mass/preview?', check: prefix + 'message/mass/get?' }, menu: { create: prefix + 'menu/create?', get: prefix + 'menu/get?', del: prefix + 'menu/delete?', current: prefix + 'get_current_selfmenu_info?' } } function Wechat(opts){ var that = this this.appID = opts.appID this.appSecret = opts.appSecret this.getAccessToken = opts.getAccessToken this.saveAccessToken = opts.saveAccessToken this.fetchAccessToken() } Wechat.prototype.fetchAccessToken = function(data){ var that = this if (this.access_token && this.expires_in) { if (this.isValidAccessToken(this)) { return Promise.resolve(this) } } return this.getAccessToken() .then(function(data){ try{ data = JSON.parse(data) } catch(e){ return that.updateAccessToken(data) } if (that.isValidAccessToken(data)) { return Promise.resolve(data) } else{ return that.updateAccessToken() } }) .then(function(data){ that.access_token = data.access_token that.expires_in = data.expires_in that.saveAccessToken(data) return Promise.resolve(data) }) } Wechat.prototype.isValidAccessToken = function(data){ if (!data || !data.access_token || !data.expires_in) { return false } var access_token = data.access_token var expires_in = data.expires_in var now = (new Date().getTime()) if (now < expires_in) { return true } else{ return false } } Wechat.prototype.updateAccessToken = function(data){ var appID = this.appID var appSecret = this.appSecret var url = api.accessToken + '&appid=' + appID + '&secret=' + appSecret return new Promise(function(resolve, reject){ request({url: url, json: true}).then(function(response){ var data = response.body var now = (new Date().getTime()) var expires_in = now + (data.expires_in - 20) * 1000 data.expires_in = expires_in resolve(data) }) }) } Wechat.prototype.uploadMaterial = function(type, material, permanent){ var that = this var form = {} var uploadUrl = api.temporary.upload if (permanent) { uploadUrl = api.permanent.upload _.extend(form, permanent) } if (type === 'pic') { uploadUrl = api.permanent.uploadNewsPic } if (type === 'news') { uploadUrl = api.permanent.uploadNews form = material } else{ form.media = fs.createReadStream(material) } return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = uploadUrl + 'access_token=' + data.access_token if (!permanent) { url += '&type=' + type } else { form.access_token = data.access_token } var options = { method : 'POST', url: url, json: true } if (type === 'news') { options.body = form } else{ options.formData = form } request(options).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Upload material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.fetchMaterial = function(mediaId, type, permanent){ var that = this var fetchUrl = api.temporary.fetch if (permanent) { fetchUrl = api.permanent.fetch } return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = fetchUrl + 'access_token=' + data.access_token + '&media_id=' + mediaId var form = {} var options = {method: 'POST', url: url, json: true} if (permanent) { form.media_id = mediaId form.access_token = data.access_token options.body = form } else{ if (type === 'video') { url = url.replace('https','http') } url += '&media_id' + mediaId } if (type === 'news' || type === 'video') { request(options).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('fetch material fails') } }) .catch(function(err){ reject(err) }) } else{ resolve(url) } }) }) } Wechat.prototype.deleteMaterial = function(mediaId){ var that = this var form = { media_id: mediaId } return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.permanent.del + 'access_token=' + data.access_token + '&media_id=' + mediaId request({method: 'POST', url: url,body: form, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Delete material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.updateMaterial = function(mediaId, news){ var that = this var form = { media_id: mediaId } _.extend(form, news) return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.permanent.update + 'access_token=' + data.access_token + '&media_id=' + mediaId request({method: 'POST', url: url,body: form, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Update material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.countMaterial = function(){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.permanent.count + 'access_token=' + data.access_token request({method: 'GET', url: url,json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Count material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.batchMaterial = function(options){ var that = this options.type = options.type || 'image' options.offset = options.offset || 0 options.count = options.count || 1 return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.permanent.batch + 'access_token=' + data.access_token request({method: 'POST', url: url, body: options, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Batch material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.createGroup = function(name){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.group.create + 'access_token=' + data.access_token var form = { group: { name: name } } request({method: 'POST', url: url, body: form, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('CreateGroup material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.fetchGroups = function(name){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.group.fetch + 'access_token=' + data.access_token request({url: url, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('fetchGroup material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.checkGroup = function(openId){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.group.check + 'access_token=' + data.access_token var form = { openid: openId } console.log(form) request({method: 'POST', url: url, body: form, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('checkGroup material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.updateGroup = function(id, name){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.group.update + 'access_token=' + data.access_token var form = { group: { id: id, name: name } } console.log(url) console.log(form) request({method: 'POST', url: url, body: form, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('updateGroup material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.moveGroup = function(openIds, to){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url var form ={ to_groupid: to } if (_.isArray(openIds)) { url = api.group.batchupdate + 'access_token=' + data.access_token form.openid_list = openIds } else{ url = api.group.move + 'access_token=' + data.access_token form.openid = openIds } request({method: 'POST', url: url, body: form, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Move Group material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.deleteGroup = function(id){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ url = api.group.del + 'access_token=' + data.access_token var form ={ group: { id: id } } request({method: 'POST', url: url, body: form, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Delete group material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.remarkUser = function(openId, remark){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ url = api.user.remark + 'access_token=' + data.access_token var form ={ openid: openId, remark: remark } request({method: 'POST', url: url, body: form, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Remark group material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.fetchUsers = function(openIds, lang){ var that = this var lang = lang || 'zh_CN' return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var options = { json: true } if (_.isArray(openIds)) { options.url = api.user.batchFetch + 'access_token=' + data.access_token options.body ={ user_list: openIds } options.method = 'POST' } else{ options.url = api.user.fetch + 'access_token=' + data.access_token + '&openid=' + openIds + '&lang=' + lang } request(options).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('batchFetchUsers material fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.listUsers = function(openId){ var that = this var lang = lang || 'zh_CN' return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.user.list + 'access_token=' + data.access_token if (openId) { url += '&next_openid=' + openId } request({url: url, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('ListUsers fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.sendByGroup = function(type, message, groupId){ var that = this var msg = { filter: {}, msgtype: type } msg[type] = message if (!groupId) { msg.filter.is_to_all = true } else{ msg.filter.is_to_all = false, msg.filter = { is_to_all : false, group_id : groupId } } return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.mass.group + 'access_token=' + data.access_token request({method: 'POST', url: url, body: msg, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Send to group fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.sendByOpenId = function(type, message, openIds){ var that = this var msg = { msgtype: type, touser: openIds } msg[type] = message return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.mass.openId + 'access_token=' + data.access_token request({method: 'POST', url: url, body: msg, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Send ID to group fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.deleteMass = function(msgId){ return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.mass.del + 'access_token=' + data.access_token var form = { msg_id: msgId } request({method: 'POST', url: url, body: form, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Delete ID to group fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.previewMass = function(type, message, openId){ var that = this var msg = { msgtype: type, touser: openId } msg[type] = message return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.mass.preview + 'access_token=' + data.access_token request({method: 'POST', url: url, body: msg, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Delete ID to group fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.checkMass = function(msgId){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.mass.check + 'access_token=' + data.access_token var form = { msg_id: msgId } request({method: 'POST', url: url, body: form, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('checkMass ID to group fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.createMenu = function(menu){ var that = this console.log(menu) return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.menu.create + 'access_token=' + data.access_token request({method: 'POST', url: url, body: menu, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Create menu fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.getMenu = function(){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.menu.get + 'access_token=' + data.access_token request({url: url, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Get menu fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.deleteMenu = function(){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.menu.del + 'access_token=' + data.access_token request({url: url, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Get menu fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.getCurrentMenu = function(){ var that = this return new Promise(function(resolve, reject){ that .fetchAccessToken() .then(function(data){ var url = api.menu.current + 'access_token=' + data.access_token request({url: url, json: true}).then(function(response){ var _data = response.body if (_data) { resolve(_data) } else{ throw new Error('Get current menu fails') } }) .catch(function(err){ reject(err) }) }) }) } Wechat.prototype.reply = function(){ var content = this.body var message = this.weixin var xml = util.tpl(content, message) this.status = 200 this.type = 'application/xml' this.body = xml } module.exports = Wechat
00 -
yql
2016-06-20
仔细看视频,有个地方写漏掉了,我也遇到过,看能不能找到哪里漏了
032016-08-07
相似问题