提交 9cf16a8e 编写于 作者: Chongwen.jiang's avatar Chongwen.jiang

添加日志。。.解决调用风控记录数据重复问题

上级 8dfcfea6
流水线 #23612 已失败 于阶段
in 0 second
......@@ -72,4 +72,7 @@ public class Constants {
/** h5拼图缓存时长*/
public static final int JIGSAW_CODE_EXPIRE_SECONDS = 60;
/** 风控记录过数据 */
public static final String RC_RECORDED_DATA_KEY = "risk-{mobile}-{ip}";
}
......@@ -194,12 +194,19 @@ public class AuthCodeServiceImpl implements AuthCodeService {
throw new PicaWarnException(PicaResultCode.PARAM_IS_INVALID.code(), PicaResultCode.PARAM_IS_INVALID.message());
}
// 1、调用风控服务,是否需要触发拼图验证
BaseRequest rcReq = new BaseRequest();
rcReq.setMobile(paramReq.getMobile());
int needCheck = this.rcValidate(request, rcReq, "{}", paramReq.getSourceType());
/*int needCheck = this.rcValidate(request, rcReq, "{}", paramReq.getSourceType());
if (needCheck <= 0) {
// 不需要拼图验证,直接去发短信
return needCheck;
}*/
BaseRequest rcReq = new BaseRequest();
rcReq.setMobile(paramReq.getMobile());
String rcRecordedKey = Constants.RC_RECORDED_DATA_KEY.replace("{mobile}", paramReq.getMobile())
.replace("{ip}", IPUtil.getIpAdrress(request));
int needCheck = 1;
if (cacheClient.exists(rcRecordedKey)) {
// 不需要拼图验证,直接去发短信, 不用记录风控数据(在调用获取拼图码时已经校验过,记录了数据)
return -1;
}
String capCode = paramReq.getCapCode();
int xPos = paramReq.getxPos();
......@@ -208,8 +215,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
Long count = cacheClient.decr(key);
logger.info("validateJigsawCode-count:{}", count);
if (count.equals(99)) {
// a、不需要拼图验证
// b、本应需要拼图验证,但是在调用获取拼图数据接口时报错了,也直接去发送短信
// a、本应需要拼图验证,但是在调用获取拼图数据接口时报错了,也直接去发送短信
return needCheck;
}
}
......@@ -296,9 +302,11 @@ public class AuthCodeServiceImpl implements AuthCodeService {
}
}
} else {
// 不需要拼图验证
logger.info("getJigsawCode-don't need jigsaw code");
cacheClient.set(key, 100, Constants.JIGSAW_CODE_EXPIRE_SECONDS);
// 不需要拼图验证, 风控允许直接发送验证码记录缓存
String key2 = Constants.RC_RECORDED_DATA_KEY.replace("{mobile}", mobile)
.replace("{ip}", IPUtil.getIpAdrress(request));
cacheClient.set(key2, mobile, Constants.JIGSAW_CODE_EXPIRE_SECONDS);
}
return data;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册