feat: 添加评论功能的客户端信息显示选项,更新相关接口和组件

This commit is contained in:
2025-09-13 16:04:09 +08:00
parent 011dc298c2
commit 2d0e1a46e2
10 changed files with 279 additions and 234 deletions

View File

@ -7,19 +7,20 @@ import (
type Comment struct {
gorm.Model
UserID uint `gorm:"index"` // 评论的用户ID
User User `gorm:"foreignKey:UserID;references:ID"` // 关联的用户
TargetID uint `gorm:"index"` // 目标ID
TargetType string `gorm:"index"` // 目标类型,如 "post", "page"
ReplyID uint `gorm:"index"` // 回复的评论ID
Content string `gorm:"type:text"` // 评论内容
Depth int `gorm:"default:0"` // 评论的层级深度,从0开始计数
IsPrivate bool `gorm:"default:false"` // 是否为私密评论,私密评论只有评论者和被评论对象所有者可见
RemoteAddr string `gorm:"type:text"` // 远程地址
UserAgent string `gorm:"type:text"`
Location string `gorm:"type:text"` // 用户位置基于IP
LikeCount uint64
CommentCount uint64
UserID uint `gorm:"index"` // 评论的用户ID
User User `gorm:"foreignKey:UserID;references:ID"` // 关联的用户
TargetID uint `gorm:"index"` // 目标ID
TargetType string `gorm:"index"` // 目标类型,如 "post", "page"
ReplyID uint `gorm:"index"` // 回复的评论ID
Content string `gorm:"type:text"` // 评论内容
Depth int `gorm:"default:0"` // 评论的层级深度,从0开始计数
IsPrivate bool `gorm:"default:false"` // 是否为私密评论,私密评论只有评论者和被评论对象所有者可见
RemoteAddr string `gorm:"type:text"` // 远程地址
UserAgent string `gorm:"type:text"`
Location string `gorm:"type:text"` // 用户位置基于IP
LikeCount uint64
CommentCount uint64
ShowClientInfo bool `gorm:"default:false"` // 是否显示客户端信息
}
func (c *Comment) AfterCreate(tx *gorm.DB) (err error) {