Commit 32dd4fc5 authored by 智勇's avatar 智勇

Merge branch 'master' of http://git.quantgroup.cn/QA/qaHome

parents a9fc98be ce427671
...@@ -197,33 +197,34 @@ app.use(async (ctx, next) => { ...@@ -197,33 +197,34 @@ app.use(async (ctx, next) => {
// filter // filter
ctx.logger = logger; ctx.logger = logger;
ctx.user = {}; ctx.user = {};
if (config.site.env !== 'development' && urlFilter(ctx.request.url)) {
let token = ctx.header['x-token'];
if (token) {
if (session[token] == undefined) {
let info = await requestPromise({
url: `http://user.liangkebang.com/user/check_token?token=${token}`,
method: "GET"
})
info = JSON.parse(info);
if (info.code == '0000') {
// 验证通过
ctx.user = JSON.stringify(info);
session[token] = info;
await next(); await next();
// if (config.site.env !== 'development' && urlFilter(ctx.request.url)) { return;
// let token = ctx.header['x-token']; }
// if (token) { } else {
// if (session[token] == undefined) { ctx.user = session[token];
// let info = await requestPromise({ await next();
// url: `http://user.liangkebang.com/user/check_token?token=${token}`, return;
// method: "GET" }
// }) }
// info = JSON.parse(info); ctx.status = 401;
// if (info.code == '0000') {
// // 验证通过
// ctx.user = JSON.stringify(info);
// session[token] = info;
// await next();
// return;
// }
// } else {
// ctx.user = session[token];
// await next();
// return;
// }
// }
// ctx.status = 401;
// } else {
// await next(); // await next();
// } return;
} else {
await next();
}
} }
}) })
app.use(Middles.vhost(vhosts)); app.use(Middles.vhost(vhosts));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment