Authored by weiqingting

提交

@@ -256,7 +256,7 @@ var successList = null, @@ -256,7 +256,7 @@ var successList = null,
256 $('#upload-input').after('<div class="file-name btn btn-default">请选择文件</div>'); 256 $('#upload-input').after('<div class="file-name btn btn-default">请选择文件</div>');
257 common.edit.ajaxfileupload("#upload-input", { 257 common.edit.ajaxfileupload("#upload-input", {
258 params: { 258 params: {
259 - type: "price", 259 + type: "brandCooperation",
260 __type: "batch-import" 260 __type: "batch-import"
261 }, 261 },
262 onStart: function() { 262 onStart: function() {
@@ -15,36 +15,25 @@ exports.uploadFile = function(req, res) { @@ -15,36 +15,25 @@ exports.uploadFile = function(req, res) {
15 var ip = ipObject ? ipObject.join('.') : req.ip; 15 var ip = ipObject ? ipObject.join('.') : req.ip;
16 16
17 headers = { 17 headers = {
18 - 'x-user-id': req.session.user.pid,  
19 - 'x-user-name': req.session.user.account, 18 + 'x-user-id': req.session.user.auth.pid,
  19 + 'x-user-name': req.session.user.auth.account,
20 'x-site-type': 1, 20 'x-site-type': 1,
21 'x-client-ip': ip 21 'x-client-ip': ip
22 }; 22 };
  23 +
23 } 24 }
24 if (req.is("multipart/form-data")) { 25 if (req.is("multipart/form-data")) {
25 req.body.file = fs.createReadStream(req.files[req.body.filename].path); 26 req.body.file = fs.createReadStream(req.files[req.body.filename].path);
26 if (req.body.__type == "batch-import") { 27 if (req.body.__type == "batch-import") {
27 - var options = { 28 + request.post({
28 url: domain + '/batch/import', 29 url: domain + '/batch/import',
29 - method: 'POST',  
30 formData: req.body, 30 formData: req.body,
31 headers: headers 31 headers: headers
32 - };  
33 - request(options, function(error, response, body) { 32 + }, function optionalCallback(err, httpResponse, body) {
34 var json = JSON.parse(body); 33 var json = JSON.parse(body);
35 json.status = true; 34 json.status = true;
36 res.json(json); 35 res.json(json);
37 -  
38 }); 36 });
39 - // request.post({  
40 - // url: domain + '/batch/import',  
41 - // formData: req.body,  
42 - // headers: headers  
43 - // }, function optionalCallback(err, httpResponse, body) {  
44 - // var json = JSON.parse(body);  
45 - // json.status = true;  
46 - // res.json(json);  
47 - // });  
48 } else { 37 } else {
49 request.post({ 38 request.post({
50 url: domain + '/fileupload/upload', 39 url: domain + '/fileupload/upload',