diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/YaoDuApiService.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/YaoDuApiService.java index 4e559ba..a189277 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/YaoDuApiService.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/YaoDuApiService.java @@ -135,7 +135,7 @@ public interface YaoDuApiService { //验证规则 - Result sendMsgSecCheck(String openid,String content); + Integer sendMsgSecCheck(String openid,String content) ; } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java index f783597..99faac2 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java @@ -247,7 +247,6 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { Page page1 = cityTrendsService .lambdaQuery() .orderByDesc(CityTrends::getCreateTime) - .eq(CityTrends::getIsState,1) .page(page); if(StringUtils.isNotBlank(classId)){ @@ -255,7 +254,6 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { .lambdaQuery() .eq(CityTrends::getClassId,classId) .orderByDesc(CityTrends::getCreateTime) - .eq(CityTrends::getIsState,1) .page(page); @@ -474,7 +472,11 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { //验证 - this.sendMsgSecCheck(hanHaiMember.getAppletOpenid(), cityTrends.getTitle()); + Integer i = this.sendMsgSecCheck(hanHaiMember.getAppletOpenid(), cityTrends.getTitle()); + if(i>100){ + return Result.error("内容含有敏感词"); + } + //设置配置 cityTrends.setUserId(hanHaiMember.getId()); @@ -797,8 +799,10 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); //验证 - this.sendMsgSecCheck(hanHaiMember.getAppletOpenid(), cityComment.getUserValue()); - + Integer i = this.sendMsgSecCheck(hanHaiMember.getAppletOpenid(), cityComment.getUserValue()); + if(i>100){ + return Result.error("内容含有敏感词"); + } cityComment.setUserId(hanHaiMember.getId()); @@ -833,7 +837,7 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { @Override - public Result sendMsgSecCheck(String openid,String content){ + public Integer sendMsgSecCheck(String openid,String content){ int scene = 1; // 场景枚举值(1 资料;2 评论;3 论坛;4 社交日志) int version = 2; // 接口版本号 try { @@ -859,36 +863,13 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { int label = (int) labelDouble; System.out.println(label); - if(label == 10001){ - return Result.error("内容含有敏感信息"); - } - if(label == 20001){ - return Result.error("内容含有敏感信息"); - } - if(label == 20002){ - return Result.error("内容含有敏感信息"); - } - if(label == 20003){ - return Result.error("内容含有敏感信息"); - } - if(label == 20006){ - return Result.error("内容含有敏感信息"); - } - if(label == 20008){ - return Result.error("内容含有敏感信息"); - } - if(label == 20012){ - return Result.error("内容含有敏感信息"); - } - if(label == 20013){ - return Result.error("内容含有敏感信息"); - } - return Result.OK(label ); + + return label; } catch (Exception e) { e.printStackTrace(); } - return Result.OK(); + return 100; } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiController.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiController.java index 919a8fa..e90f573 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiController.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiController.java @@ -173,12 +173,12 @@ public class YaoDuApiController { } - //验证规则 - @ApiOperation(value="验证规则") - @GetMapping(value = "/sendMsgSecCheck") - public Result sendMsgSecCheck(String context) { - return yaoDuApiService.sendMsgSecCheck("oFzrW4tqZUvN9T0RQzWPdCT1St68", context); - } +// //验证规则 +// @ApiOperation(value="验证规则") +// @GetMapping(value = "/sendMsgSecCheck") +// public Result sendMsgSecCheck(String context) { +// return yaoDuApiService.sendMsgSecCheck("oFzrW4tqZUvN9T0RQzWPdCT1St68", context); +// } }