Files
sundynix-plant-be/model/plant/community_post.go
T
2026-02-06 17:28:42 +08:00

28 lines
1.5 KiB
Go

package plant
import (
"sundynix-go/global"
"sundynix-go/model/system"
)
// Post 帖子
type Post struct {
global.BaseModel
UserId string `json:"userId" form:"userId" gorm:"column:user_id;size:50;comment:用户id"`
Title string `json:"title" form:"title" gorm:"column:title;size:100;comment:帖子标题"`
Content string `json:"content" form:"content" gorm:"column:content;size:500;comment:帖子内容"`
ViewCount int `json:"viewCount" form:"viewCount" gorm:"default:0;column:view_count;comment:浏览次数"`
CommentCount int `json:"commentCount" form:"commentCount" gorm:"default:0;column:comment_count;comment:评论次数"`
LikeCount int `json:"likeCount" form:"likeCount" gorm:"default:0;column:like_count;comment:点赞次数"`
Location string `json:"location" form:"location" gorm:"column:location;size:100;comment:位置"`
HasReviewed int `json:"hasReviewed" form:"hasReviewed" gorm:"column:has_reviewed;comment:是否审核通过"`
HasLiked int `json:"hasLiked" form:"hasLiked" gorm:"-"`
//图片
ImgList []*system.Oss `json:"imgList" form:"imgList" gorm:"many2many:post_oss;comment:图片列表"`
//评论
CommentList []*PostComment `json:"commentList" form:"commentList" gorm:"foreignKey:PostId;comment:评论列表"`
//点赞
LikeList []*PostLike `json:"likeList" form:"likeList" gorm:"foreignKey:PostId;comment:点赞列表"`
Publisher *system.User `json:"publisher" form:"publisher" gorm:"foreignKey:UserId;comment:用户"`
}