index.js 567 Bytes
/**
 * Created by TaoHuang on 2017/2/22.
 */

'use strict';

const helpers = global.yoho.helpers;
const TYPE = require('../type');

module.exports = [
    // 商品详情页老链接
    {
        type: TYPE.redirect,
        origin: /^\/product\/pro_([\d]+)_([\d]+)\/(.*).html(.*)/,
        target: (req, match, p1, p2, p3, p4) => helpers.urlFormat(`/p${p1}.html${p4}`, null, 'item')
    },

    // 商品详情页新链接
    {
        type: TYPE.redirect,
        origin: /\/p([\d]+)(.*)/,
        target: req => helpers.urlFormat(req.url, null, 'item')
    }
];