Authored by 陈峰

subDomain增加new转发跳转

... ... @@ -5,13 +5,19 @@
*/
'use strict';
const helpers = global.yoho.helpers;
module.exports = () => {
return (req, res, next) => {
console.log(req.subdomains)
if (req.subdomains.length) {
switch (req.subdomains[0]) {
case 'guang': // 逛
req.url = req.url.replace('/guang', '');
req.url = `/guang${req.url}`;
break;
case 'new':
res.redirect(helpers.urlFormat(req.path, req.query, 'default'));
return;
default: // 其它(识别为品牌)
req.url = `/product/brand/${req.subdomains[0]}`;
break;
... ...