|
@@ -23,6 +23,8 @@ fileUtils.getGlobbedFiles('./modules/all_models/*.js').forEach(function(modelPat
|
|
|
//config.setupCache();
|
|
//config.setupCache();
|
|
|
let cfgCacheUtil = require("./config/cacheCfg");
|
|
let cfgCacheUtil = require("./config/cacheCfg");
|
|
|
cfgCacheUtil.setupDftCache();
|
|
cfgCacheUtil.setupDftCache();
|
|
|
|
|
+let online_logs = require("./logs/online_logs");
|
|
|
|
|
+
|
|
|
|
|
|
|
|
let app = express();
|
|
let app = express();
|
|
|
let _rootDir = __dirname;
|
|
let _rootDir = __dirname;
|
|
@@ -54,7 +56,7 @@ app.use(session({
|
|
|
}));
|
|
}));
|
|
|
|
|
|
|
|
// 登录状态全局判断
|
|
// 登录状态全局判断
|
|
|
-app.use(function (req, res, next) {
|
|
|
|
|
|
|
+app.use(async function (req, res, next) {
|
|
|
let url = req.originalUrl;
|
|
let url = req.originalUrl;
|
|
|
// if (/^\/login/.test(url) || /\.map|\.ico$/.test(url) || /^\/sms/.test(url) || /^\/cld/.test(url) || /^\/captcha/.test(url) || /^\/accountIsPro/.test(url)) {
|
|
// if (/^\/login/.test(url) || /\.map|\.ico$/.test(url) || /^\/sms/.test(url) || /^\/cld/.test(url) || /^\/captcha/.test(url) || /^\/accountIsPro/.test(url)) {
|
|
|
if (/^\/login/.test(url) || /\.map|\.ico$/.test(url) || /^\/sms/.test(url) || /^\/cld/.test(url) || /^\/captcha/.test(url)) {
|
|
if (/^\/login/.test(url) || /\.map|\.ico$/.test(url) || /^\/sms/.test(url) || /^\/cld/.test(url) || /^\/captcha/.test(url)) {
|
|
@@ -87,6 +89,7 @@ app.use(function (req, res, next) {
|
|
|
return res.redirect('/login');
|
|
return res.redirect('/login');
|
|
|
}
|
|
}
|
|
|
next();
|
|
next();
|
|
|
|
|
+ await online_logs.saveOnlineTime(req);//记录登录时长
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|