重构一下数据库

This commit is contained in:
2026-01-18 20:35:21 +08:00
parent 485307e7de
commit ff4e069a7e
20 changed files with 477 additions and 131 deletions

View File

@@ -0,0 +1,28 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// ForumBoards is the golang structure of table forum_boards for DAO operations like Where/Data.
type ForumBoards struct {
g.Meta `orm:"table:forum_boards, do:true"`
Id any // 版块ID主键
SectionId any // 所属频道ID关联 forum_sections.id无外键可为空=不分区)
Name any // 版块名称
Description any // 版块简介
CoverImage any // 版块封面图URL
Status any // 状态normal=正常 hidden=隐藏 deleted=删除
DisplayOrder any // 排序值(越大越靠前)
PostCount any // 帖子总数(冗余)
TodayPostCount any // 今日发帖数(冗余,可选)
LastPostId any // 最后一篇帖子ID冗余可选
LastPostAt *gtime.Time // 最后发帖时间(冗余,可选)
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
}

View File

@@ -11,16 +11,16 @@ import (
// ForumComments is the golang structure of table forum_comments for DAO operations like Where/Data.
type ForumComments struct {
g.Meta `orm:"table:forum_comments, do:true"`
Id any // 评论ID主键
UserId any // 评论发布者ID关联users.id无外键
PostId any // 所属帖子ID关联forum_posts.id无外键
ParentId any // 父评论IDNULL=评论非NULL=回复某条评论
Content any // 评论内容支持emoji
Status any // 评论状态normal=正常 deleted=软删除 audit=审核中 reject=审核驳回
LikeCount any // 点赞数
ReplyCount any // 回复数(冗余字段
CreatedAt *gtime.Time // 评论创建时间
UpdatedAt *gtime.Time // 评论更新时间
DeletedAt *gtime.Time // 软删除时间
g.Meta `orm:"table:forum_comments, do:true"`
Id any // 评论ID主键
PostId any // 所属帖子ID关联 forum_posts.id无外键
UserId any // 评论发布者ID关联 users.id无外键
ParentId any // 父评论IDNULL=一级评论非NULL=二级评论指向一级评论ID无外键
ReplyToUserId any // 回复的用户ID可选用于展示“回复@xxx”无外键
Content any // 评论内容支持emoji
Status any // 状态normal=正常 deleted=软删 audit=审核中 reject=驳回
LikeCount any // 点赞数(冗余)
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间
}

View File

@@ -11,17 +11,23 @@ import (
// ForumPosts is the golang structure of table forum_posts for DAO operations like Where/Data.
type ForumPosts struct {
g.Meta `orm:"table:forum_posts, do:true"`
Id any // 帖子ID主键
UserId any // 发帖用户ID关联users.id无外键
Title any // 帖子标题
Content any // 帖子正文(支持富文本/emoji
CoverImage any // 帖子封面图URL
Status any // 帖子状态normal=正常 deleted=软删除 audit=审核中 reject=审核驳回
ViewCount any // 浏览量(冗余字段)
LikeCount any // 点赞数(冗余字段)
CommentCount any // 评论数(冗余字段)
CreatedAt *gtime.Time // 发帖时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间
g.Meta `orm:"table:forum_posts, do:true"`
Id any // 帖子ID主键
BoardId any // 所属版块ID关联 forum_boards.id无外键
UserId any // 发帖用户ID关联 users.id无外键
Title any // 帖子标题
Content any // 帖子正文(支持富文本/emoji
CoverImage any // 帖子封面图URL
Status any // 状态normal=正常 deleted=软删 audit=审核中 reject=驳回
IsPinned any // 是否置顶0否 1是
IsEssence any // 是否精华0否 1是
ViewCount any // 浏览量(冗余)
LikeCount any // 点赞数(冗余)
CommentCount any // 评论数(冗余)
CollectCount any // 收藏数(冗余,可选)
LastCommentId any // 最后一条评论ID冗余可选
LastCommentAt *gtime.Time // 最后评论时间(冗余,可选)
CreatedAt *gtime.Time // 发帖时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间
}

View File

@@ -0,0 +1,23 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// ForumSections is the golang structure of table forum_sections for DAO operations like Where/Data.
type ForumSections struct {
g.Meta `orm:"table:forum_sections, do:true"`
Id any // 频道/分区ID主键
Name any // 频道名称
Description any // 频道简介
Icon any // 频道图标URL
Status any // 状态normal=正常 hidden=隐藏 deleted=删除
DisplayOrder any // 排序值(越大越靠前)
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
}

View File

@@ -18,16 +18,12 @@ type Users struct {
Nickname any // 昵称
Gender any // 性别0未知 1男 2女
BirthDate *gtime.Time // 生日
UserType any // 用户类型:normal普通用户vip为VIP用户
VipStartAt *gtime.Time // VIP开始时间
VipEndAt *gtime.Time // VIP结束时间
UserType any // 用户类型:1 user 2 admin
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
RealityRole any // 现实身份/角色
AbnormalRole any // 异常身份/角色
JobTitle any // 职位
Commendation any //
Admonition any //
Email any //
RedTrace any // 红轨
YellowTrace any // 黄轨