增加万能验证码

This commit is contained in:
GYJ
2024-12-14 10:27:01 +08:00
parent 88bb7e54a5
commit 317f761aea

View File

@@ -883,9 +883,12 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
if(StringUtils.isEmpty(msg)){ if(StringUtils.isEmpty(msg)){
return Result.error("验证码不能为空!"); return Result.error("验证码不能为空!");
} }
Msg msg1 = msgDao.findByPhoneAndCode(phone, msg); Msg msg1 = null;
if(msg1==null){ if (!"147258".equals(msg)) {
return Result.error("验证码不正确!"); msg1 = msgDao.findByPhoneAndCode(phone, msg);
if (msg1 == null) {
return Result.error("验证码不正确!");
}
} }
userInfo = new UserEntity(); userInfo = new UserEntity();
UserEntity userEntity=null; UserEntity userEntity=null;
@@ -925,7 +928,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
baseMapper.insert(userInfo); baseMapper.insert(userInfo);
userInfo.setInvitationCode(InvitationCodeUtil.toSerialCode(userInfo.getUserId())); userInfo.setInvitationCode(InvitationCodeUtil.toSerialCode(userInfo.getUserId()));
baseMapper.updateById(userInfo); baseMapper.updateById(userInfo);
msgDao.deleteById(msg1.getId()); if (msg1 != null) {
msgDao.deleteById(msg1.getId());
}
if(userEntity!=null){ if(userEntity!=null){
inviteService.saveBody(userInfo.getUserId(),userEntity); inviteService.saveBody(userInfo.getUserId(),userEntity);
} }