Authored by yyq

fix seckill

@@ -136,7 +136,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart); @@ -136,7 +136,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart);
136 136
137 router.get('/seckill', seckill.index); // 秒杀列表页 137 router.get('/seckill', seckill.index); // 秒杀列表页
138 router.get('/seckill/list', seckill.indexData); 138 router.get('/seckill/list', seckill.indexData);
139 -router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒 139 +router.post('/seckill/remind', auth, seckill.remind); // only app; 秒杀提醒
140 router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表 140 router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表
141 141
142 router.get('/search', search.index); // 搜索主页 142 router.get('/search', search.index); // 搜索主页
@@ -9,17 +9,17 @@ const helpers = global.yoho.helpers; @@ -9,17 +9,17 @@ const helpers = global.yoho.helpers;
9 9
10 module.exports = (req, res, next) => { 10 module.exports = (req, res, next) => {
11 if (!req.user.uid) { 11 if (!req.user.uid) {
12 - if (req.xhr) { 12 + if (req.yoho.isApp) {
  13 + return next({
  14 + code: 401,
  15 + message: 'weblogin'
  16 + });
  17 + } else if (req.xhr) {
13 return res.json({ 18 return res.json({
14 code: 400, 19 code: 400,
15 message: '抱歉,您暂未登录!', 20 message: '抱歉,您暂未登录!',
16 redirect: '/signin.html' 21 redirect: '/signin.html'
17 }); 22 });
18 - } else if (req.yoho.isApp) {  
19 - return next({  
20 - code: 401,  
21 - message: 'weblogin'  
22 - });  
23 } else { 23 } else {
24 return res.redirect(helpers.urlFormat('/signin.html', { 24 return res.redirect(helpers.urlFormat('/signin.html', {
25 refer: req.originalUrl, 25 refer: req.originalUrl,