Authored by weiqingting

提交

... ... @@ -256,7 +256,7 @@ var successList = null,
$('#upload-input').after('<div class="file-name btn btn-default">请选择文件</div>');
common.edit.ajaxfileupload("#upload-input", {
params: {
type: "price",
type: "brandCooperation",
__type: "batch-import"
},
onStart: function() {
... ...
... ... @@ -15,36 +15,25 @@ exports.uploadFile = function(req, res) {
var ip = ipObject ? ipObject.join('.') : req.ip;
headers = {
'x-user-id': req.session.user.pid,
'x-user-name': req.session.user.account,
'x-user-id': req.session.user.auth.pid,
'x-user-name': req.session.user.auth.account,
'x-site-type': 1,
'x-client-ip': ip
};
}
if (req.is("multipart/form-data")) {
req.body.file = fs.createReadStream(req.files[req.body.filename].path);
if (req.body.__type == "batch-import") {
var options = {
request.post({
url: domain + '/batch/import',
method: 'POST',
formData: req.body,
headers: headers
};
request(options, function(error, response, body) {
}, function optionalCallback(err, httpResponse, body) {
var json = JSON.parse(body);
json.status = true;
res.json(json);
});
// request.post({
// url: domain + '/batch/import',
// formData: req.body,
// headers: headers
// }, function optionalCallback(err, httpResponse, body) {
// var json = JSON.parse(body);
// json.status = true;
// res.json(json);
// });
} else {
request.post({
url: domain + '/fileupload/upload',
... ...