...
|
...
|
@@ -48,13 +48,12 @@ class FileController extends Context { |
|
|
});
|
|
|
}
|
|
|
|
|
|
let fileData = {
|
|
|
fileData: req.body.files
|
|
|
};
|
|
|
|
|
|
if (req.body.bucket) {
|
|
|
fileData.project = req.body.bucket;
|
|
|
this.api.upload("http://upload.static.yohobuy.com", fileData).then(result => {
|
|
|
if (req.body.bucket === 'goodsimg') {
|
|
|
this.api.upload("http://upload.static.yohobuy.com", {
|
|
|
fileData: req.body.files,
|
|
|
project: req.body.bucket
|
|
|
}).then(result => {
|
|
|
if (result.code === 200 && _.get(result, 'data.imagesList.length', 0)) {
|
|
|
result.data.imagesList = _.map(result.data.imagesList, imgUrl => {
|
|
|
return this.fileService.getAbsoluteUrl(imgUrl, req.body.bucket);
|
...
|
...
|
@@ -63,11 +62,20 @@ class FileController extends Context { |
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
} else {
|
|
|
this.api.upload(apiDomain.platform.upload, fileData).then(result => {
|
|
|
this.api.upload(apiDomain.platform.uploads, {
|
|
|
files: req.body.files,
|
|
|
bucket: req.body.bucket
|
|
|
}).then(result => {
|
|
|
let newResult = {
|
|
|
code: result.code,
|
|
|
data: {},
|
|
|
message: result.message
|
|
|
};
|
|
|
|
|
|
if (result.code === 200) {
|
|
|
result.data.imagesList = [result.data];
|
|
|
newResult.data.imagesList = [result.data[0]];
|
|
|
}
|
|
|
res.json(result);
|
|
|
res.json(newResult);
|
|
|
}).catch(next);
|
|
|
}
|
|
|
}
|
...
|
...
|
|