...
|
...
|
@@ -3,33 +3,38 @@ var fs = require('fs'); |
|
|
var domain = require('../../config/common.js').domain;
|
|
|
//var domain = 'http://172.16.6.227:8083/yohobuy-platform-web'; //马力
|
|
|
//var domain = 'http://192.168.102.202:8088/platform';
|
|
|
<<<<<<< HEAD
|
|
|
var domain = 'http://172.16.6.240:8088/platform';
|
|
|
=======
|
|
|
//var domain = 'http://172.16.6.240:8088/platform';
|
|
|
//var domain = 'http://172.16.6.240:8088/platform'; //王书生
|
|
|
//var domain = 'http://172.16.6.162:8088/platform'; //李建
|
|
|
>>>>>>> ab68be0c67e4456aa77357afd5d64fc8218d2b69
|
|
|
var env = process.env.NODE_ENV || 'development';
|
|
|
|
|
|
exports.uploadFile = function(req, res) {
|
|
|
|
|
|
// TODO 代理上传
|
|
|
// 方法1
|
|
|
<<<<<<< HEAD
|
|
|
if(req.is("multipart/form-data")){
|
|
|
req.body.file=fs.createReadStream(req.files[req.body.filename].path);
|
|
|
if(req.body.__type=="batch-import"){
|
|
|
request.post({url:domain+'/batch/import',formData:req.body},function optionalCallback(err, httpResponse, body){
|
|
|
<< << << < HEAD
|
|
|
if (req.is("multipart/form-data")) {
|
|
|
req.body.file = fs.createReadStream(req.files[req.body.filename].path);
|
|
|
if (req.body.__type == "batch-import") {
|
|
|
request.post({
|
|
|
url: domain + '/batch/import',
|
|
|
formData: req.body
|
|
|
}, function optionalCallback(err, httpResponse, body) {
|
|
|
res.json(JSON.parse(body));
|
|
|
});
|
|
|
}else{
|
|
|
request.post({url:domain+'/fileupload/upload',formData:req.body},function optionalCallback(err, httpResponse, body){
|
|
|
} else {
|
|
|
request.post({
|
|
|
url: domain + '/fileupload/upload',
|
|
|
formData: req.body
|
|
|
}, function optionalCallback(err, httpResponse, body) {
|
|
|
res.json(JSON.parse(body));
|
|
|
});
|
|
|
}
|
|
|
}else{
|
|
|
res.json({code:"500",message:"请求类型错误"});
|
|
|
=======
|
|
|
} else {
|
|
|
res.json({
|
|
|
code: "500",
|
|
|
message: "请求类型错误"
|
|
|
}); === === =
|
|
|
if (req.is("multipart/form-data")) {
|
|
|
req.body.file = fs.createReadStream(req.files[req.body.filename].path);
|
|
|
if (req.body.__type == "batch-import") {
|
...
|
...
|
@@ -51,9 +56,8 @@ exports.uploadFile = function(req, res) { |
|
|
res.json({
|
|
|
code: "500",
|
|
|
message: "请求类型错误"
|
|
|
});
|
|
|
>>>>>>> ab68be0c67e4456aa77357afd5d64fc8218d2b69
|
|
|
}); >>> >>> > ab68be0c67e4456aa77357afd5d64fc8218d2b69
|
|
|
}
|
|
|
//
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|