|
|
@@ -439,6 +439,8 @@ public class RiskServiceImpl implements RiskService {
|
|
|
.count();
|
|
|
//三天内注册的渠道数小于预设的渠道数通过校验,否则风控锁定用户
|
|
|
if(ditchCount<uidCount)return;
|
|
|
+ log.warn("[risk 322] appId:{} userId:{} ditchCount:{} uidCount:{}", dyzUser.getAppId(),
|
|
|
+ dyzUser.getUserId(), ditchCount, uidCount);
|
|
|
riskLockUser(dyzUser,"322","系统判定重复刷单用户限制",getTipsMsg());
|
|
|
}
|
|
|
|
|
|
@@ -476,6 +478,8 @@ public class RiskServiceImpl implements RiskService {
|
|
|
}
|
|
|
int ipSameCount = Integer.parseInt(configMap.get("ipSameCount"));
|
|
|
if(intCount > ipSameCount){//校验同IP登录次数大于预设值,锁定用户
|
|
|
+ log.warn("[risk default] appId:{} userId:{} intCount:{} ipSameCount:{}", dyzUser.getAppId(),
|
|
|
+ dyzUser.getUserId(), intCount, ipSameCount);
|
|
|
riskLockUser(dyzUser,dyzUser.getRiskCode(),"系统判定重复刷单用户限制",getTipsMsg());
|
|
|
}
|
|
|
}
|
|
|
@@ -502,11 +506,8 @@ public class RiskServiceImpl implements RiskService {
|
|
|
@Override
|
|
|
public Result<?> checkAdRisk(YtUser dyzUser) {
|
|
|
//查询当前用户今日有被解封则直接放行
|
|
|
- long start = System.currentTimeMillis();
|
|
|
List<RiskDeblockingListView> vo = riskManageMapper.queryTodayDeblock(dyzUser.getUserId());
|
|
|
if(CollUtil.isNotEmpty(vo)){
|
|
|
- log.debug(StrUtil.format("[checkAdRisk] appId:{} (end - start):{}",
|
|
|
- dyzUser.getAppId(), System.currentTimeMillis() - start));
|
|
|
return Result.resultOk(RepMessage.QUERY_SUCCESS);
|
|
|
}
|
|
|
YtApp ytApp = appMapper.selectRiskApp(dyzUser.getAppId());
|
|
|
@@ -516,8 +517,6 @@ public class RiskServiceImpl implements RiskService {
|
|
|
JSONObject object = JSON.parseObject(JSON.toJSONString(o));
|
|
|
List<YtDyzAdRecord> adRecords = JSONArray.parseArray(object.getString("data"), YtDyzAdRecord.class);
|
|
|
if(CollUtil.isEmpty(adRecords)){
|
|
|
- log.debug(StrUtil.format("[checkAdRisk] appId:{} (end - start):{}",
|
|
|
- dyzUser.getAppId(), System.currentTimeMillis() - start));
|
|
|
return Result.resultOk(RepMessage.QUERY_SUCCESS);
|
|
|
}
|
|
|
try {
|
|
|
@@ -538,12 +537,8 @@ public class RiskServiceImpl implements RiskService {
|
|
|
checkRisk766(dyzUser, adRecords);
|
|
|
}
|
|
|
} catch (CommonException e) {
|
|
|
- log.debug(StrUtil.format("[checkAdRisk] appId:{} (end - start):{}",
|
|
|
- dyzUser.getAppId(), System.currentTimeMillis() - start));
|
|
|
return Result.resultFail(StatusCode.ACCESS_RISK_ERROR, e.getMessage());
|
|
|
}
|
|
|
- log.debug(StrUtil.format("[checkAdRisk] appId:{} (end - start):{}",
|
|
|
- dyzUser.getAppId(), System.currentTimeMillis() - start));
|
|
|
return Result.resultOk(RepMessage.QUERY_SUCCESS);
|
|
|
}
|
|
|
|
|
|
@@ -740,16 +735,7 @@ public class RiskServiceImpl implements RiskService {
|
|
|
*/
|
|
|
private void riskLockUser(YtUser dyzUser,String riskCode, String tempName, String errMsg) {
|
|
|
//增加用户风控记录
|
|
|
- RiskBannedParam param = new RiskBannedParam();
|
|
|
- param.setUserId(dyzUser.getUserId());
|
|
|
- param.setAppId(dyzUser.getAppId());
|
|
|
- param.setDitChId(dyzUser.getDitchId());
|
|
|
- param.setBannedLimit(1*24);
|
|
|
- param.setOperator("系统风控");
|
|
|
- param.setBannedReason(tempName);
|
|
|
- param.setOperatorName("系统风控");
|
|
|
- param.setAgentId(configMapper.getApplicationOwner(dyzUser.getAppId()));
|
|
|
- addBannedRecord(Collections.singletonList(dyzUser.getUserId()),param);
|
|
|
+ addSystemBanned(dyzUser, tempName);
|
|
|
YtApp app = appMapper.selectRiskApp(dyzUser.getAppId());
|
|
|
YtPlatformUserApp appInfo = appMapper.selectParentApp(app.getSuperiorId());
|
|
|
scheduledExecutorService.schedule(()->{
|
|
|
@@ -765,6 +751,23 @@ public class RiskServiceImpl implements RiskService {
|
|
|
throw new CustomerException(errMsg);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 田家庵系统风控日志记录
|
|
|
+ */
|
|
|
+ private void addSystemBanned(YtUser dyzUser, String bannedReason) {
|
|
|
+ String operator = "系统风控";
|
|
|
+ RiskBannedParam param = new RiskBannedParam();
|
|
|
+ param.setUserId(dyzUser.getUserId());
|
|
|
+ param.setAppId(dyzUser.getAppId());
|
|
|
+ param.setDitChId(dyzUser.getDitchId());
|
|
|
+ param.setBannedLimit(1 * 24);
|
|
|
+ param.setOperator(operator);
|
|
|
+ param.setBannedReason(bannedReason);
|
|
|
+ param.setOperatorName(operator);
|
|
|
+ param.setAgentId(configMapper.getApplicationOwner(dyzUser.getAppId()));
|
|
|
+ addBannedRecord(Collections.singletonList(dyzUser.getUserId()),param);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改用户信息
|
|
|
*/
|
|
|
@@ -1015,7 +1018,6 @@ public class RiskServiceImpl implements RiskService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Result<?> checkLoginRisk(YtUser dyzUser) {
|
|
|
- long start = System.currentTimeMillis();
|
|
|
// 20250908 移除游客登陆校验
|
|
|
// // 游客登陆风控校验
|
|
|
// RiskTemplateView view = configMapper.getByCode(dyzUser.getAppId() + "-323");
|
|
|
@@ -1030,25 +1032,15 @@ public class RiskServiceImpl implements RiskService {
|
|
|
// 已通过用户 不再进行校验
|
|
|
String cacheKey = StrUtil.format("visitor:login_validity_{}_{}", dyzUser.getAppId(), dyzUser.getUserId());
|
|
|
if (redisService.hasKey(cacheKey)) {
|
|
|
- log.info("visitor[{}] last check success time < {} h", dyzUser.getUserId(), loginCheckValidityPeriod);
|
|
|
- log.debug(StrUtil.format("[checkLoginRisk] appId:{} (end - start):{}",
|
|
|
- dyzUser.getAppId(), System.currentTimeMillis() - start));
|
|
|
+ log.info("[visitor risk]appId:{} userId:{} last check success time < {} h",
|
|
|
+ dyzUser.getAppId(), dyzUser.getUserId(), loginCheckValidityPeriod);
|
|
|
return Result.resultOk(RepMessage.RISK_SUCCESS);
|
|
|
}
|
|
|
boolean checkResult = checkVisitorRisk(dyzUser);
|
|
|
if (!checkResult) {
|
|
|
// 20250911 需求调整 锁定用户
|
|
|
//增加用户风控记录
|
|
|
- RiskBannedParam param = new RiskBannedParam();
|
|
|
- param.setUserId(dyzUser.getUserId());
|
|
|
- param.setAppId(dyzUser.getAppId());
|
|
|
- param.setDitChId(dyzUser.getDitchId());
|
|
|
- param.setBannedLimit(1*24);
|
|
|
- param.setBannedReason("预估收益不到上限游客用户风控");
|
|
|
- param.setOperator("系统风控");
|
|
|
- param.setOperatorName("系统风控");
|
|
|
- param.setAgentId(configMapper.getApplicationOwner(dyzUser.getAppId()));
|
|
|
- addBannedRecord(Collections.singletonList(dyzUser.getUserId()),param);
|
|
|
+ addSystemBanned(dyzUser, "预估收益不到上限游客用户风控");
|
|
|
YtPlatformUserApp userApp;
|
|
|
if (dyzUser.getIosId() != null) {
|
|
|
userApp = appMapper.selectParentApp(dyzUser.getAppId());
|
|
|
@@ -1065,15 +1057,11 @@ public class RiskServiceImpl implements RiskService {
|
|
|
feignInvoker.invoke(userApp.getServiceName(), "updateUserInfo",next);
|
|
|
},300, TimeUnit.MILLISECONDS);
|
|
|
//修改为解锁用户存入redis 24小时后进行解锁
|
|
|
- log.debug(StrUtil.format("[checkLoginRisk] appId:{} (end - start):{}",
|
|
|
- dyzUser.getAppId(), System.currentTimeMillis() - start));
|
|
|
return Result.resultErr(RepMessage.RISK_VISITOR_LOWER_VALUE);
|
|
|
}
|
|
|
// return checkResult ? Result.resultOk(RepMessage.RISK_SUCCESS) : Result.resultErr(RepMessage.RISK_VISITOR_LOWER_VALUE);
|
|
|
redisService.setTimeOutHoursStr(cacheKey, "ok", loginCheckValidityPeriod);
|
|
|
}
|
|
|
- log.debug(StrUtil.format("[checkLoginRisk] appId:{} (end - start):{}",
|
|
|
- dyzUser.getAppId(), System.currentTimeMillis() - start));
|
|
|
return Result.resultOk(RepMessage.RISK_SUCCESS);
|
|
|
}
|
|
|
|
|
|
@@ -1095,6 +1083,8 @@ public class RiskServiceImpl implements RiskService {
|
|
|
int ditchCount = (int)o;
|
|
|
//三天内注册的渠道数小于预设的渠道数通过校验,否则风控锁定用户
|
|
|
if(ditchCount<uidCount)return;
|
|
|
+ log.warn("[risk 323]appId:{} userId:{} ditchCount:{} uidCount:{}",
|
|
|
+ dyzUser.getAppId(), dyzUser.getUserId(), ditchCount, uidCount);
|
|
|
riskLockUser(dyzUser,"323",hours+"小时内登录渠道已达上限",getTipsMsg());
|
|
|
}
|
|
|
|
|
|
@@ -1175,6 +1165,8 @@ public class RiskServiceImpl implements RiskService {
|
|
|
if(regCount<uidCount){
|
|
|
return Result.resultOk(RepMessage.RISK_SUCCESS);
|
|
|
}
|
|
|
+ log.warn(StrUtil.format("[risk 333]]appId:{} userId:{}, regCount:{} uidCount:{}",
|
|
|
+ dyzUser.getAppId(), dyzUser.getUserId(), regCount, uidCount));
|
|
|
return Result.resultErr(hours+RepMessage.DITCH_REG_LIMIT);
|
|
|
}
|
|
|
|
|
|
@@ -1193,8 +1185,6 @@ public class RiskServiceImpl implements RiskService {
|
|
|
JSONObject object = JSON.parseObject(JSON.toJSONString(o));
|
|
|
List<YtDyzAdRecord> adRecords = JSONArray.parseArray(object.getString("data"), YtDyzAdRecord.class);
|
|
|
if(CollUtil.isEmpty(adRecords)){
|
|
|
- log.debug(StrUtil.format("[checkAdRisk766] appId:{} (end - start):{}",
|
|
|
- dyzUser.getAppId(), System.currentTimeMillis() - start));
|
|
|
return Result.resultOk(RepMessage.QUERY_SUCCESS);
|
|
|
}
|
|
|
//过滤出当日的激励视频数据 按照时间正序排以便筛选每日前几条激励视频
|
|
|
@@ -1206,13 +1196,9 @@ public class RiskServiceImpl implements RiskService {
|
|
|
// 校验风控766规则
|
|
|
checkRisk766(dyzUser, adRecords);
|
|
|
} catch (CommonException e) {
|
|
|
- log.debug(StrUtil.format("[checkAdRisk766] appId:{} (end - start):{}",
|
|
|
- dyzUser.getAppId(), System.currentTimeMillis() - start));
|
|
|
return Result.resultFail(StatusCode.ACCESS_ERR, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
- log.debug(StrUtil.format("[checkAdRisk766] appId:{} (end - start):{}",
|
|
|
- dyzUser.getAppId(), System.currentTimeMillis() - start));
|
|
|
return Result.resultOk(RepMessage.QUERY_SUCCESS);
|
|
|
}
|
|
|
|