router.js 3.75 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`);

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

// 品类|品牌|店铺 controller
const list = require(`${cRoot}/list`);

// 新品到着 controller
const news = require(`${cRoot}/new`);

// 热销排行榜
const newsale = require(`${cRoot}/newsale`);

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


// 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('/recom/maylike', recom.mayLike);// 你可能喜欢
router.get('/recom/maylikekids', recom.mayLikeKids); // 潮童你可能喜欢
// router.get('/recom/maylikelife', recom.mayLikeLifestyle); // 创意生活你可能喜欢

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('/search/index', search.index);

// 搜索落地页
router.get('/search/list', search.list);

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

// fuzzyDatas
router.get('/search/fuzzyDatas', search.fuzzyDatas);

// ajax 请求商品数据
router.get('/search/search', search.search);

// 品类
router.get('/index/index', list.category);

// 品牌 | 店铺
router.get('/index/brand', list.brand);
router.get('/index/brandFav', list.brandFav);
router.get('/index/shopAppCookie', list.shopAppCookie);
router.get('/index/shopFav', list.shopFav);
router.get('/index/baseShopFav', list.baseShopFav);
router.get('/index/category', list.shopCategory);
router.get('/index/userCoupon', list.userCoupon);

// 店铺介绍
router.get('/index/intro', list.shopIntro);

// 品牌|店铺收藏|取消收藏
router.get('/opt/favoriteBrand', list.favoriteBrand);

// 新品到着
router.get('/new', news.newGoods);
router.get('/new/selectNewSale', news.selectNewSale);
router.get('/new/filter', news.filter);

router.get('/newsale/hotrank', newsale.index);// 热销排行榜
router.get('/newsale/selectHotrank', newsale.selectHotrank);// 热销排行榜

module.exports = router;