{"errcode":41005,"errmsg":"media data missing hint: 老师出现整个问题怎么解决啊?
来源:4-4 第四天 上传临时素材之图片和视频
慕粉1146045851
2016-10-19
var data = yield wechatApi.uploadMaterial('image',path.join(__dirname,'/2.jpg'));
console.log("weixin===="+data.MediaId);
//构建reply
reply={
type:'image',
MediaId:data.MediaId
};
console.log(reply);
打印出来的URL路径是:
https://api.weixin.qq.com/cgi-bin/media/upload?&access_token=ymTTMIV_30EBT0HAGkaznofDxp_SNsGlM0D4U_FB04Ep1ZfQQuzEq52dkn27z7qCt4Yr5ovuAxxyB5M_9NseO0r-hDOpnAElbJ6-yJdxgqWjfBMBqeudQ_sThmZtzUzOOTUgAGAKPQ&type=image
6回答
-
把回复的 xml 打印出来看下,看 xml 变量替换后的格式和数据对不对
022016-10-20 -
Scott
2016-10-20
formDate 拼错了,应该是 formData 吧
10 -
Scott
2016-10-20
<![CDATA[[object Object]]]>
这里替换不对吧,首先返回的不应该是 text 类型,其次这里不应该是 object ,而应该是 string 的具体值吧,比如 media_id,再调试调试看
00 -
Scott
2016-10-19
把上传之前 post 过去的 formdata 打印一下看看
00 -
慕粉1146045851
提问者
2016-10-20
改了formData后接口可以正常返回以下数据:
{ type: 'video',
media_id: 'jEVtLarrxNhlzUj02d5i9bsP0aYCgVf-uvr2Sn3WMmUOrxtiIiJC3vvaecTaqPPn',
created_at: 1476931463 }
但是微信上还是显示:公众号暂时无法提供服务号
012016-10-20 -
慕粉1146045851
提问者
2016-10-20
{ method: 'POST',
url: 'https://api.weixin.qq.com/cgi-bin/media/upload?&access_token=msP50lDSl8uHlcJBz9yksT0tp0_y4KGT2xRhFvimuLClJOaxidOPLcomOJKjeb32s0vD9jrFVy0SeFioRPKyInJDZXTa9tgEdPuDMJGcPK6o7nbf4rhoEm5jzN7YX1whDCJjABAZYF&type=video',
JSON: true,
formDate:
{ media:
ReadStream {
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_eventsCount: 1,
_maxListeners: undefined,
path: 'E:\\myRepos\\node-weixin\\material\\6.mp4',
fd: null,
flags: 'r',
mode: 438,
start: undefined,
end: undefined,
autoClose: true,
pos: undefined } } }
012017-12-30
相似问题