|
|
/**
|
|
|
* 设置频道
|
|
|
* 设置 YOHO 数据
|
|
|
* @author: 赵彪<bill.zhao@yoho.cn>
|
|
|
* @date: 2016/6/16
|
|
|
*/
|
...
|
...
|
@@ -8,19 +8,16 @@ |
|
|
|
|
|
module.exports = () => {
|
|
|
return (req, res, next) => {
|
|
|
if (!req.xhr) {
|
|
|
const obj = {};
|
|
|
const channel = req.query.channel || req.cookies._Channel || 'boys';
|
|
|
let yoho = {
|
|
|
pageChannel: {}
|
|
|
};
|
|
|
const channel = req.query.channel || req.cookies._Channel || 'boys';
|
|
|
|
|
|
obj[channel] = true;
|
|
|
|
|
|
Object.assign(res.locals, {
|
|
|
pageChannel: obj
|
|
|
});
|
|
|
|
|
|
req.yoho.channel = channel;
|
|
|
}
|
|
|
yoho.pageChannel[channel] = true;
|
|
|
yoho.isApp = req.query.app_version || req.query.appVersion;
|
|
|
|
|
|
Object.assign(res.locals, yoho);
|
|
|
Object.assign(req.yoho, yoho);
|
|
|
next();
|
|
|
};
|
|
|
}; |
...
|
...
|
|