that .fetchAccessToken().then错误
来源:4-4 第四天 上传临时素材之图片和视频
qq_十五人五_0
2016-05-05
Wechat.prototype.uploadMaterial = function(type,filepath){
var that=this;
var form={
media: fs.createReadStream(filepath)
}
return new Promise(function(resolve,reject){//
that.fetchAccesstionToken()
.then(function(data){//102 行
var url=api.upload+'access_token='+data.access_token+'&type='+type;//
request({method:'POST',url:url,formData:form,json:true})
.then(function(response){
var data=response.body;
if(data){
resolve(data)
}else{
throw new Error("Upload fails mertial")
}
})
.catch(function(err){
reject(err);
})
})
})
}
写回答
1回答
-
应该是遇到这个同样的问题了:
http://coding.imooc.com/learn/questiondetail/204.html
112016-05-06
相似问题