|
@@ -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',
|