Authored by wenjiekong

会员修改

... ... @@ -44,8 +44,6 @@ exports.editUserInfo = (req, res, next) => {
let uid = '8039836';
// 真实数据输出
userService.editUserInfo(req, uid).then(result => {
}).catch(next);
userService.editUserInfo(req, uid).then().catch(next);
};
... ...
... ... @@ -193,10 +193,10 @@ const getBirthday = (birthday) => {
};
const formatDate = (y, m, d) => {
m = m < 10 ? ('0' + m) : m;
d = d < 10 ? ('0' + d) : d;
return y + '-' + m + '-' + d;
};
m = m < 10 ? ('0' + m) : m;
d = d < 10 ? ('0' + d) : d;
return y + '-' + m + '-' + d;
};
const isEmpty = (value) => {
return (Array.isArray(value) && value.length === 0) ||
... ... @@ -497,17 +497,17 @@ const editUserInfo = (req, uid) => {
userInfo.nickname = req.body.nickname;
userInfo.username = req.body.username;
userInfo.gender = req.body.gender || 3;
userInfo.birthday = req.body.year == '' ? '' : formatDate(req.body.year, req.body.month, req.body.day);
userInfo.profession = req.body.profession || 0;
userInfo.income = req.body.income || 0;
userInfo.birthday = req.body.year === '' ? '' : formatDate(req.body.year, req.body.month, req.body.day);
userInfo.profession = req.body.profession || 0;
userInfo.income = req.body.income || 0;
if (!userInfo.nickname || !userInfo.username || userInfo.birthday == '') {
if (!userInfo.nickname || !userInfo.username || userInfo.birthday === '') {
respData = {
code: 400,
message: '缺失必填项',
data: ''
}
}else {
};
} else {
respData = userApi.editUserInfo(userInfo);
}
... ...