router.js 3.65 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 cRoot = './controllers';
const auth = require(`${global.middleware}/auth`);

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

// 收藏品牌,商品,店铺
const favorite = require(`${cRoot}/favorite`);

// 商品促销controller
const sale = require(`${cRoot}/sale`);

// 奥特莱斯controller
const outlets = require(`${cRoot}/outlets`);

// 商品促销controller
const outletsList = require(`${cRoot}/outletsList`);

// 商品分类列表
const list = require(`${cRoot}/list`);

// 搜索页
const search = require(`${cRoot}/search`);

// 学生优惠controller
const students = require(`${cRoot}/students`);

// 商品促销routers
router.get('/sale', sale.index); // sale 首页
router.get('/sale/discount/detail', sale.discount); // 折扣专场详情页
router.get('/sale/vip', sale.vip); // VIP 活动专区
router.get('/sale/breakingYards', sale.breakingYards); // 断码区
router.get('/sale/newSale', sale.newSale); // 最新降价
router.get('/sale/special/detail', sale.special); // sale活动页 原PHP sale.yohobuy.com
router.get('/sale/goods', sale.getGoodsList); // ajax 获取商品列表

// 奥特莱斯routers
router.get('/outlets', outlets.index); // 奥莱首页
router.get('/outlets/index', outlets.index); // 奥莱首页
router.get('/outlets/special/detail', outlets.special); // 奥莱活动页
router.get('/outlets/list', outlets.list); // 奥莱品类页
router.get('/outlets/:channel', outlets.channel); // 奥莱频道页

// 商品分类列表页
router.get('/list', outletsList.index);
router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.showMain); // 商品详情routers
router.get('/detail/comment', detail.indexComment);// 商品评论
router.get('/detail/consult', detail.indexConsult);// 商品咨询
router.post('/detail/consult', auth, detail.createConsult);// 创建咨询
router.get('/detail/hotarea', detail.indexHotArea);// 商品热区
router.post('/index/favoriteBrand', favorite.changeFavoriteBrand);// 收藏品牌
router.post('/item/togglecollect', favorite.collectProduct); // 收藏商品
router.get('/detail/header', detail.productHeader); // 价格数据重新获取接口
router.get('/detail/return', detail.detailReturn);// 特殊商品退换货

// 搜索
router.get('/search/index', search.index);
router.get('/search/filter/brands', search.serachFilterBrands);

// 搜索提示
router.get('/search/suggest', search.suggest);

router.get('/api/suggest', search.suggest4Old);


// 商品分类列表页
router.get('/list/index', list.index);

// 新品到着
router.get('/list/new', list.new);

// 品牌页
router.get('/brand/:brandDomain', list.brand);
router.get('/about/:brandDomain', list.brandAbout);

router.get('/shoplist', list.shopList); // 店铺列表页
router.post('/shop/togglecollect', favorite.collectShop); // 店铺收藏

// 品牌页水牌
router.post('/index/getNodeContent', list.getNodeContent);

// 品牌页系列
router.post('/index/getAdnav', list.getAdnav);

// 判断用户是否收藏品牌
router.post('/index/isFavoriteBrand', list.isFavoriteBrand);

// 学生优惠routers
router.get('/students', students.index); // students 首页
router.get('/students/schoolArea', students.schoolArea); // 学校地区
router.get('/students/schoolList', students.schoolList); // 学校地区
router.get('/students/eduLevel', students.eduLevel); // 学校地区
router.get('/students/verify', students.verify); // 身份验证
router.get('/students/userAcquireStatus', students.userAcquireStatus); // 获取优惠券领取状态

module.exports = router;