Showing
4 changed files
with
91 additions
and
2 deletions
@@ -49,6 +49,21 @@ exports.editUserInfo = (req, res, next) => { | @@ -49,6 +49,21 @@ exports.editUserInfo = (req, res, next) => { | ||
49 | }; | 49 | }; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | + * 编辑联系信息 | ||
53 | + * @param {[type]} req [description] | ||
54 | + * @param {[type]} res [description] | ||
55 | + * @return {[type]} [description] | ||
56 | + */ | ||
57 | +exports.editUserContactInfo = (req, res, next) => { | ||
58 | + | ||
59 | + let uid = '8039836'; | ||
60 | + | ||
61 | + // 真实数据输出 | ||
62 | + userService.editUserContactInfo(req, uid).then().catch(next); | ||
63 | + | ||
64 | +}; | ||
65 | + | ||
66 | +/** | ||
52 | * 编辑购物着装、习惯 | 67 | * 编辑购物着装、习惯 |
53 | * @param {[type]} req [description] | 68 | * @param {[type]} req [description] |
54 | * @param {[type]} res [description] | 69 | * @param {[type]} res [description] |
@@ -47,6 +47,9 @@ const getTipConfig = (uid) => { | @@ -47,6 +47,9 @@ const getTipConfig = (uid) => { | ||
47 | }); | 47 | }); |
48 | }; | 48 | }; |
49 | 49 | ||
50 | +/** | ||
51 | + * 修改用户联系信息 | ||
52 | + */ | ||
50 | const editUserInfo = (userInfo) => { | 53 | const editUserInfo = (userInfo) => { |
51 | return api.get('', { | 54 | return api.get('', { |
52 | method: 'app.passport.modifyBase', | 55 | method: 'app.passport.modifyBase', |
@@ -60,6 +63,9 @@ const editUserInfo = (userInfo) => { | @@ -60,6 +63,9 @@ const editUserInfo = (userInfo) => { | ||
60 | }); | 63 | }); |
61 | }; | 64 | }; |
62 | 65 | ||
66 | +/** | ||
67 | + * 修改用户联系信息 | ||
68 | + */ | ||
63 | const editUserContactInfo = (contactInfo) => { | 69 | const editUserContactInfo = (contactInfo) => { |
64 | return api.get('', { | 70 | return api.get('', { |
65 | method: 'web.passport.modifyUserContacts', | 71 | method: 'web.passport.modifyUserContacts', |
@@ -73,15 +79,30 @@ const editUserContactInfo = (contactInfo) => { | @@ -73,15 +79,30 @@ const editUserContactInfo = (contactInfo) => { | ||
73 | }); | 79 | }); |
74 | }; | 80 | }; |
75 | 81 | ||
82 | +/** | ||
83 | + * 修改用户购物着装习惯信息 | ||
84 | + */ | ||
76 | const editUserHabitsInfo = (habitsInfo) => { | 85 | const editUserHabitsInfo = (habitsInfo) => { |
77 | return api.get('', { | 86 | return api.get('', { |
78 | - method: 'web.passport.modifyUserHabits', | 87 | + method: 'web.passport.modifyLikeBrand', |
79 | uid: habitsInfo.uid, | 88 | uid: habitsInfo.uid, |
80 | shopping: habitsInfo.shopping, | 89 | shopping: habitsInfo.shopping, |
81 | dress: habitsInfo.dress | 90 | dress: habitsInfo.dress |
82 | }); | 91 | }); |
83 | }; | 92 | }; |
84 | 93 | ||
94 | +/** | ||
95 | + * 修改用户喜欢品牌 | ||
96 | + */ | ||
97 | +const editUserLikeBrand = (uid, brand) => { | ||
98 | + return api.get('', { | ||
99 | + method: 'web.passport.modifyLikeBrand', | ||
100 | + uid: uid, | ||
101 | + brand: brand, | ||
102 | + dress: habitsInfo.dress | ||
103 | + }); | ||
104 | +}; | ||
105 | + | ||
85 | module.exports = { | 106 | module.exports = { |
86 | getUserInfo, | 107 | getUserInfo, |
87 | editUserInfo, | 108 | editUserInfo, |
@@ -91,5 +112,6 @@ module.exports = { | @@ -91,5 +112,6 @@ module.exports = { | ||
91 | getUserHabitsInfo, | 112 | getUserHabitsInfo, |
92 | editUserHabitsInfo, | 113 | editUserHabitsInfo, |
93 | getUserLikeBrand, | 114 | getUserLikeBrand, |
115 | + editUserLikeBrand, | ||
94 | getTipConfig | 116 | getTipConfig |
95 | }; | 117 | }; |
@@ -520,6 +520,32 @@ const editUserInfo = (req, uid) => { | @@ -520,6 +520,32 @@ const editUserInfo = (req, uid) => { | ||
520 | return respData; | 520 | return respData; |
521 | }; | 521 | }; |
522 | 522 | ||
523 | +const editUserContactInfo = (req, uid) => { | ||
524 | + let contactInfo = {}, | ||
525 | + respData; | ||
526 | + | ||
527 | + contactInfo.uid = uid; | ||
528 | + contactInfo.areaCode = req.body.areaCode; | ||
529 | + contactInfo.phone = req.body.phone; | ||
530 | + contactInfo.mobile = req.body.mobile; | ||
531 | + contactInfo.qq = req.body.qq; | ||
532 | + contactInfo.fullAddress = req.body.fullAddress; | ||
533 | + contactInfo.zipCode = req.body.zipCode; | ||
534 | + | ||
535 | + if (!contactInfo.areaCode || !contactInfo.fullAddress || | ||
536 | + !contactInfo.zipCode || !contactInfo.phone || !contactInfo.mobile) { | ||
537 | + respData = { | ||
538 | + code: 400, | ||
539 | + message: '缺失必填项', | ||
540 | + data: '' | ||
541 | + }; | ||
542 | + } else { | ||
543 | + respData = userApi.editUserContactInfo(contactInfo); | ||
544 | + } | ||
545 | + | ||
546 | + return respData; | ||
547 | +}; | ||
548 | + | ||
523 | const editUserHabitsInfo = (req, uid) => { | 549 | const editUserHabitsInfo = (req, uid) => { |
524 | let habitsInfo = {}, | 550 | let habitsInfo = {}, |
525 | dressArr = [], | 551 | dressArr = [], |
@@ -551,8 +577,30 @@ const editUserHabitsInfo = (req, uid) => { | @@ -551,8 +577,30 @@ const editUserHabitsInfo = (req, uid) => { | ||
551 | return respData; | 577 | return respData; |
552 | }; | 578 | }; |
553 | 579 | ||
580 | +const editUserLikeBrand = (req, uid) => { | ||
581 | + let brand, | ||
582 | + respData; | ||
583 | + | ||
584 | + brand = req.body.brand; | ||
585 | + | ||
586 | + if (!brand) { | ||
587 | + respData = { | ||
588 | + code: 400, | ||
589 | + message: '缺失必填项', | ||
590 | + data: '' | ||
591 | + }; | ||
592 | + | ||
593 | + } else { | ||
594 | + respData = userApi.editUserLikeBrand(uid, brand); | ||
595 | + } | ||
596 | + | ||
597 | + return respData; | ||
598 | +}; | ||
599 | + | ||
554 | module.exports = { | 600 | module.exports = { |
555 | getUserInfo, | 601 | getUserInfo, |
556 | editUserInfo, | 602 | editUserInfo, |
557 | - editUserHabitsInfo | 603 | + editUserContactInfo, |
604 | + editUserHabitsInfo, | ||
605 | + editUserLikeBrand | ||
558 | }; | 606 | }; |
@@ -153,8 +153,12 @@ router.get('/user', [getCommonHeader, getHomeNav], UserController.index); | @@ -153,8 +153,12 @@ router.get('/user', [getCommonHeader, getHomeNav], UserController.index); | ||
153 | 153 | ||
154 | router.post('/user/edituserinfo', UserController.editUserInfo); | 154 | router.post('/user/edituserinfo', UserController.editUserInfo); |
155 | 155 | ||
156 | +router.post('/user/editusercontactinfo', UserController.editUserContactInfo); | ||
157 | + | ||
156 | router.post('/user/edituserhabitsinfo', UserController.editUserHabitsInfo); | 158 | router.post('/user/edituserhabitsinfo', UserController.editUserHabitsInfo); |
157 | 159 | ||
160 | +// router.post('/user/edituserlikebrand', UserController.editUserLikeBrand); | ||
161 | + | ||
158 | router.get('/favorite', FavoriteController.index); | 162 | router.get('/favorite', FavoriteController.index); |
159 | 163 | ||
160 | router.get('/coupons', CouponsController.index); | 164 | router.get('/coupons', CouponsController.index); |
-
Please register or login to post a comment