Browse Source

修改规则

master
主管理员 4 months ago
parent
commit
277e902f0c
3 changed files with 20 additions and 39 deletions
  1. +1
    -1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/YaoDuApiService.java
  2. +13
    -32
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java
  3. +6
    -6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiController.java

+ 1
- 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/YaoDuApiService.java View File

@ -135,7 +135,7 @@ public interface YaoDuApiService {
//验证规则
Result<?> sendMsgSecCheck(String openid,String content);
Integer sendMsgSecCheck(String openid,String content) ;
}

+ 13
- 32
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java View File

@ -247,7 +247,6 @@ public class YaoDuApiServiceImpl implements YaoDuApiService {
Page<CityTrends> 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;
}


+ 6
- 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiController.java View File

@ -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);
// }
}

Loading…
Cancel
Save