|
|
|
@ -161,18 +161,18 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity |
|
|
|
|
String code = utils.sendCode(); |
|
|
|
|
CheckVo checkVo = new CheckVo(); |
|
|
|
|
|
|
|
|
|
if (type==1){//通过手机验证
|
|
|
|
|
if (type==1){//通过邮箱验证
|
|
|
|
|
EmailUtils.sendEmail(entity.getEmail(),code); |
|
|
|
|
checkVo.setCheckCode(code).setSetTime(utils.letTimes(5)).setUserId(entity.getUserId()); |
|
|
|
|
checkVo.setCheckCode(code).setSetTime(utils.letTimes(5)).setUserId(entity.getUserId()).setTypes(1); |
|
|
|
|
boolean result = userDao.saveCheckCode(checkVo); |
|
|
|
|
if (result) { |
|
|
|
|
return R.ok().put("data",entity); |
|
|
|
|
}else { |
|
|
|
|
return R.error("保存验证码异常"); |
|
|
|
|
} |
|
|
|
|
}else if (type==2){//通过邮箱验证
|
|
|
|
|
}else if (type==2){//通过手机验证
|
|
|
|
|
SendSMS.sendCode(entity.getPhone(),code); |
|
|
|
|
checkVo.setCheckCode(code).setSetTime(utils.letTimes(5)).setUserId(entity.getUserId()); |
|
|
|
|
checkVo.setCheckCode(code).setSetTime(utils.letTimes(5)).setUserId(entity.getUserId()).setTypes(2); |
|
|
|
|
boolean result = userDao.saveCheckPhoneCode(checkVo); |
|
|
|
|
if (result) { |
|
|
|
|
return R.ok().put("data",entity); |
|
|
|
@ -191,11 +191,16 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R checkCode(CheckVo checkVo) { |
|
|
|
|
|
|
|
|
|
String checkCode = userInfoDao.checkCode(checkVo); |
|
|
|
|
if (checkCode.equals(checkVo.getCode())){ |
|
|
|
|
if (checkCode==null){ |
|
|
|
|
return R.error("验证码已过期或不存在"); |
|
|
|
|
}else if (checkCode.equals(checkVo.getCode())){ |
|
|
|
|
return R.ok(); |
|
|
|
|
}else { |
|
|
|
|
return R.error("failure"); |
|
|
|
|
} |
|
|
|
|
return R.error(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|