|
@@ -48,13 +48,12 @@ class FileController extends Context { |
|
@@ -48,13 +48,12 @@ class FileController extends Context { |
48
|
});
|
48
|
});
|
49
|
}
|
49
|
}
|
50
|
|
50
|
|
51
|
- let fileData = {
|
|
|
52
|
- fileData: req.body.files
|
|
|
53
|
- };
|
|
|
54
|
|
51
|
|
55
|
- if (req.body.bucket) {
|
|
|
56
|
- fileData.project = req.body.bucket;
|
|
|
57
|
- this.api.upload("http://upload.static.yohobuy.com", fileData).then(result => {
|
52
|
+ if (req.body.bucket === 'goodsimg') {
|
|
|
53
|
+ this.api.upload("http://upload.static.yohobuy.com", {
|
|
|
54
|
+ fileData: req.body.files,
|
|
|
55
|
+ project: req.body.bucket
|
|
|
56
|
+ }).then(result => {
|
58
|
if (result.code === 200 && _.get(result, 'data.imagesList.length', 0)) {
|
57
|
if (result.code === 200 && _.get(result, 'data.imagesList.length', 0)) {
|
59
|
result.data.imagesList = _.map(result.data.imagesList, imgUrl => {
|
58
|
result.data.imagesList = _.map(result.data.imagesList, imgUrl => {
|
60
|
return this.fileService.getAbsoluteUrl(imgUrl, req.body.bucket);
|
59
|
return this.fileService.getAbsoluteUrl(imgUrl, req.body.bucket);
|
|
@@ -63,11 +62,20 @@ class FileController extends Context { |
|
@@ -63,11 +62,20 @@ class FileController extends Context { |
63
|
res.json(result);
|
62
|
res.json(result);
|
64
|
}).catch(next);
|
63
|
}).catch(next);
|
65
|
} else {
|
64
|
} else {
|
66
|
- this.api.upload(apiDomain.platform.upload, fileData).then(result => {
|
65
|
+ this.api.upload(apiDomain.platform.uploads, {
|
|
|
66
|
+ files: req.body.files,
|
|
|
67
|
+ bucket: req.body.bucket
|
|
|
68
|
+ }).then(result => {
|
|
|
69
|
+ let newResult = {
|
|
|
70
|
+ code: result.code,
|
|
|
71
|
+ data: {},
|
|
|
72
|
+ message: result.message
|
|
|
73
|
+ };
|
|
|
74
|
+
|
67
|
if (result.code === 200) {
|
75
|
if (result.code === 200) {
|
68
|
- result.data.imagesList = [result.data];
|
76
|
+ newResult.data.imagesList = [result.data[0]];
|
69
|
}
|
77
|
}
|
70
|
- res.json(result);
|
78
|
+ res.json(newResult);
|
71
|
}).catch(next);
|
79
|
}).catch(next);
|
72
|
}
|
80
|
}
|
73
|
}
|
81
|
}
|