【validator】整理validator模块

pull/3/head
fengshuonan 2021-02-08 10:52:50 +08:00
parent 576fa5aeb7
commit f57362b724
3 changed files with 7 additions and 3 deletions

View File

@ -11,6 +11,6 @@ public interface CaptchaConstants {
/**
*
*/
String CAPTCHA_CACHE_KEY_PREFIX = "KAPTCHA_KEY";
String CAPTCHA_CACHE_KEY_PREFIX = "CAPTCHA_KEY";
}

View File

@ -1,5 +1,6 @@
package cn.stylefeng.roses.kernel.validator.exception;
import cn.hutool.core.util.StrUtil;
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.validator.constants.ValidatorConstants;
@ -12,8 +13,8 @@ import cn.stylefeng.roses.kernel.validator.constants.ValidatorConstants;
*/
public class CountValidateException extends ServiceException {
public CountValidateException(AbstractExceptionEnum exception, String userTip) {
super(ValidatorConstants.VALIDATOR_MODULE_NAME, exception.getErrorCode(), userTip);
public CountValidateException(AbstractExceptionEnum exception, Object... params) {
super(ValidatorConstants.VALIDATOR_MODULE_NAME, exception.getErrorCode(), StrUtil.format(exception.getUserTip(), params));
}
public CountValidateException(AbstractExceptionEnum exception) {

View File

@ -35,11 +35,14 @@ public class CaptchaService implements CaptchaApi {
if (StrUtil.isAllEmpty(verKey, verCode)) {
return false;
}
if (!verCode.trim().toLowerCase().equals(cacheOperatorApi.get(verKey))) {
return false;
}
//删除缓存中验证码
cacheOperatorApi.remove(verKey);
return true;
}