Skip to content

Commit

Permalink
优化验证码服务
Browse files Browse the repository at this point in the history
  • Loading branch information
TreasureJade committed Dec 11, 2019
1 parent c5ba78b commit 1d0afea
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,15 @@ public ResultVO insertUser(UserInsertForm userInsertForm) {
public ResultVO getValidationCode(String phoneNumber) {
String code = RandomUtil.setCode();
try {
AliyunSmsUtils.sendInsertUserMsg(phoneNumber, code, TemplateCodeEnum.INSERTUSER.getValue());
redisService.set(PhoneCodeKey.phoneCodeKey, phoneNumber, code);
return ResultVOUtil.success(code);
if (AliyunSmsUtils.sendInsertUserMsg(phoneNumber, code, TemplateCodeEnum.INSERTUSER.getValue())) {
redisService.set(PhoneCodeKey.phoneCodeKey, phoneNumber, code);
return ResultVOUtil.success(code);
}
} catch (ClientException e) {
log.info("失败原因: {}", e.getMessage());
return ResultVOUtil.error(ResultEnum.PHONE_CODE_SEND_ERROR);
}
return ResultVOUtil.error(ResultEnum.SERVER_ERROR);
}

@Override
Expand Down

0 comments on commit 1d0afea

Please sign in to comment.