Blame view

apps/product/router.js 7.02 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
yyq authored
10 11 12

const auth = require('../../doraemon/middleware/auth');
13 14
const rewrite = require('../../doraemon/middleware/rewrite');
郭成尧 authored
15 16 17 18
const cRoot = './controllers';

// 商品详情controller
const detail = require(`${cRoot}/detail`);
ccbikai(👎🏻🍜) authored
19
const newDetail = require(`${cRoot}/new-detail`);
郭成尧 authored
20
王水玲 authored
21 22 23
// sale controller
const sale = require(`${cRoot}/sale`);
biao authored
24 25 26
// outlet controller
const outlet = require(`${cRoot}/outlet`);
27 28 29
// recommend-for-you controller
const recommendForYou = require(`${cRoot}/recommend-for-you`);
王水玲 authored
30 31 32
// search controller
const search = require(`${cRoot}/search`);
33 34 35
// 品类|品牌|店铺 controller
const list = require(`${cRoot}/list`);
王水玲 authored
36 37 38
// 新品到着 controller
const news = require(`${cRoot}/new`);
郭成尧 authored
39
// 热销排行榜
zhangxiaoru authored
40 41
const newsale = require(`${cRoot}/newsale`);
zhangxiaoru authored
42
// recom
zhangxiaoru authored
43 44
const recom = require(`${cRoot}/recom`);
陈峰 authored
45 46 47
// 秒杀 controller
const seckill = require(`${cRoot}/seckill`);
lijing authored
48 49
// 秒杀商品详情controller
const seckillDetail = require(`${cRoot}/seckill-detail`);
zhangxiaoru authored
50
姜枫 authored
51 52
const newShop = require(`${cRoot}/new-shop`);
郭成尧 authored
53 54 55
// 套装
const bundle = require(`${cRoot}/bundle`);
郭成尧 authored
56
// routers
ccbikai authored
57 58

// /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html
59
lijing authored
60
// 因为正则匹配原因,秒杀详情页路由要放在普通详情页前面,待解决
lijing authored
61 62
router.get(/^\/seckill\/show_([\d]+)/, seckillDetail.indexSkn); // 秒杀商品详情页 SKN 进入
router.get(/^\/seckill\/pro_([\d]+)_([\d]+)/, seckillDetail.index); // 秒杀商品详情页进入
63
router.get(/^\/pro_([\d]+)_([\d]+)/, newDetail.indexRedirect); // 商品详情页
64
// /show_51047967.html
65 66
router.get(/^\/show_([\d]+)/, newDetail.indexRedirect); // 商品详情页 SKN 进入
router.get(/^\/(\d+)\.html/, newDetail.index); // 商品详情页 SKN 进入 SEO优化
67
68
router.get('/detail/sknData.json', newDetail.sknData); // 商品咨询,评价,店铺
yyq authored
69 70 71 72
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); // 商品咨询表单页
73
router.get('/detail/comments', detail.comments); // 商品评价
74
router.post('/detail/info', detail.getUser, detail.indexData); // 商品详情页-异步数据
沈志敏 authored
75
router.post('/detail/newinfo', detail.getUser, newDetail.indexData); // 商品详情页-异步数据 (优化)
yyq authored
76
router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口
77
78
陈轩 authored
79
router.get('/detail/coupon.json', detail.brandCoupon); // 品牌券
80
router.post('/detail/coupon/save.json', auth, detail.getCoupon); // 获得 品牌券
陈轩 authored
81
沈志敏 authored
82
router.get('/recom/maylike', recom.mayLike); // 你可能喜欢
83 84

陈轩 authored
85 86 87
// 限定商品
router.get('/detail/limit', detail.limit);
zhangxiaoru authored
88
router.get('/recom/maylike', recom.mayLike);// 你可能喜欢
zhangxiaoru authored
89
router.get('/recom/maylikekids', recom.mayLikeKids); // 潮童你可能喜欢
zhangxiaoru authored
90
router.get('/recom/maylikelife', recom.mayLikelife); // 创意生活你可能喜欢
郭成尧 authored
91
lijing authored
92
router.get('/seckillDetail/seckillData/:productskn', seckillDetail.getSeckillData); // 秒杀数据接口
郭成尧 authored
93
94 95 96
router.post('/detail/consultupvote', detail.consultUpvoteOrUseful); // 商品咨询提交接口
router.post('/detail/consultuseful', detail.consultUpvoteOrUseful); // 商品咨询提交接口
97 98
router.get('/sale', rewrite.channel, sale.indexRedirect);
router.get(/^\/(.*?)-sale/, rewrite.resolve, sale.index); // 折扣专区 SEO优化
99
王水玲 authored
100
router.get('/sale/discount', sale.discount);
陈峰 authored
101
陈峰 authored
102
// router.get(/^\/(.*?)-sale\/discount/, rewrite.resolve, sale.discount);
王水玲 authored
103 104
router.get('/sale/discount/detail', sale.discountDetail);
router.get('/sale/breakingYards', sale.breakingYards);
陈峰 authored
105
陈峰 authored
106
// router.get(/^\/(.*?)-sale\/breakingYards/, rewrite.resolve, sale.breakingYards); // SEO优化
王水玲 authored
107
router.get('/sale/vip', sale.vip);
108
router.get('/sale/discount/getTime', sale.getTime);
王水玲 authored
109
王水玲 authored
110
router.get('/sale/search', sale.search);
ccbikai authored
111
router.get('/sale/filter', sale.filter);
王水玲 authored
112
biao authored
113
router.get('/outlet', outlet.index);
114
router.get('/outlet/activity', outlet.activityDetail);
115
router.get('/outlet/activityTime', outlet.activityTime);
biao authored
116
117
router.get('/outlet/activityinfo', outlet.activityList);
王水玲 authored
118
张丽霞 authored
119 120
router.get('/recommend-for-you/userCenter', recommendForYou.userCenter);
router.get('/recommend-for-you/cart', recommendForYou.cart);
121
122
陈轩 authored
123
router.get('/seckill', seckill.checkAppVer('5.1.0'), seckill.index); // 秒杀列表页
124
router.get('/seckill/list', seckill.indexData);
lijing authored
125
沈志敏 authored
126
router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒
127
router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表
128
zhangxiaoru authored
129
// 搜索主页
zhangxiaoru authored
130 131
router.get('/search/index', search.index);
王水玲 authored
132
// 搜索落地页
陈峰 authored
133
router.get('/search/list', rewrite.sortParams, search.list);
王水玲 authored
134 135

// filter
王水玲 authored
136
router.get('/search/filter', search.filter);
王水玲 authored
137
zhangxiaoru authored
138
// fuzzyDatas
zhangxiaoru authored
139 140
router.get('/search/fuzzyDatas', search.fuzzyDatas);
王水玲 authored
141
// ajax 请求商品数据
王水玲 authored
142
router.get('/search/search', search.search);
王水玲 authored
143 144

// 品类
陈峰 authored
145 146
router.get('/index/index', rewrite.sortParams, list.category);
router.get('/list/index', rewrite.sortParams, list.category); // 兼容 PC 的链接
王水玲 authored
147 148

// 品牌 | 店铺
zzzzzzz authored
149 150
router.get('/index/shopAppCookie', list.shopAppCookie);
router.get('/index/shopFav', list.shopFav);
151
郭成尧 authored
152
router.get('/index/category', list.shopCategory);
153 154
router.post('/index/userCoupon', list.userCoupon);
router.get('/index/getShopCouponsList', list.getShopCouponsList);
郝肖肖 authored
155
router.get('/index/getBrandCouponsList', list.getBrandCouponsList);
王水玲 authored
156
姜枫 authored
157
// 店铺重构
158 159 160
router.get('/index/brand', newShop.index);
router.get('/index/baseShopFav', newShop.baseShopFav);
router.get('/index/brandFav', newShop.brandFav);
161
router.get('/new/shop/hotlist', newShop.shopHotList);
162
陈轩 authored
163
router.get('/red_shop', newShop.redShop); // TODO,TODO,TODO,TODO
陈轩 authored
164
165
// end- 店铺重构
王水玲 authored
166 167

// 店铺介绍
168
router.get('/index/intro', list.shopIntro);
王水玲 authored
169 170

// 品牌|店铺收藏|取消收藏
171
router.get('/opt/favoriteBrand', list.favoriteBrand);
王水玲 authored
172
王水玲 authored
173
// 新品到着
174
router.get('/new', rewrite.channel, news.newGoodsRedirect);
175 176

// 新品到着 SEO优化
陈峰 authored
177
router.get(/^\/(.*?)-new/, rewrite.resolve, news.newGoods);
178
179
router.get('/list/new', news.newGoods); // 兼容 PC 的链接
王水玲 authored
180 181 182
router.get('/new/selectNewSale', news.selectNewSale);
router.get('/new/filter', news.filter);
陈轩 authored
183 184 185 186 187 188
router.get('/newnew', news._newGoods); // TODO: repleace /new
router.get('/new/recommend-shop.json', news.recommendShop);
router.get('/new/goods.json', news.fetchNew);
router.get('/new/goods-filter', news.goodsFilter);
router.get('/new/shops', news.brands);
陈轩 authored
189
沈志敏 authored
190 191
// 新品到着(blk)
router.get('/blknew', news.blkNewGoods);
zhangxiaoru authored
192
沈志敏 authored
193 194
router.get('/newsale/hotrank', newsale.index); // 热销排行榜
router.get('/newsale/selectHotrank', newsale.selectHotrank); // 热销排行榜
zhangxiaoru authored
195
郭成尧 authored
196 197
router.get('/bundle/detail', bundle.detail); // 套装详情页
郭成尧 authored
198
router.post('/opt/favoriteProduct', newDetail.favoriteProduct); // 商品收藏、取消收藏
郭成尧 authored
199
router.get('/detail/limitHelp', newDetail.limitHelp);
郭成尧 authored
200
郭成尧 authored
201 202
router.get('/index/allBrand', newShop.allBrand); // 店铺全部品牌
郭成尧 authored
203
module.exports = router;