正在显示
1 个修改的文件
包含
3 行增加
和
2 行删除
| @@ -47,12 +47,13 @@ userService.prototype.login = async(loginName,pw,userEmail) => { | @@ -47,12 +47,13 @@ userService.prototype.login = async(loginName,pw,userEmail) => { | ||
| 47 | {loginName:loginName} | 47 | {loginName:loginName} |
| 48 | ]; | 48 | ]; |
| 49 | let User = await userModel.find({where:{$or:queryData}}) | 49 | let User = await userModel.find({where:{$or:queryData}}) |
| 50 | - let attachment = await attachmentModel.findOne({where:{businessId:User.id}}) | ||
| 51 | if(!User){ | 50 | if(!User){ |
| 52 | return {code:300,msg:'用户不存在'} | 51 | return {code:300,msg:'用户不存在'} |
| 53 | }else if(User.password != saitMd5.md5(pw)){ | 52 | }else if(User.password != saitMd5.md5(pw)){ |
| 54 | return {code:300,msg:'密码不正确'} | 53 | return {code:300,msg:'密码不正确'} |
| 55 | } | 54 | } |
| 55 | + let attachment = await attachmentModel.findOne({where:{businessId:User.id}}) | ||
| 56 | + | ||
| 56 | let token = await tokenUtil.getSession(User); | 57 | let token = await tokenUtil.getSession(User); |
| 57 | if(attachment){ | 58 | if(attachment){ |
| 58 | token.userPhoto = attachment.path | 59 | token.userPhoto = attachment.path |
| @@ -173,7 +174,7 @@ userService.prototype.updatePwByTelphone = async(tel,pw) => { | @@ -173,7 +174,7 @@ userService.prototype.updatePwByTelphone = async(tel,pw) => { | ||
| 173 | var t = await sequelize.transaction({ autocommit: true }) | 174 | var t = await sequelize.transaction({ autocommit: true }) |
| 174 | let User = await userModel.findOne({where:{userMobile:tel}}) | 175 | let User = await userModel.findOne({where:{userMobile:tel}}) |
| 175 | if(!User){ | 176 | if(!User){ |
| 176 | - t.rollback | 177 | + t.rollback() |
| 177 | return {code:0,msg:'用户不存在'} | 178 | return {code:0,msg:'用户不存在'} |
| 178 | } | 179 | } |
| 179 | let updateUser = await userModel.update({password:pw.md5Pass,salt:pw.salt},{where:{userMobile:tel}}); | 180 | let updateUser = await userModel.update({password:pw.md5Pass,salt:pw.salt},{where:{userMobile:tel}}); |
-
请 注册 或 登录 后发表评论