fix: comment replyToName error

main
wangqing 9 months ago
parent dd03ea8753
commit 4c81e6c54f

@ -283,7 +283,8 @@ public class CommentController extends BaseController {
String userId = userLoginDto.getUserId();
String content =sensitiveWordBs.findFirst(commentVo.getContent());
if (StringUtils.isNotEmpty(content)) {
return Result.forbidden(StatusCode.USER_SENSITIVE_INFO);
return Result.failed(StatusCode.COMMENT_SENSITIVE_INFO);
}
Comment comment = new Comment();
BeanUtils.copyProperties(commentVo, comment);

@ -1,4 +1,4 @@
package com.luoo.comment.sensitiveWord;
package com.luoo.comment.sensitiveword;
import com.github.houbb.sensitive.word.api.IWordAllow;
import org.springframework.stereotype.Component;

@ -1,6 +1,7 @@
package com.luoo.comment.sensitiveWord;
package com.luoo.comment.sensitiveword;
import com.github.houbb.sensitive.word.api.IWordDeny;
import constants.SensitiveWords;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;
@ -16,17 +17,15 @@ 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("落网");
Resource mySensitiveWords = new ClassPathResource("denyWords.txt");
try {
Path mySensitiveWordsPath = Paths.get(mySensitiveWords.getFile().getPath());
list = Files.readAllLines(mySensitiveWordsPath, StandardCharsets.UTF_8);
// list.add("落网");
} catch (IOException e) {
throw new RuntimeException(e);
String[] s = DENY_WORDS.split("\n");
for(String denyWord:s) {
list.add(denyWord);
}
return list;

@ -4,10 +4,7 @@ package com.luoo.comment.service;
import com.luoo.comment.client.JournalClient;
import com.luoo.comment.dao.CommentDao;
import com.luoo.comment.dao.CommentHisDao;
import com.luoo.comment.pojo.Comment;
import com.luoo.comment.pojo.CommentHis;
import com.luoo.comment.pojo.JournalRespDTO;
import com.luoo.comment.pojo.PublicationLike;
import com.luoo.comment.pojo.*;
import constants.Constants;
import dto.UserLoginDto;
import dto.UserMessageDto;
@ -54,6 +51,9 @@ public class CommentService {
@Autowired
private CacheChannel cacheChannel;
@Autowired
private UserInfoService userInfoService;
public List<Comment> findAll(){
return commentDao.findAll();
}
@ -105,8 +105,10 @@ public class CommentService {
comment.setRootId(parentComment.getRootId());
comment.setRootJournalId(parentComment.getRootJournalId());
comment.setRootJournalName(parentComment.getRootJournalName());
comment.setReplyToNickname(parentComment.getNickName());
// comment.setReplyToNickname(parentComment.getNickName());
comment.setReplyToUserId(parentComment.getUserId());
UserInfo userInfo = userInfoService.findById(parentComment.getUserId());
comment.setReplyToNickname(userInfo.getNickName());
Query query = new Query();
query.addCriteria(Criteria.where("_id").is(comment.getRootId()));
Update update = new Update();

Loading…
Cancel
Save