Authored by htoooth

change url

... ... @@ -39,7 +39,7 @@ const helpers = global.yoho.helpers;
helpers.image = _.flow(helpers.image, fp.replace(/\/quality\/\d*$/, '/quality/90'));
// NOTE:这里修改了参数的个数
helpers.getUrlBySkc = pid => `//item.yohobuy.com/p_${pid}.html`;
helpers.getUrlBySkc = pid => `//item.yohobuy.com/p${pid}.html`;
global.middleware = path.resolve('./doraemon/middleware');
global.utils = path.resolve('./utils');
... ...
... ... @@ -62,7 +62,7 @@ router.get('/outlets/:channel', outlets.channel); // 奥莱频道页
// 商品分类列表页
router.get('/list', outletsList.index);
router.get(/\/p_([\d]+)(.*)/, detail.showMain); // 商品详情routers
router.get(/\/p([\d]+)(.*)/, detail.showMain); // 商品详情routers
router.get('/detail/comment', detail.indexComment); // 商品评论
router.get('/detail/consult', detail.indexConsult); // 商品咨询
router.post('/detail/consult', auth, detail.createConsult); // 创建咨询
... ...
... ... @@ -24,13 +24,13 @@ module.exports = () => {
case 'new': // 原新版 重定向到301
return res.redirect(301, helpers.urlFormat(req.url, null, 'www'));
case 'item':// 商品详情页
if (/^\/p_/.test(req.url)) { // new
if (/^\/p([\d]+)/.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')
req.url.replace(/^\/product\/pro_([\d]+)_([\d]+)\/(.*).html(.*)/, '/p$1.html$4')
);
}
... ...