Files
full/module/base/cms/internal/models/cms_comment.go

43 lines
2.0 KiB
Go
Raw Normal View History

/**
* @Author: david.yan@qq.com
* @Date: 2021-11-29 15:16:26
* @LastEditors: david.yan@qq.com
* @LastEditTime: 2021-12-08 15:48:55
* @FilePath: /src/git.buka.tv/Cms/internal/models/comment.go
*/
package models
import (
"git.apinb.com/bsm-sdk/core/database"
"git.apinb.com/bsm-sdk/core/types"
"gorm.io/gorm"
)
// 内容评论
type CmsComment struct {
gorm.Model
types.Std_Identity
PostIdentity string `gorm:"column:post_identity;type:varchar(36);index;" json:"post_identity"` // 关联的帖子身份标识符
OwnerName string `gorm:"column:owner_name;type:varchar(255);index;" json:"owner_name"` // 作者名称
OwnerIdentity string `gorm:"column:owner_identity;type:varchar(36);index;" json:"owner_identity"` // 作者身份标识符
Role string `gorm:"column:role;type:varchar(255);index;" json:"role"` // 角色
ParentId uint `gorm:"column:parent_id;index;" json:"parent_id"` // 关联的父级评论id
ReplyIdentity string `gorm:"column:reply_identity;type:varchar(36);index;" json:"reply_identity"` // 被回复的评论的身份标识符
Cms string `gorm:"column:Cms;type:text;default:'';" json:"Cms"` // 评论内容
Hits int64 `gorm:"column:hits;default:0" json:"hits"` // 点击量
LikeHits int64 `gorm:"column:like_hits;default:0" json:"like_hits"` // 点赞量
UnlikeHits int64 `gorm:"column:unlike_hits;default:0" json:"unlike_hits"` // 踩赞量
CommentHits int64 `gorm:"column:comment_hits;default:0" json:"comment_hits"` // 评论量
Children []CmsComment `gorm:"foreignkey:parent_id;references:ID"` // 子评论
}
func init() {
database.MigrateTables = append(database.MigrateTables, &CmsComment{})
}
// TableName .CmsComment 内容评论表
func (table *CmsComment) TableName() string {
return "cms_comment" // 对应数据库表名
}