Blame view

apps/product/router.js 6.55 KB
郭成尧 authored
1 2 3 4 5 6 7 8
/**
 * router of sub app product
 * @author: xuqi<qi.xu@yoho.cn>
 * @date: 2016/05/06
 */

'use strict';
郭成尧 authored
9
const router = require('express').Router(); // eslint-disable-line
郭成尧 authored
10
const cRoot = './controllers';
11
const auth = require(`${global.middleware}/auth`);
htoooth authored
12
const gbk2utf = require(`${global.middleware}/gbk2utf`);
周少峰 authored
13
const sitemap = require('../3party/controllers/sitemap');
郭成尧 authored
14 15

// 商品详情controller
黄涛 authored
16
const detail = require(`${cRoot}/detail`);
yyq authored
17
htoooth authored
18 19 20
// 商品到货提醒
const notify = require(`${cRoot}/notify`);
htoooth authored
21 22
// 收藏品牌,商品,店铺
const favorite = require(`${cRoot}/favorite`);
htoooth authored
23
htoooth authored
24
// 优惠券
htoooth authored
25
const coupon = require(`${cRoot}/coupon`);
htoooth authored
26
yyq authored
27
// 商品促销controller
yyq authored
28
const sale = require(`${cRoot}/sale`);
郭成尧 authored
29
yyq authored
30 31 32
// 奥特莱斯controller
const outlets = require(`${cRoot}/outlets`);
郭成尧 authored
33
// 商品促销controller
周少峰 authored
34 35 36
const outletsList = require(`${cRoot}/outletsList`);

// 商品分类列表
郭成尧 authored
37
const list = require(`${cRoot}/list`);
htoooth authored
38
周少峰 authored
39 40
// 搜索页
const search = require(`${cRoot}/search`);
41
wenjiekong authored
42 43
// 学生优惠controller
const students = require(`${cRoot}/students`);
周少峰 authored
44
hongweigao authored
45 46 47
// 新品到着controller
const newArrive = require(`${cRoot}/newArrive`);
yyq authored
48 49 50
// 全球购controller
const globalCtrl = require(`${cRoot}/global`);
yyq authored
51 52 53
// 店铺controller
const shop = require(`${cRoot}/shop`);
yyq authored
54
// 商品促销routers
郭成尧 authored
55
router.get('/sale', sale.index); // sale 首页
yyq authored
56
router.get(/\/(.*)-sale/, sale.index); // sale 首页(SEO改造)
郭成尧 authored
57
router.get('/sale/discount/detail', sale.discount); // 折扣专场详情页
58 59 60
router.get('/sale/vip', sale.vip); // VIP 活动专区
router.get('/sale/breakingYards', sale.breakingYards); // 断码区
router.get('/sale/newSale', sale.newSale); // 最新降价
yyq authored
61
router.get('/sale/special/detail', sale.special); // sale活动页 原PHP sale.yohobuy.com
62
router.get('/sale/goods', sale.getGoodsList); // ajax 获取商品列表
郭成尧 authored
63
yyq authored
64
// 奥特莱斯routers
yyq authored
65 66 67
router.get('/outlets', outlets.index); // 奥莱首页
router.get('/outlets/index', outlets.index); // 奥莱首页
router.get('/outlets/special/detail', outlets.special); // 奥莱活动页
郭成尧 authored
68
router.get('/outlets/list', outlets.list); // 奥莱品类页
yyq authored
69
router.get('/outlets/:channel', outlets.channel); // 奥莱频道页
yyq authored
70
htoooth authored
71
// 商品详情
周少峰 authored
72
router.get('/list', outletsList.index);
htoooth authored
73 74 75 76
router.get(/^\/([\d]+)(.*)/, detail.showMain);                          // 新的商品详情routers
router.get(/\/p([\d]+)(.*)/, detail.showMainBack);                      // 老的商品详情routers

router.get('/detail/header', detail.productHeader);                     // 价格数据重新获取接口
htoooth authored
77 78 79 80 81 82 83 84 85 86 87
router.get('/detail/comment', detail.indexComment);                     // 商品评论
router.get('/detail/consult', detail.indexConsult);                     // 商品咨询
router.post('/detail/consult', auth, detail.createConsult);             // 创建咨询
router.get('/detail/consult/like/:id', auth, detail.likeConsult);       // 咨询喜欢
router.get('/detail/consult/useful/:id', auth, detail.usefulConsult);   // 咨询有用
router.get('/detail/hotarea', detail.indexHotArea);                     // 商品热区
router.post('/index/favoriteBrand', favorite.changeFavoriteBrand);      // 收藏品牌
router.post('/item/togglecollect', favorite.collectProduct);            // 收藏商品
router.get('/detail/return', detail.detailReturn);                      // 特殊商品退换货
router.get('/detail/recommend', detail.recommend);                      // 推荐商品
router.get('/index/isfav', favorite.isFavoriteBrand);                   // 品牌收藏状态
htoooth authored
88
router.get('/index/favnum', favorite.num);                              // 收藏数量(先店铺,后品牌)
htoooth authored
89 90
router.get('/detail/coupon', auth, coupon.acquire);                     // 获得优惠券
router.get('/detail/getPacakge', detail.getPackage);                    // 获取套餐
htoooth authored
91 92 93
router.get('/detail/notify/status', auth, notify.show);                 // 到货通知状态
router.post('/detail/notify/add', auth, notify.add);                    // 增加到货通知
router.post('/detail/notify/cancel', auth, notify.cancel);              // 删除到货通知
yyq authored
94
yyq authored
95 96
// 全球购routers
router.get('/global/list', globalCtrl.list); // 全球购列表页
yyq authored
97 98 99 100
router.get('/global/detail', globalCtrl.detail);
router.get(/\/global\/([\d]+)(.*)/, globalCtrl.detail);

// router.get(/\/global\/([\d]+)(.*)/, globalCtrl.detail); // 全球购商品详情页
yyq authored
101
周少峰 authored
102
// 搜索
htoooth authored
103
router.get('/search/index', gbk2utf, search.index);
htoooth authored
104
router.get('/search/filter/brands', search.searchFilterBrands);
yyq authored
105
router.get('/search/suggest', search.suggest); // 搜索提示
刘传洋 authored
106
router.get('/api/suggest', search.suggest4Old);
OF1706 authored
107
router.get('/search/history', search.searchHistory); // 搜索历史提示
OF1706 authored
108
router.get('/search/less/recommend', search.searchLessRecommend);// 搜索少或无 有可能喜欢
yyq authored
109
router.get('/search/keyword/:id', search.keyword);
yyq authored
110
router.get('/search/chanpin/:id', search.keyId);
刘传洋 authored
111
周少峰 authored
112
// 商品分类列表页
htoooth authored
113
router.get('/list/index', gbk2utf, list.index);
周少峰 authored
114 115

// 新品到着
yyq authored
116
router.get('/list/new', list.new);
yyq authored
117
router.get(/\/list\/(.*)-new/, list.newWithChannel);
周少峰 authored
118
yyq authored
119 120 121 122 123
// 品牌店铺
router.get('/index/about', list.brandAbout); // 品牌店铺介绍页
router.post('/index/isFavoriteBrand', list.isFavoriteBrand); // 判断用户是否收藏品牌
router.post('/index/getNodeContent', list.getNodeContent); // 品牌页水牌
router.post('/index/getAdnav', list.getAdnav); // 品牌页系列
yyq authored
124
router.get('/shop', shop.index); // 店铺首页
yyq authored
125
// router.get('/shop/:domain/:shopId.html', shop.index); // 店铺首页
yyq authored
126
router.get('/shop/:shopInfo.html', shop.index); // 店铺首页
yyq authored
127
router.get('/shoplist', shop.list); // 店铺列表页
yyq authored
128
router.get('/shop/article', shop.article); // 店铺推荐文章
yyq authored
129
router.post('/shop/togglecollect', favorite.collectShop); // 店铺收藏
yyq authored
130
router.post('/index/isFavoriteShop', favorite.isFavShop); // 判断用户是否收藏品牌
131 132
router.get('/brand/couponsync', list.brandCouponSync);
router.get('/shop/couponsync', list.shopCouponSync);
yyq authored
133
134
wenjiekong authored
135 136
// 学生优惠routers
router.get('/students', students.index); // students 首页
周少峰 authored
137 138
router.get('/students/schoolArea', students.schoolArea); // 学校地区
router.get('/students/schoolList', students.schoolList); // 学校地区
周少峰 authored
139
router.get('/students/eduLevel', students.eduLevel); // 学校地区
周少峰 authored
140
router.get('/students/verify', students.verify); // 身份验证
141
router.get('/students/userAcquireStatus', students.userAcquireStatus); // 获取优惠券领取状态
周少峰 authored
142
router.get('/students/list', students.list); // 获取优惠券领取状态
周少峰 authored
143
hongweigao authored
144
// 新品到着改版
hongweigao authored
145
router.get('/newArrive', newArrive.index); // 获取优惠券领取状态
周少峰 authored
146 147 148 149

// list&item 站点地图
router.get('/sitemap.xml', sitemap.siteMap);
郭成尧 authored
150
module.exports = router;