Authored by liuyue

Merge branch 'develop' of git.dev.yoho.cn:platform/yohobuy-portal-fe into develop

... ... @@ -31,6 +31,5 @@
.g-slide{
width: 100%;
height: 400px;
.g-slide-left
}
}
\ No newline at end of file
... ...
var request = require('request');
var fs = require('fs');
var ipaddr = require('ipaddr.js');
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';
... ... @@ -7,6 +8,9 @@ var domain = require('../../config/common.js').domain;
var env = process.env.NODE_ENV || 'development';
exports.uploadFile = function(req, res) {
if(req.session.user) {
appendAdminInfo(req,req.session.user.auth);
}
if (req.is("multipart/form-data")) {
req.body.file = fs.createReadStream(req.files[req.body.filename].path);
if (req.body.__type == "batch-import") {
... ... @@ -35,3 +39,20 @@ exports.uploadFile = function(req, res) {
});
}
}
/**
* 附加管理员的信息
* @param {Request} req 请求对象
* @param {Number} uid 用户ID
* @param {String} name 用户名
* @return {Object} 用户信息对象
*/
function appendAdminInfo(req,auth) {
var ipObject = ipaddr.process(req.ip).octets
var ip = ipObject?ipObject.join('.'):req.ip;
req._yoheaders = {
'x-user-id':auth.pid,
'x-user-name':auth.account,
'x-site-type':WEBSITE,
'x-client-ip':ip
};
}
\ No newline at end of file
... ...