Authored by 姜枫

Merge branch 'release/1.0'

@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 'use strict'; 7 'use strict';
8 8
9 const router = require('express').Router(); // eslint-disable-line 9 const router = require('express').Router(); // eslint-disable-line
  10 +const auth = require(`${global.doraemon}/middleware/auth`);
10 11
11 var multipart = require('connect-multiparty'); 12 var multipart = require('connect-multiparty');
12 var multipartMiddleware = multipart(); 13 var multipartMiddleware = multipart();
@@ -14,7 +15,7 @@ var multipartMiddleware = multipart(); @@ -14,7 +15,7 @@ var multipartMiddleware = multipart();
14 const uploadApi = require('./controllers/upload.js'); 15 const uploadApi = require('./controllers/upload.js');
15 const wechat = require('./controllers/wechat.js'); 16 const wechat = require('./controllers/wechat.js');
16 17
17 -router.post('/upload/image', multipartMiddleware, uploadApi.uploadImg); 18 +router.post('/upload/image', auth, multipartMiddleware, uploadApi.uploadImg);
18 19
19 router.get('/wechat/share/token', wechat.shareToken); 20 router.get('/wechat/share/token', wechat.shareToken);
20 21
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 const expressRouter = require('express').Router; 9 const expressRouter = require('express').Router;
10 const cRoot = './controllers'; 10 const cRoot = './controllers';
11 const router = expressRouter(); 11 const router = expressRouter();
  12 +const auth = require(`${global.doraemon}/middleware/auth`);
12 13
13 const editorial = require(`${cRoot}/index`); 14 const editorial = require(`${cRoot}/index`);
14 15
@@ -20,8 +21,8 @@ const detail = require(`${cRoot}/detail`); @@ -20,8 +21,8 @@ const detail = require(`${cRoot}/detail`);
20 21
21 router.get(/\/([\d]+).html/, detail.index); // 详情routers 22 router.get(/\/([\d]+).html/, detail.index); // 详情routers
22 router.get(/editorial_(\d+)\.json/, detail.editorial); 23 router.get(/editorial_(\d+)\.json/, detail.editorial);
23 -router.get(/like_(\d+)\.json/, detail.like);  
24 -router.get(/favorite_(\d+)\.json/, detail.favorite); 24 +router.get(/like_(\d+)\.json/, auth, detail.like);
  25 +router.get(/favorite_(\d+)\.json/, auth, detail.favorite);
25 router.get(/misc_(\d+)\.json/, detail.misc); 26 router.get(/misc_(\d+)\.json/, detail.misc);
26 27
27 module.exports = router; 28 module.exports = router;
@@ -14,66 +14,66 @@ const refund = require(cRoot + '/refund'); @@ -14,66 +14,66 @@ const refund = require(cRoot + '/refund');
14 const order = require(cRoot + '/order'); 14 const order = require(cRoot + '/order');
15 const exchange = require(cRoot + '/exchange'); 15 const exchange = require(cRoot + '/exchange');
16 const help = require(cRoot + '/help'); 16 const help = require(cRoot + '/help');
17 - 17 +const auth = require(`${global.doraemon}/middleware/auth`);
18 const router = expressRouter(); 18 const router = expressRouter();
19 19
20 // Your controller here 20 // Your controller here
21 router.get('/me/', home.index); // 个人中心主页 21 router.get('/me/', home.index); // 个人中心主页
22 router.get('/me/userdata', home.userdata); // 个人中心数据 22 router.get('/me/userdata', home.userdata); // 个人中心数据
23 23
24 -router.get('/me/order', order.orders); // 订单  
25 -router.get('/me/order/detail', order.orderDetail); // 订单详情  
26 -router.get('/me/order/cancelreason', order.cancelReason); // 取消订单原因选择 24 +router.get('/me/order', auth, order.orders); // 订单
  25 +router.get('/me/order/detail', auth, order.orderDetail); // 订单详情
  26 +router.get('/me/order/cancelreason', auth, order.cancelReason); // 取消订单原因选择
27 27
28 -router.get('/me/getOrderList', order.getOrderData); // 获取订单数据  
29 -router.get('/me/get-order', order.getOrderDetailData); // AJAX 获取订单详情数据  
30 -router.get('/me/getCancelOrderReason', order.getCancelReason); // 获取取消订单原因  
31 -router.post('/me/cancelOrder', order.cancelOrder); // 取消订单  
32 -router.post('/me/deleteOrder', order.deleteOrder); // AJAX 删除订单  
33 -router.post('/me/confirmReceive', order.confirmOrder); // 确认订单 28 +router.get('/me/getOrderList', auth, order.getOrderData); // 获取订单数据
  29 +router.get('/me/get-order', auth, order.getOrderDetailData); // AJAX 获取订单详情数据
  30 +router.get('/me/getCancelOrderReason', auth, order.getCancelReason); // 获取取消订单原因
  31 +router.post('/me/cancelOrder', auth, order.cancelOrder); // 取消订单
  32 +router.post('/me/deleteOrder', auth, order.deleteOrder); // AJAX 删除订单
  33 +router.post('/me/confirmReceive', auth, order.confirmOrder); // 确认订单
34 34
35 -router.get('/me/mycurrency', order.coin); // yoho币  
36 -router.get('/me/coin-detail', order.getCoinDetail); // ajax yoho币明细 35 +router.get('/me/mycurrency', auth, order.coin); // yoho币
  36 +router.get('/me/coin-detail', auth, order.getCoinDetail); // ajax yoho币明细
37 37
38 router.get('/me/service', home.service); // 在线客服 38 router.get('/me/service', home.service); // 在线客服
39 // router.get('/help', home.help); // 帮助中心列表页 39 // router.get('/help', home.help); // 帮助中心列表页
40 router.get('/help', help.index); // 帮助中心列表页(写死的内容) 40 router.get('/help', help.index); // 帮助中心列表页(写死的内容)
41 router.get('/help-detail', help.helpDetail); // 帮助中心详情页(写死的内容) 41 router.get('/help-detail', help.helpDetail); // 帮助中心详情页(写死的内容)
42 -router.get('/me/feedback', home.feedback); // 个人中心-意见反馈  
43 -router.post('/me/save-feedback', home.saveFeedback); // 个人中心-提交意见反馈 42 +router.get('/me/feedback', auth, home.feedback); // 个人中心-意见反馈
  43 +router.post('/me/save-feedback', auth, home.saveFeedback); // 个人中心-提交意见反馈
44 44
45 -router.get('/me/collection', favorite.favorite); // 个人中心 - 收藏  
46 -router.get('/me/collection/favpaging', favorite.favpaging); // 个人中心 - 收藏商品/品牌(翻页)  
47 -router.post('/me/del-favdel', favorite.deletefav); // 个人中心 - 收藏商品/品牌(刪除) 45 +router.get('/me/collection', auth, favorite.favorite); // 个人中心 - 收藏
  46 +router.get('/me/collection/favpaging', auth, favorite.favpaging); // 个人中心 - 收藏商品/品牌(翻页)
  47 +router.post('/me/del-favdel', auth, favorite.deletefav); // 个人中心 - 收藏商品/品牌(刪除)
48 48
49 // 退换货 49 // 退换货
50 -router.get('/me/return', refund.refundOrders); // 退换货 - 订单列表  
51 -router.get('/me/return/getOrderList', refund.getRefundOrders); // 退换货 - 获取订单列表数据  
52 -router.get('/me/return/refund/detail/:applyId', refund.refundStatus); // 退换货 - 退货状态  
53 -router.get('/me/return/exchange/detail/:applyId', refund.exchangeStatus); // 退换货 - 换货状态  
54 -router.get('/me/return/status-detail', refund.statusDetail); // 退换货 - 状态详细信息 50 +router.get('/me/return', auth, refund.refundOrders); // 退换货 - 订单列表
  51 +router.get('/me/return/getOrderList', auth, refund.getRefundOrders); // 退换货 - 获取订单列表数据
  52 +router.get('/me/return/refund/detail/:applyId', auth, refund.refundStatus); // 退换货 - 退货状态
  53 +router.get('/me/return/exchange/detail/:applyId', auth, refund.exchangeStatus); // 退换货 - 换货状态
  54 +router.get('/me/return/status-detail', auth, refund.statusDetail); // 退换货 - 状态详细信息
55 55
56 // 退货申请 56 // 退货申请
57 -router.get('/me/return/refund', refund.refund); // 退货申请  
58 -router.get('/me/return/refund/order', refund.order); // AJAX 查询订单数据  
59 -router.post('/me/return/refund/submit', refund.submit); // AJAX 提交信息  
60 -router.get('/me/return/logistics', refund.logistics); // 退换货 - 商品寄回信息  
61 -router.post('/me/return/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息  
62 -router.post('/me/return/refund/cancel-apply', refund.cancelApply); // 退货 - 取消申请 57 +router.get('/me/return/refund', auth, refund.refund); // 退货申请
  58 +router.get('/me/return/refund/order', auth, refund.order); // AJAX 查询订单数据
  59 +router.post('/me/return/refund/submit', auth, refund.submit); // AJAX 提交信息
  60 +router.get('/me/return/logistics', auth, refund.logistics); // 退换货 - 商品寄回信息
  61 +router.post('/me/return/save-logistics', auth, refund.saveLogistics); // 退换货 - 添加寄回物流信息
  62 +router.post('/me/return/refund/cancel-apply', auth, refund.cancelApply); // 退货 - 取消申请
63 63
64 // 换货申请 64 // 换货申请
65 -router.get('/me/return/exchange', exchange.exchange);  
66 -router.get('/me/return/exchange/order', exchange.order); // AJAX 获取订单 商品  
67 -router.get('/me/return/exchange/delivery', exchange.delivery); // AJAX 获取 退货方式  
68 -router.post('/me/return/exchange/submit', exchange.submit); // AJAX 提交换货 申请  
69 -router.post('/me/return/exchange/cancel-apply', exchange.cancelApply); // AJAX 取消换货申请 65 +router.get('/me/return/exchange', auth, exchange.exchange);
  66 +router.get('/me/return/exchange/order', auth, exchange.order); // AJAX 获取订单 商品
  67 +router.get('/me/return/exchange/delivery', auth, exchange.delivery); // AJAX 获取 退货方式
  68 +router.post('/me/return/exchange/submit', auth, exchange.submit); // AJAX 提交换货 申请
  69 +router.post('/me/return/exchange/cancel-apply', auth, exchange.cancelApply); // AJAX 取消换货申请
70 70
71 -router.get('/me/mydetails', home.mydetails); // 个人信息  
72 -router.post('/me/save-mydetails', home.saveMydetails); // AJAX 保存个人信息 71 +router.get('/me/mydetails', auth, home.mydetails); // 个人信息
  72 +router.post('/me/save-mydetails', auth, home.saveMydetails); // AJAX 保存个人信息
73 73
74 router.get('/me/about', home.about); // 个人中心 - 关于我们 74 router.get('/me/about', home.about); // 个人中心 - 关于我们
75 75
76 -router.get('/me/logistic', order.logistic); // 个人中心 - 退换货物流设置页面  
77 -router.get('/me/get-order-logistic-date', order.getOrderLogisticdate); // 个人中心 - 订单物流详情数据 76 +router.get('/me/logistic', auth, order.logistic); // 个人中心 - 退换货物流设置页面
  77 +router.get('/me/get-order-logistic-date', auth, order.getOrderLogisticdate); // 个人中心 - 订单物流详情数据
78 78
79 module.exports = router; 79 module.exports = router;
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 const expressRouter = require('express').Router; 10 const expressRouter = require('express').Router;
11 const cRoot = './controllers'; 11 const cRoot = './controllers';
12 const router = expressRouter(); 12 const router = expressRouter();
  13 +const auth = require(`${global.doraemon}/middleware/auth`);
13 14
14 // 产品 搜索 页面 15 // 产品 搜索 页面
15 const search = require(`${cRoot}/search`); 16 const search = require(`${cRoot}/search`);
@@ -35,7 +36,7 @@ const shop = require(`${cRoot}/shop`); @@ -35,7 +36,7 @@ const shop = require(`${cRoot}/shop`);
35 // router.get('/brand', shop.index); // 品牌 集合页 36 // router.get('/brand', shop.index); // 品牌 集合页
36 router.get('/product/shop/info.json', shop.getShopInfo); // 店铺介绍 37 router.get('/product/shop/info.json', shop.getShopInfo); // 店铺介绍
37 router.get('/product/shop/goods.json', shop.getBrandShopGoods); // 店铺商品列表 38 router.get('/product/shop/goods.json', shop.getBrandShopGoods); // 店铺商品列表
38 -router.post('/product/shop/collect.json', shop.collectShop); // 收藏品牌店铺 39 +router.post('/product/shop/collect.json', auth, shop.collectShop); // 收藏品牌店铺
39 router.get('/product/shop/:domain', shop.index); // 品牌店铺页 40 router.get('/product/shop/:domain', shop.index); // 品牌店铺页
40 router.get('/product/shop/:domain/share', shop.shopShare); // 品牌店铺页分享 41 router.get('/product/shop/:domain/share', shop.shopShare); // 品牌店铺页分享
41 42
@@ -46,7 +47,7 @@ router.get(/\/product\/pro_([\d]+)_([\d]+)\/(.*).html/, detail.index); // 商品 @@ -46,7 +47,7 @@ router.get(/\/product\/pro_([\d]+)_([\d]+)\/(.*).html/, detail.index); // 商品
46 router.get(/\/product\/product_([\d]+)\.json/, detail.product); 47 router.get(/\/product\/product_([\d]+)\.json/, detail.product);
47 router.get(/\/product\/intro_([\d]+)\.json/, detail.intro); 48 router.get(/\/product\/intro_([\d]+)\.json/, detail.intro);
48 router.post(/\product\/cart.json/, detail.addToCart); 49 router.post(/\product\/cart.json/, detail.addToCart);
49 -router.post(/\product\/favorite.json/, detail.favorite); 50 +router.post(/\product\/favorite.json/, auth, detail.favorite);
50 router.get(/\/product\/cart-count.json/, detail.getCartCount); 51 router.get(/\/product\/cart-count.json/, detail.getCartCount);
51 router.get(/\/product\/search_product\.json/, detail.search); 52 router.get(/\/product\/search_product\.json/, detail.search);
52 53
@@ -16,9 +16,7 @@ module.exports = (req, res, next) => { @@ -16,9 +16,7 @@ module.exports = (req, res, next) => {
16 }); 16 });
17 } 17 }
18 18
19 - return res.redirect(helpers.urlFormat('/signin.html', {  
20 - refer: req.originalUrl  
21 - })); 19 + return res.redirect('//www.yohoblk.com');
22 } 20 }
23 21
24 next(); 22 next();