router.js
7.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/**
* 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`);
const gbk2utf = require(`${global.middleware}/gbk2utf`);
const paramParse = require(`${global.middleware}/param-parse`);
const sitemap = require('../3party/controllers/sitemap');
// 商品详情controller
const detail = require(`${cRoot}/detail`);
// 商品到货提醒
const notify = require(`${cRoot}/notify`);
// 收藏品牌,商品,店铺
const favorite = require(`${cRoot}/favorite`);
// 优惠券
const coupon = require(`${cRoot}/coupon`);
// 商品促销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`);
// 新品到着controller
const newArrive = require(`${cRoot}/newArrive`);
// 全球购controller
const globalCtrl = require(`${cRoot}/global`);
// 店铺controller
const shop = require(`${cRoot}/shop`);
// seo controller
const seo = require(`${cRoot}/seo`);
// 商品促销routers
router.get('/sale', sale.index); // sale 首页
router.get('/sale/vip', sale.vip); // VIP 活动专区
router.get('/sale/vip/:pathQs', paramParse, sale.vip); // VIP 活动专区 带伪静态参数
router.get('/sale/discount', sale.discount); // 折扣专场详情页
router.get('/sale/discount/:pathQs', paramParse, sale.discount); // 折扣专场详情页 带伪静态参数
router.get('/sale/breakingYards', sale.breakingYards); // 断码区
router.get('/sale/breakingYards/:pathQs', paramParse, sale.breakingYards); // 断码区 带伪静态参数
router.get('/sale/newSale', sale.newSale); // 最新降价
router.get('/sale/newSale/:pathQs', paramParse, sale.newSale); // 最新降价 带伪静态参数
router.get('/sale/special', '/sale/special', sale.special); // sale活动页 原PHP sale.yohobuy.com
router.get('/sale/special/:pathQs', '/sale/special/:pathQs', paramParse, 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('/outletslist', outletsList.index);
router.get(/^\/([\d]+)(.*)/, detail.showMain); // 新的商品详情routers
router.get(/\/p([\d]+)(.*)/, detail.showMainBack); // 老的商品详情routers
router.get('/detail/header', detail.productHeader); // 价格数据重新获取接口
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); // 品牌收藏状态
router.get('/index/favnum', favorite.num); // 收藏数量(先店铺,后品牌)
router.get('/detail/coupon', auth, coupon.acquire); // 获得优惠券
router.get('/detail/getPacakge', detail.getPackage); // 获取套餐
router.get('/detail/notify/status', auth, notify.show); // 到货通知状态
router.post('/detail/notify/add', auth, notify.add); // 增加到货通知
router.post('/detail/notify/cancel', auth, notify.cancel); // 删除到货通知
// 全球购routers
router.get('/list/global', '/list/global', globalCtrl.list); // 全球购列表页
router.get('/list/global/:pathQs', '/list/global/:pathQs', paramParse, globalCtrl.list); // 全球购列表页
router.get('/global/list', globalCtrl.list); // 全球购列表页 【老路由,待删】
router.get('/global/detail', globalCtrl.detail);
router.get(/\/global\/([\d]+)(.*)/, globalCtrl.detail);
// router.get(/\/global\/([\d]+)(.*)/, globalCtrl.detail); // 全球购商品详情页
// 搜索
router.get('/search', '/search', gbk2utf, search.index);
router.get('/search/filter/brands', search.searchFilterBrands);
router.get('/search/suggest', search.suggest); // 搜索提示
router.get('/api/suggest', search.suggest4Old);
router.get('/search/history', search.searchHistory); // 搜索历史提示
router.get('/search/less/recommend', search.searchLessRecommend);// 搜索少或无 有可能喜欢
router.get('/search/keyword/:id', search.keyword);
router.get('/search/chanpin/:id', search.keyId);
router.get('/search/hot/:id.html', '/hot/:id.html', seo.hot);
// 新品到着
router.get('/list/new', list.newWithChannel);
router.get('/list/new/:pathQs', paramParse, list.newWithChannel);
// 商品分类列表页
router.get('/list', '/list', gbk2utf, list.index);
router.get('/list/index', gbk2utf, list.index);
router.get('/list/:pathQs', '/list/:pathQs', paramParse, gbk2utf, list.index);
// 品牌店铺
router.get('/index/about', list.brandAbout); // 品牌店铺介绍页
router.post('/index/isFavoriteBrand', list.isFavoriteBrand); // 判断用户是否收藏品牌
router.post('/index/getNodeContent', list.getNodeContent); // 品牌页水牌
router.post('/index/getAdnav', list.getAdnav); // 品牌页系列
router.get('/brand/couponsync', list.brandCouponSync);
router.get('/shop/couponsync', list.shopCouponSync);
router.get('/shop', shop.index); // 店铺首页
// router.get('/shop/:domain/:shopId.html', shop.index); // 店铺首页
router.get('/shop/:shopInfo.html', '/shop/:shopInfo.html', shop.index); // 店铺首页
router.get('/shop/:shopInfo', '/shop/:shopInfo', shop.list); // 店铺列表页
router.get('/shop/:shopInfo/:pathQs', '/shop/:shopInfo/:pathQs', paramParse, shop.list); // 店铺列表页
// router.get('/shoplist', shop.list); // 店铺列表页
router.post('/shop/article', shop.article); // 店铺推荐文章
router.post('/shop/togglecollect', favorite.collectShop); // 店铺收藏
router.post('/index/isFavoriteShop', favorite.isFavShop); // 判断用户是否收藏品牌
// 学生优惠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); // 获取优惠券领取状态
// router.get('/students/list', students.list); // 获取优惠券领取状态
// 新品到着改版
router.get('/newArrive', newArrive.index); // 获取优惠券领取状态
// list&item 站点地图
router.get('/sitemap.xml', sitemap.siteMap);
module.exports = router;