Authored by weiqingting

提交

module.exports=function(Filter){
Filter.define("/!(login)", ["get","post"], "common_gray", function (gray, req, res, next){
console.log("Session",gray);
if(gray.code==200){
next();
}else{
... ...
... ... @@ -118,7 +118,6 @@ module.exports={
if (!error4) {
var cookie = httpResponse4.caseless.dict["set-cookie"];
if (cookie && cookie.length > 0) {
console.log("登录成功!");
req.session.gray = cookie[0];
}
result = { code: 200, message: "登录成功" }
... ... @@ -175,7 +174,6 @@ module.exports={
return callback(null, result);
}
} else {
console.log("session 丢失");
return callback(null,result);
}
},
... ...
... ... @@ -47,16 +47,16 @@ module.exports=function(controllers){
//发起代理请求
request(options).pipe(res);
}else{
// request({
// method:'GET',
// url: Iaccount.url + Iaccount.sessionKeep,
// headers: {
// 'Cookie':req.session.gray
// }
// },function(err,res,body){
// var code = res?res.statusCode:'no response';
// console.log('info','grayroute: session keep status:'+code);
// });
request({
method:'GET',
url: Iaccount.url + Iaccount.sessionKeep,
headers: {
'Cookie':req.session.gray
}
},function(err,res,body){
var code = res?res.statusCode:'no response';
console.log('info','grayroute: session keep status:'+code);
});
next();
}
}
... ...