Authored by htoooth

fix css

... ... @@ -151,7 +151,6 @@ const logger = global.yoho.logger;
try {
const subDomain = require('./doraemon/middleware/sub-domain');
const mobileRefer = require('./doraemon/middleware/mobile-refer');
const itemNameHandler = require('./doraemon/middleware/item-name-handler');
const mobileCheck = require('./doraemon/middleware/mobile-check');
const user = require('./doraemon/middleware/user');
const seo = require('./doraemon/middleware/seo');
... ... @@ -165,7 +164,6 @@ try {
// YOHO 前置中间件
app.use(subDomain());
app.use(mobileRefer());
app.use(itemNameHandler);
app.use(mobileCheck());
app.use(setYohoData());
app.use(user());
... ...
... ... @@ -295,10 +295,6 @@ const getPackage = (req, res, next) => {
.catch(next);
};
const redirectNewProduct = (req, res) => {
console.log(req.params);
return res.status(301).redirect(helpers.urlFormat(`/p_${req.params[0]}/${req.params[2]}`, null, 'item'));
};
module.exports = {
showMain,
... ... @@ -311,6 +307,5 @@ module.exports = {
recommend,
getPackage,
likeConsult,
usefulConsult,
redirectNewProduct
usefulConsult
};
... ...
... ... @@ -62,7 +62,6 @@ router.get('/outlets/:channel', outlets.channel); // 奥莱频道页
// 商品分类列表页
router.get('/list', outletsList.index);
router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.redirectNewProduct);
router.get(/\/p_([\d]+)(.*)/, detail.showMain); // 商品详情routers
router.get('/detail/comment', detail.indexComment); // 商品评论
router.get('/detail/consult', detail.indexConsult); // 商品咨询
... ...
/**
* 商品详情页部分商品名称重置,防止express内部decodeURIComponent不能解析url出错
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2016/8/23
*/
module.exports = function(req, res, next) {
if (/^\/product\/pro_/.test(req.url)) {
req.url = req.url.replace(/\/pro_([\d]+)_([\d]+)\/(.*)/, '/pro_$1_$2/yoho-replace.html');
}
next();
};
... ... @@ -24,9 +24,16 @@ module.exports = () => {
case 'new': // 原新版 重定向到301
return res.redirect(301, helpers.urlFormat(req.url, null, 'www'));
case 'item':// 商品详情页
if (/\/p_([\d]+)(.*)/.exec(req.url) !== null) {
req.url = `/product/p_${RegExp.$1}${RegExp.$2}`;
if (/^\/p_/.test(req.url)) { // new
req.url = `/product${req.url}`;
}
if (/^\/product\/pro_/.test(req.url)) { // old
return res.redirect(301,
req.url.replace(/^\/product\/pro_([\d]+)_([\d]+)\/(.*).html(.*)/, '/p_$1.html$4')
);
}
break;
case 'guang': // 逛
case 'cdnsrcguang': // 逛CDN回源解析
... ...