Authored by wenjiekong

添加修改联系信息等接口

... ... @@ -49,6 +49,21 @@ exports.editUserInfo = (req, res, next) => {
};
/**
* 编辑联系信息
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.editUserContactInfo = (req, res, next) => {
let uid = '8039836';
// 真实数据输出
userService.editUserContactInfo(req, uid).then().catch(next);
};
/**
* 编辑购物着装、习惯
* @param {[type]} req [description]
* @param {[type]} res [description]
... ...
... ... @@ -47,6 +47,9 @@ const getTipConfig = (uid) => {
});
};
/**
* 修改用户联系信息
*/
const editUserInfo = (userInfo) => {
return api.get('', {
method: 'app.passport.modifyBase',
... ... @@ -60,6 +63,9 @@ const editUserInfo = (userInfo) => {
});
};
/**
* 修改用户联系信息
*/
const editUserContactInfo = (contactInfo) => {
return api.get('', {
method: 'web.passport.modifyUserContacts',
... ... @@ -73,15 +79,30 @@ const editUserContactInfo = (contactInfo) => {
});
};
/**
* 修改用户购物着装习惯信息
*/
const editUserHabitsInfo = (habitsInfo) => {
return api.get('', {
method: 'web.passport.modifyUserHabits',
method: 'web.passport.modifyLikeBrand',
uid: habitsInfo.uid,
shopping: habitsInfo.shopping,
dress: habitsInfo.dress
});
};
/**
* 修改用户喜欢品牌
*/
const editUserLikeBrand = (uid, brand) => {
return api.get('', {
method: 'web.passport.modifyLikeBrand',
uid: uid,
brand: brand,
dress: habitsInfo.dress
});
};
module.exports = {
getUserInfo,
editUserInfo,
... ... @@ -91,5 +112,6 @@ module.exports = {
getUserHabitsInfo,
editUserHabitsInfo,
getUserLikeBrand,
editUserLikeBrand,
getTipConfig
};
... ...
... ... @@ -520,6 +520,32 @@ const editUserInfo = (req, uid) => {
return respData;
};
const editUserContactInfo = (req, uid) => {
let contactInfo = {},
respData;
contactInfo.uid = uid;
contactInfo.areaCode = req.body.areaCode;
contactInfo.phone = req.body.phone;
contactInfo.mobile = req.body.mobile;
contactInfo.qq = req.body.qq;
contactInfo.fullAddress = req.body.fullAddress;
contactInfo.zipCode = req.body.zipCode;
if (!contactInfo.areaCode || !contactInfo.fullAddress ||
!contactInfo.zipCode || !contactInfo.phone || !contactInfo.mobile) {
respData = {
code: 400,
message: '缺失必填项',
data: ''
};
} else {
respData = userApi.editUserContactInfo(contactInfo);
}
return respData;
};
const editUserHabitsInfo = (req, uid) => {
let habitsInfo = {},
dressArr = [],
... ... @@ -551,8 +577,30 @@ const editUserHabitsInfo = (req, uid) => {
return respData;
};
const editUserLikeBrand = (req, uid) => {
let brand,
respData;
brand = req.body.brand;
if (!brand) {
respData = {
code: 400,
message: '缺失必填项',
data: ''
};
} else {
respData = userApi.editUserLikeBrand(uid, brand);
}
return respData;
};
module.exports = {
getUserInfo,
editUserInfo,
editUserHabitsInfo
editUserContactInfo,
editUserHabitsInfo,
editUserLikeBrand
};
... ...
... ... @@ -153,8 +153,12 @@ router.get('/user', [getCommonHeader, getHomeNav], UserController.index);
router.post('/user/edituserinfo', UserController.editUserInfo);
router.post('/user/editusercontactinfo', UserController.editUserContactInfo);
router.post('/user/edituserhabitsinfo', UserController.editUserHabitsInfo);
// router.post('/user/edituserlikebrand', UserController.editUserLikeBrand);
router.get('/favorite', FavoriteController.index);
router.get('/coupons', CouponsController.index);
... ...