|
|
|
@ -38,11 +38,14 @@ public class CaptchaUtils {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public static BaseResponse checkCode(Map<String,Object> params) {
|
|
|
|
|
logger.info(">>>>>"+redisUtil.get(Constant.CAPTCHAS + params.get("mobile")));
|
|
|
|
|
String codeStr = String.valueOf(redisUtil.get(Constant.CAPTCHAS + params.get("mobile")));
|
|
|
|
|
if (StrUtil.isBlank(codeStr) || "null".equals(codeStr)) {
|
|
|
|
|
return ResultVOUtils.error(500, "验证码已过期,请重新获取");
|
|
|
|
|
}
|
|
|
|
|
if(!codeStr.equals(params.get("code"))) {
|
|
|
|
|
JSONObject json = JSONObject.parseObject(codeStr);
|
|
|
|
|
logger.info("code:::"+codeStr);
|
|
|
|
|
if(!json.getString("code").equals(params.get("code").toString())) {
|
|
|
|
|
return ResultVOUtils.error(500, "验证码错误,请重新获取");
|
|
|
|
|
}
|
|
|
|
|
redisUtil.del(Constant.CAPTCHAS + params.get("mobile"));
|
|
|
|
@ -69,7 +72,7 @@ public class CaptchaUtils {
|
|
|
|
|
json.put("createTime", System.currentTimeMillis());
|
|
|
|
|
//验证码存入redis中
|
|
|
|
|
redisUtil.set(Constant.CAPTCHAS + params.get("mobile"), json, 300L);
|
|
|
|
|
return ResultVOUtils.success("发送成功" + " " + mobile_code);
|
|
|
|
|
return ResultVOUtils.success("发送成功");
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(500, "验证码发送失败");
|
|
|
|
|
}
|
|
|
|
|