router.js 2.67 KB
/**
 * router of sub app product
 * @author: xuqi<qi.xu@yoho.cn>
 * @date: 2016/05/06
 */

'use strict';

const router = require('express').Router(); // eslint-disable-line

const auth = require('../../doraemon/middleware/auth');

const cRoot = './controllers';

// 商品详情controller
const detail = require(`${cRoot}/detail`);

// sale controller
const sale = require(`${cRoot}/sale`);

// outlet controller
const outlet = require(`${cRoot}/outlet`);

// recommend-for-you controller
const recommendForYou = require(`${cRoot}/recommend-for-you`);

// 秒杀 controller
const seckill = require(`${cRoot}/seckill`);

// routers

// /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html
router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.getUser, detail.index); // 商品详情页
// /show_51047967.html
router.get(/\/show_([\d]+)/, detail.getUser, detail.indexSkn); // 商品详情页 SKN 进入
router.get('/detail/intro/:productskn', detail.intro); // 商品内嵌页
router.get('/detail/preference', detail.preference); // 为你优选
router.get('/detail/consults', detail.consults); // 商品咨询页
router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页
router.get('/detail/comments', detail.comments); // 商品评价
router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口
router.get('/detail/seckillData/:productskn', detail.getSeckillData); // 秒杀数据接口

router.post('/detail/consultupvote', detail.consultUpvoteOrUseful); // 商品咨询提交接口
router.post('/detail/consultuseful', detail.consultUpvoteOrUseful); // 商品咨询提交接口

router.get('/sale', sale.index);
router.get('/sale/discount', sale.discount);
router.get('/sale/discount/detail', sale.discountDetail);
router.get('/sale/breakingYards', sale.breakingYards);
router.get('/sale/vip', sale.vip);

router.get('/sale/search', sale.search);
router.get('/sale/filter', sale.filter);

router.get('/outlet', outlet.index);
router.get('/outlet/activity', outlet.activityDetail);

router.get('/outlet/activityinfo', outlet.activityList);

router.get('/recommend-for-you/userCenter', recommendForYou.userCenter);
router.get('/recommend-for-you/cart', recommendForYou.cart);

router.get('/seckill', seckill.index); // 秒杀列表页
router.post('/seckill/remind', seckill.remind);  // only app; 秒杀提醒
router.get(/\/seckill\/detail\/pro_([\d]+)_([\d]+)\/(.*)/, detail.getUser, detail.index); // 秒杀详情页
router.get(/\/seckill\/detail\/show_([\d]+)/, detail.getUser, detail.indexSkn); // 秒杀详情页 SKN 进入
router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表
module.exports = router;