Showing
1 changed file
with
21 additions
and
17 deletions
@@ -3,33 +3,38 @@ var fs = require('fs'); | @@ -3,33 +3,38 @@ var fs = require('fs'); | ||
3 | var domain = require('../../config/common.js').domain; | 3 | var domain = require('../../config/common.js').domain; |
4 | //var domain = 'http://172.16.6.227:8083/yohobuy-platform-web'; //马力 | 4 | //var domain = 'http://172.16.6.227:8083/yohobuy-platform-web'; //马力 |
5 | //var domain = 'http://192.168.102.202:8088/platform'; | 5 | //var domain = 'http://192.168.102.202:8088/platform'; |
6 | -<<<<<<< HEAD | ||
7 | -var domain = 'http://172.16.6.240:8088/platform'; | ||
8 | -======= | 6 | +//var domain = 'http://172.16.6.240:8088/platform'; |
9 | //var domain = 'http://172.16.6.240:8088/platform'; //王书生 | 7 | //var domain = 'http://172.16.6.240:8088/platform'; //王书生 |
10 | //var domain = 'http://172.16.6.162:8088/platform'; //李建 | 8 | //var domain = 'http://172.16.6.162:8088/platform'; //李建 |
11 | ->>>>>>> ab68be0c67e4456aa77357afd5d64fc8218d2b69 | ||
12 | var env = process.env.NODE_ENV || 'development'; | 9 | var env = process.env.NODE_ENV || 'development'; |
13 | 10 | ||
14 | exports.uploadFile = function(req, res) { | 11 | exports.uploadFile = function(req, res) { |
15 | 12 | ||
16 | // TODO 代理上传 | 13 | // TODO 代理上传 |
17 | // 方法1 | 14 | // 方法1 |
18 | -<<<<<<< HEAD | ||
19 | - if(req.is("multipart/form-data")){ | ||
20 | - req.body.file=fs.createReadStream(req.files[req.body.filename].path); | ||
21 | - if(req.body.__type=="batch-import"){ | ||
22 | - request.post({url:domain+'/batch/import',formData:req.body},function optionalCallback(err, httpResponse, body){ | 15 | + << << << < HEAD |
16 | + if (req.is("multipart/form-data")) { | ||
17 | + req.body.file = fs.createReadStream(req.files[req.body.filename].path); | ||
18 | + if (req.body.__type == "batch-import") { | ||
19 | + request.post({ | ||
20 | + url: domain + '/batch/import', | ||
21 | + formData: req.body | ||
22 | + }, function optionalCallback(err, httpResponse, body) { | ||
23 | res.json(JSON.parse(body)); | 23 | res.json(JSON.parse(body)); |
24 | }); | 24 | }); |
25 | - }else{ | ||
26 | - request.post({url:domain+'/fileupload/upload',formData:req.body},function optionalCallback(err, httpResponse, body){ | 25 | + } else { |
26 | + request.post({ | ||
27 | + url: domain + '/fileupload/upload', | ||
28 | + formData: req.body | ||
29 | + }, function optionalCallback(err, httpResponse, body) { | ||
27 | res.json(JSON.parse(body)); | 30 | res.json(JSON.parse(body)); |
28 | }); | 31 | }); |
29 | } | 32 | } |
30 | - }else{ | ||
31 | - res.json({code:"500",message:"请求类型错误"}); | ||
32 | -======= | 33 | + } else { |
34 | + res.json({ | ||
35 | + code: "500", | ||
36 | + message: "请求类型错误" | ||
37 | + }); === === = | ||
33 | if (req.is("multipart/form-data")) { | 38 | if (req.is("multipart/form-data")) { |
34 | req.body.file = fs.createReadStream(req.files[req.body.filename].path); | 39 | req.body.file = fs.createReadStream(req.files[req.body.filename].path); |
35 | if (req.body.__type == "batch-import") { | 40 | if (req.body.__type == "batch-import") { |
@@ -51,9 +56,8 @@ exports.uploadFile = function(req, res) { | @@ -51,9 +56,8 @@ exports.uploadFile = function(req, res) { | ||
51 | res.json({ | 56 | res.json({ |
52 | code: "500", | 57 | code: "500", |
53 | message: "请求类型错误" | 58 | message: "请求类型错误" |
54 | - }); | ||
55 | ->>>>>>> ab68be0c67e4456aa77357afd5d64fc8218d2b69 | 59 | + }); >>> >>> > ab68be0c67e4456aa77357afd5d64fc8218d2b69 |
56 | } | 60 | } |
57 | // | 61 | // |
58 | 62 | ||
59 | -} | ||
63 | + } |
-
Please register or login to post a comment