云服务器security.msgSecCheck躺坑
云函数: // 云函数入口文件 const cloud = require('wx-server-sdk') cloud.init() // 云函数入口函数 exports.main = async (event, context) => { try { const res = await cloud.openapi.security.imgSecCheck({ media: { contentType: 'image/png', value: event.img } }) return res; } catch (err) { return err; } } 本地函数: wx.chooseImage({count: 1}).then((res) => { if(!res.tempFilePaths[0]){ return; } if (res.tempFiles[0] && res.tempFiles[0].size > 1024 * 1024) { wx.showToast({ title: '图片不能大于1M', icon: 'none' }) return; } wx.request({url:res.tempFilePaths[0],responseType: 'arraybuffer'}).then( buffer=>{ wx.cloud.callFunction({ name: 'checkImg', data: { img:buffer.data } }).then( imgRes=>{ console.log(JSON.stringify(imgRes)) } ) } ) }) 返回值: {"errMsg":"cloud.callFunction:ok","result":{"errCode":41005,"errMsg":"openapi.security.imgSecCheck:fail media data missing hint: [5MWz.a01394870]"},"requestID":"31101ae7-adf9-11e9-a24c-525400b2c41b"} 好难以理解啊,该做的工作都做了,各种尝试,就是无法拿到正常的返回数据,请各位大佬点评,哪里写错了,我改.....