|
|
@ -161,18 +161,18 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity |
|
|
|
String code = utils.sendCode(); |
|
|
|
String code = utils.sendCode(); |
|
|
|
CheckVo checkVo = new CheckVo(); |
|
|
|
CheckVo checkVo = new CheckVo(); |
|
|
|
|
|
|
|
|
|
|
|
if (type==1){//通过手机验证
|
|
|
|
if (type==1){//通过邮箱验证
|
|
|
|
EmailUtils.sendEmail(entity.getEmail(),code); |
|
|
|
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); |
|
|
|
boolean result = userDao.saveCheckCode(checkVo); |
|
|
|
if (result) { |
|
|
|
if (result) { |
|
|
|
return R.ok().put("data",entity); |
|
|
|
return R.ok().put("data",entity); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
return R.error("保存验证码异常"); |
|
|
|
return R.error("保存验证码异常"); |
|
|
|
} |
|
|
|
} |
|
|
|
}else if (type==2){//通过邮箱验证
|
|
|
|
}else if (type==2){//通过手机验证
|
|
|
|
SendSMS.sendCode(entity.getPhone(),code); |
|
|
|
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); |
|
|
|
boolean result = userDao.saveCheckPhoneCode(checkVo); |
|
|
|
if (result) { |
|
|
|
if (result) { |
|
|
|
return R.ok().put("data",entity); |
|
|
|
return R.ok().put("data",entity); |
|
|
@ -191,11 +191,16 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R checkCode(CheckVo checkVo) { |
|
|
|
public R checkCode(CheckVo checkVo) { |
|
|
|
|
|
|
|
|
|
|
|
String checkCode = userInfoDao.checkCode(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(); |
|
|
|
return R.ok(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
return R.error("failure"); |
|
|
|
} |
|
|
|
} |
|
|
|
return R.error(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|