router.js
3.96 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
/**
* router of sub app me
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2016/07/04
*/
'use strict';
const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const auth = require(`${global.middleware}/auth`);
const csurf = require('csurf');
const csrf = csurf();
// 订单
const order = require(`${cRoot}/order`);
const address = require(`${cRoot}/address`);
const currency = require(`${cRoot}/currency`);
const setting = require(`${cRoot}/setting`);
const account = require(`${cRoot}/account`);
const favorite = require(`${cRoot}/favorite`);
const returns = require(`${cRoot}/returns`);
// 个人中心首页/订单
router.get(['/', '/order'], auth, order.index);
router.get(['/', '/order/detail'], auth, order.detail);
router.get('/getOrderList', order.getOrderList);
router.get('/getOrderTotal', order.getOrderTotal);
router.get('/deleteOrder', order.deleteOrder);
router.get('/cancelOrder', order.cancelOrder);
router.get('/getCancelOrderReason', order.getCancelOrderReason);
router.get('/getExpressInfo', order.getExpressInfo);
router.get('/editOrder', order.editOrder);
router.get('/reAdd', order.reAdd);
router.get('/confirmReceive', order.confirmReceive);
// 退换货
router.get('/return', auth, returns.index);
router.get('/return/refund', auth, returns.refund);
router.get('/return/exchange', auth, returns.exchange);
router.get('/return/refund/detail', auth, returns.refundDetail);
router.get('/return/exchange/detail', auth, returns.exchangeDeatail);
router.post('/return/refund/apply', auth, returns.refundApply);
router.post('/return/cancel', auth, returns.cancelApply);
router.post('/return/setEepress', auth, returns.setEepress);
router.get('/return/getProductInfo', returns.getProductInfo);
router.get('/return/submitExchange', auth, returns.exchangeSubmit);
router.get('/return/unionInfo', returns.getUnion);
router.get('/return/getChangeType', returns.getChangeType);
// 个人中心首页/收货地址
router.get('/address', auth, address.index);
router.post('/address/add', auth, address.addAddressData);
router.post('/address/update', auth, address.updateAddressData);
router.post('/address/del', auth, address.delAddressData);
router.post('/address/default', auth, address.setDefaultAddress);
router.get('/address/list', address.getAddressList); // 获取地址列表
router.get('/address/areas/:areaId', address.getAddressData);
// 个人中心首页/有货币
router.get('/currency', auth, currency.index);
// 个人中心首页/个人设置
router.get('/setting', csrf, auth, setting.index); // 个人首页
router.post('/setting/editUserInfo', csrf, auth, setting.editUserInfo); // 修改接口
// 第一步
router.get('/setting/step1/:type', csrf, auth, setting.bindMobile, setting.bindEmail, setting.modifyType);
// 第一步post
router.post('/setting/step1/:type', csrf, auth, setting.validate1);
// 第二步
router.get('/setting/step2/:type', csrf, auth, setting.edit);
// 第二步post
router.post('/setting/step2/:type', csrf, auth, setting.validate2);
// 第三步
router.get('/setting/step3/:type', auth, setting.success);
router.post('/setting/modifyHead', auth, setting.getfilePath, setting.modifyHead);
router.post('/account/changePwd', auth, account.changePwd);
router.post('/account/sendMobileMsg', auth, account.sendMobileMsg);
router.post('/account/checkVerifyMsg', auth, account.checkVerifyMsg);
router.post('/account/sendVerifyEmail', auth, account.sendVerifyEmail);
router.post('/account/checkVerifyMobile', auth, account.checkVerifyMobile);
// 我的收藏
router.get('/collection', auth, favorite.goods);
router.get('/collection/brand', auth, favorite.brand);
router.get('/collection/editorial', auth, favorite.editorial);
router.post('/collection/cancel', auth, favorite.cancel);
router.post('/collection/cancel/multi', auth, favorite.cancelMulti);
router.post('/collection/editorial/cancel', auth, favorite.editorialCancel);
module.exports = router;