fix: comment replyToName error

main
wangqing 9 months ago
parent 27936e1e5d
commit 94269b86ac

@ -2,8 +2,8 @@ package com.luoo.comment.config;
import com.github.houbb.sensitive.word.bs.SensitiveWordBs;
import com.github.houbb.sensitive.word.support.allow.WordAllows;
import com.github.houbb.sensitive.word.support.deny.WordDenys;
import com.luoo.comment.sensitiveword.MyDdWordAllow;
import com.luoo.comment.sensitiveword.MyDdWordDeny;
import com.luoo.comment.sensitive.MyDdWordAllow;
import com.luoo.comment.sensitive.MyDdWordDeny;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@ -0,0 +1,21 @@
package com.luoo.comment.sensitive;
import com.github.houbb.sensitive.word.api.IWordAllow;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class MyDdWordAllow implements IWordAllow {
@Override
public List<String> allow() {
List<String> list = new ArrayList<>();
list.add("五星红旗");
list.add("天安门");
return list;
}
}

@ -0,0 +1,25 @@
package com.luoo.comment.sensitive;
import com.github.houbb.sensitive.word.api.IWordDeny;
import constants.SensitiveWords;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class MyDdWordDeny implements IWordDeny {
String DENY_WORDS= SensitiveWords.DENY_WORDS;
@Override
public List<String> deny() {
List<String> list = new ArrayList<>();
// list.add("落网");
String[] s = DENY_WORDS.split("\n");
for(String denyWord:s) {
list.add(denyWord);
}
return list;
}
}

@ -0,0 +1,23 @@
package com.luoo.comment.sensitive;
import com.github.houbb.sensitive.word.bs.SensitiveWordBs;
import org.springframework.beans.factory.annotation.Autowired;
public class SensitiveWordService {
@Autowired
private SensitiveWordBs sensitiveWordBs;
/**
*
* <p>
*
*
* <p>
* 使
*/
public void refresh() {
// 每次数据库的信息发生变化之后,首先调用更新数据库敏感词库的方法,然后调用这个方法。
sensitiveWordBs.init();
}
}
Loading…
Cancel
Save