router.js
5.17 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
/**
* 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`);
// 秒杀 controller
const seckill = require(`${cRoot}/seckill`);
// 秒杀商品详情controller
const seckillDetail = require(`${cRoot}/seckill-detail`);
// routers
// /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html
// 因为正则匹配原因,秒杀详情页路由要放在普通详情页前面,待解决
router.get(/^\/seckill\/show_([\d]+)/, seckillDetail.indexSkn); // 秒杀商品详情页 SKN 进入
router.get(/^\/seckill\/pro_([\d]+)_([\d]+)/, seckillDetail.index); // 秒杀商品详情页进入
router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index); // 商品详情页
// /show_51047967.html
router.get(/\/show_([\d]+)/, 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/info', detail.getUser, detail.indexData); // 商品详情页-异步数据
router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口
router.get('/detail/coupon.json', detail.brandCoupon); // 品牌券
router.post('/detail/coupon/save.json', auth, detail.getCoupon); // 获得 品牌券
router.get('/recom/maylike', recom.mayLike); // 你可能喜欢
router.get('/recom/maylikekids', recom.mayLikeKids); // 潮童你可能喜欢
router.get('/seckillDetail/seckillData/:productskn', seckillDetail.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/discount/getTime', sale.getTime);
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/activityTime', outlet.activityTime);
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.checkAppVer('5.1.0'), seckill.index); // 秒杀列表页
router.get('/seckill/list', seckill.indexData);
router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒
router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表
// 搜索主页
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('/list/index', list.category); // 兼容 PC 的链接
// 品牌 | 店铺
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.post('/index/userCoupon', list.userCoupon);
router.get('/index/getShopCouponsList', list.getShopCouponsList);
router.get('/index/getBrandCouponsList', list.getBrandCouponsList);
// 店铺介绍
router.get('/index/intro', list.shopIntro);
// 品牌|店铺收藏|取消收藏
router.get('/opt/favoriteBrand', list.favoriteBrand);
// 新品到着
router.get('/new', news.newGoods);
router.get('/list/new', news.newGoods); // 兼容 PC 的链接
router.get('/new/selectNewSale', news.selectNewSale);
router.get('/new/filter', news.filter);
// 新品到着(blk)
router.get('/blknew', news.blkNewGoods);
router.get('/newsale/hotrank', newsale.index); // 热销排行榜
router.get('/newsale/selectHotrank', newsale.selectHotrank); // 热销排行榜
module.exports = router;