系统:停服维护逻辑

This commit is contained in:
luying
2021-07-15 14:40:26 +08:00
parent 352aecfb56
commit 0028c9b992
26 changed files with 348 additions and 50 deletions
@@ -1,26 +0,0 @@
import {Application, RouteRecord, FrontendOrBackendSession, HandlerCallback} from "pinus";
import {checkEvent} from '../../../services/eventSercive';
import { refresh } from '../../../services/refreshService';
module.exports = function(app: Application) {
return new Filter(app);
}
var Filter = function(this: any, app: Application) {
this.app = app;
};
Filter.prototype.before = function (routeRecord: RouteRecord, msg: any, session: FrontendOrBackendSession, next: HandlerCallback) {
next(null);
};
Filter.prototype.after = function (err: Error, routeRecord: RouteRecord, msg: any, session: FrontendOrBackendSession, resp: any, next: HandlerCallback) {
//刷新
refresh(session);
return checkEvent(session).then(()=>{
next(err);
}).catch(e => {
console.error(e);
next(err);
}); // 奇遇本检查
};