fix: 创建用户的返回值

This commit is contained in:
chaosBreaking
2019-09-01 22:24:10 +08:00
parent 94948063a3
commit 6c2cd15689

View File

@@ -5,10 +5,12 @@ const changePwd = require('../sign/sign.controller').changePasswd;
module.exports = {
changePwd,
async createNewUser (data) {
let { phone, inviter, password } = data;
await (new User({ phone, inviter, password })).save().then(user => user).catch(err => {
let { phone, inviter = '', password } = data;
await (new User({ phone, inviter, password })).save().then(user => {
return user;
}).catch(err => {
mylog.error('创建新用户失败', err);
return null;
throw new Error('创建新用户失败', err);
});
},
async getUserInfo (req, res) {