短信验证码控制器

This commit is contained in:
clay 2021-08-13 11:33:35 +08:00
parent 58b7a74c6f
commit ba7b2558fb
1 changed files with 3 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -50,8 +51,8 @@ public class SmsController {
} }
code = SMSConfig.code(); code = SMSConfig.code();
// todo 设置验证码时效性 // todo 设置验证码时效性
// redisCache.setCacheObject(Constants.PHONE_CODE_KEY+phone,code,10, TimeUnit.MINUTES); redisCache.setCacheObject(Constants.PHONE_CODE_KEY+phone,code,10, TimeUnit.MINUTES);
redisCache.setCacheObject(Constants.PHONE_CODE_KEY+phone,code); // redisCache.setCacheObject(Constants.PHONE_CODE_KEY+phone,code);
boolean state = SMSConfig.smsCode(phone,code); boolean state = SMSConfig.smsCode(phone,code);
if (state){ if (state){
return AjaxResult.success("验证码发送成功"); return AjaxResult.success("验证码发送成功");