...
|
...
|
@@ -55,22 +55,24 @@ const uploadImg = (req, res, next) => { |
|
|
file: f,
|
|
|
uid: req.user.uid.toString(),
|
|
|
method: 'yoho.fileupload'
|
|
|
}).then(result => {
|
|
|
if (result.code !== 200) {
|
|
|
return Promise.reject(Error('上传出错'));
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
});
|
|
|
})
|
|
|
).then(result => {
|
|
|
const images = result.reduce((t, r) => {
|
|
|
if (r && r.data && r.code === 200) {
|
|
|
t.push(utils.getUploadImgAbsoluteUrl(_.get(r, 'data'), req.body.bucket));
|
|
|
}
|
|
|
const data = result.reduce((t, r) => {
|
|
|
t.images.push(utils.getUploadImgAbsoluteUrl(_.get(r, 'data'), req.body.bucket));
|
|
|
t.imageList.push(_.get(r, 'data'));
|
|
|
return t;
|
|
|
}, []);
|
|
|
}, { images: [], imageList: [] });
|
|
|
|
|
|
res.json({
|
|
|
code: 200,
|
|
|
data: {
|
|
|
images,
|
|
|
imageList: images
|
|
|
},
|
|
|
data,
|
|
|
message: '上传成功'
|
|
|
});
|
|
|
}).catch(next);
|
...
|
...
|
|