fix: 修复评论回复计数逻辑,确保正确显示评论的回复数量

This commit is contained in:
2025-09-10 12:59:44 +08:00
parent c6e89c0b86
commit 6651de5858
4 changed files with 90 additions and 90 deletions

View File

@ -88,7 +88,7 @@ func (cr *CommentRepo) CreateComment(comment *model.Comment) error {
return err
}
parentComment.CommentCount += 1
if err := tx.Save(&parentComment).Error; err != nil {
if err := tx.Model(&parentComment).UpdateColumn("CommentCount", parentComment.CommentCount).Error; err != nil {
return err
}
depth = parentComment.Depth + 1