123456789101112131415161718192021 |
- const hash=require('../class/hash');
- var models=require('../models');
- const url=require("url");
- var beforeRun= async function (req, res, next){
- if(hash.isExistence(req.cookies.staffV2)){
- var sid=hash.hashStaffDecode(req.cookies.staffV2);
- STAFF= await models.staff.getOne(sid);
- next();
- }else{
- var path=url.parse(req.url);
- if(path.path=="/cloud/curing/edition"){
- res.redirect('/login');
- }else{
- res.json({ 'status': 3,'msg':'请刷新页面,重新登陆' });
- }
- }
- }
- exports.beforeRun = beforeRun;
|