secret-switch.js
475 Bytes
const logger = global.yoho.logger;
const secretSwitch = () => {
return (req, res, next) => {
// 获取客服开关,读cache
global.yoho.cache.get('customerServiceSwitch').then(result => {
Object.assign(res.locals, {
customerServiceSwitch: result || false
});
next();
}).catch((err) => {
logger.error(err);
next();
});
};
};
module.exports = secretSwitch;