重构一下数据库
This commit is contained in:
22
Backend/internal/dao/forum_boards.go
Normal file
22
Backend/internal/dao/forum_boards.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"TrangleAgent/internal/dao/internal"
|
||||
)
|
||||
|
||||
// forumBoardsDao is the data access object for the table forum_boards.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type forumBoardsDao struct {
|
||||
*internal.ForumBoardsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// ForumBoards is a globally accessible object for table forum_boards operations.
|
||||
ForumBoards = forumBoardsDao{internal.NewForumBoardsDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
22
Backend/internal/dao/forum_sections.go
Normal file
22
Backend/internal/dao/forum_sections.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"TrangleAgent/internal/dao/internal"
|
||||
)
|
||||
|
||||
// forumSectionsDao is the data access object for the table forum_sections.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type forumSectionsDao struct {
|
||||
*internal.ForumSectionsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// ForumSections is a globally accessible object for table forum_sections operations.
|
||||
ForumSections = forumSectionsDao{internal.NewForumSectionsDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
103
Backend/internal/dao/internal/forum_boards.go
Normal file
103
Backend/internal/dao/internal/forum_boards.go
Normal file
@@ -0,0 +1,103 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ForumBoardsDao is the data access object for the table forum_boards.
|
||||
type ForumBoardsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns ForumBoardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// ForumBoardsColumns defines and stores column names for the table forum_boards.
|
||||
type ForumBoardsColumns struct {
|
||||
Id string // 版块ID(主键)
|
||||
SectionId string // 所属频道ID(关联 forum_sections.id,无外键;可为空=不分区)
|
||||
Name string // 版块名称
|
||||
Description string // 版块简介
|
||||
CoverImage string // 版块封面图URL
|
||||
Status string // 状态:normal=正常 hidden=隐藏 deleted=删除
|
||||
DisplayOrder string // 排序值(越大越靠前)
|
||||
PostCount string // 帖子总数(冗余)
|
||||
TodayPostCount string // 今日发帖数(冗余,可选)
|
||||
LastPostId string // 最后一篇帖子ID(冗余,可选)
|
||||
LastPostAt string // 最后发帖时间(冗余,可选)
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// forumBoardsColumns holds the columns for the table forum_boards.
|
||||
var forumBoardsColumns = ForumBoardsColumns{
|
||||
Id: "id",
|
||||
SectionId: "section_id",
|
||||
Name: "name",
|
||||
Description: "description",
|
||||
CoverImage: "cover_image",
|
||||
Status: "status",
|
||||
DisplayOrder: "display_order",
|
||||
PostCount: "post_count",
|
||||
TodayPostCount: "today_post_count",
|
||||
LastPostId: "last_post_id",
|
||||
LastPostAt: "last_post_at",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewForumBoardsDao creates and returns a new DAO object for table data access.
|
||||
func NewForumBoardsDao(handlers ...gdb.ModelHandler) *ForumBoardsDao {
|
||||
return &ForumBoardsDao{
|
||||
group: "default",
|
||||
table: "forum_boards",
|
||||
columns: forumBoardsColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *ForumBoardsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *ForumBoardsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *ForumBoardsDao) Columns() ForumBoardsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *ForumBoardsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *ForumBoardsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *ForumBoardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -21,32 +21,32 @@ type ForumCommentsDao struct {
|
||||
|
||||
// ForumCommentsColumns defines and stores column names for the table forum_comments.
|
||||
type ForumCommentsColumns struct {
|
||||
Id string // 评论ID(主键)
|
||||
UserId string // 评论发布者ID(关联users.id,无外键)
|
||||
PostId string // 所属帖子ID(关联forum_posts.id,无外键)
|
||||
ParentId string // 父评论ID(NULL=根评论,非NULL=回复某条评论)
|
||||
Content string // 评论内容(支持emoji)
|
||||
Status string // 评论状态:normal=正常 deleted=软删除 audit=审核中 reject=审核驳回
|
||||
LikeCount string // 点赞数
|
||||
ReplyCount string // 回复数(冗余字段)
|
||||
CreatedAt string // 评论创建时间
|
||||
UpdatedAt string // 评论更新时间
|
||||
DeletedAt string // 软删除时间
|
||||
Id string // 评论ID(主键)
|
||||
PostId string // 所属帖子ID(关联 forum_posts.id,无外键)
|
||||
UserId string // 评论发布者ID(关联 users.id,无外键)
|
||||
ParentId string // 父评论ID:NULL=一级评论;非NULL=二级评论(指向一级评论ID,无外键)
|
||||
ReplyToUserId string // 回复的用户ID(可选,用于展示“回复@xxx”,无外键)
|
||||
Content string // 评论内容(支持emoji)
|
||||
Status string // 状态:normal=正常 deleted=软删 audit=审核中 reject=驳回
|
||||
LikeCount string // 点赞数(冗余)
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间
|
||||
}
|
||||
|
||||
// forumCommentsColumns holds the columns for the table forum_comments.
|
||||
var forumCommentsColumns = ForumCommentsColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
PostId: "post_id",
|
||||
ParentId: "parent_id",
|
||||
Content: "content",
|
||||
Status: "status",
|
||||
LikeCount: "like_count",
|
||||
ReplyCount: "reply_count",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
Id: "id",
|
||||
PostId: "post_id",
|
||||
UserId: "user_id",
|
||||
ParentId: "parent_id",
|
||||
ReplyToUserId: "reply_to_user_id",
|
||||
Content: "content",
|
||||
Status: "status",
|
||||
LikeCount: "like_count",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewForumCommentsDao creates and returns a new DAO object for table data access.
|
||||
|
||||
@@ -21,34 +21,46 @@ type ForumPostsDao struct {
|
||||
|
||||
// ForumPostsColumns defines and stores column names for the table forum_posts.
|
||||
type ForumPostsColumns struct {
|
||||
Id string // 帖子ID(主键)
|
||||
UserId string // 发帖用户ID(关联users.id,无外键)
|
||||
Title string // 帖子标题
|
||||
Content string // 帖子正文(支持富文本/emoji)
|
||||
CoverImage string // 帖子封面图URL
|
||||
Status string // 帖子状态:normal=正常 deleted=软删除 audit=审核中 reject=审核驳回
|
||||
ViewCount string // 浏览量(冗余字段)
|
||||
LikeCount string // 点赞数(冗余字段)
|
||||
CommentCount string // 评论数(冗余字段)
|
||||
CreatedAt string // 发帖时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间
|
||||
Id string // 帖子ID(主键)
|
||||
BoardId string // 所属版块ID(关联 forum_boards.id,无外键)
|
||||
UserId string // 发帖用户ID(关联 users.id,无外键)
|
||||
Title string // 帖子标题
|
||||
Content string // 帖子正文(支持富文本/emoji)
|
||||
CoverImage string // 帖子封面图URL
|
||||
Status string // 状态:normal=正常 deleted=软删 audit=审核中 reject=驳回
|
||||
IsPinned string // 是否置顶:0否 1是
|
||||
IsEssence string // 是否精华:0否 1是
|
||||
ViewCount string // 浏览量(冗余)
|
||||
LikeCount string // 点赞数(冗余)
|
||||
CommentCount string // 评论数(冗余)
|
||||
CollectCount string // 收藏数(冗余,可选)
|
||||
LastCommentId string // 最后一条评论ID(冗余,可选)
|
||||
LastCommentAt string // 最后评论时间(冗余,可选)
|
||||
CreatedAt string // 发帖时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间
|
||||
}
|
||||
|
||||
// forumPostsColumns holds the columns for the table forum_posts.
|
||||
var forumPostsColumns = ForumPostsColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
Title: "title",
|
||||
Content: "content",
|
||||
CoverImage: "cover_image",
|
||||
Status: "status",
|
||||
ViewCount: "view_count",
|
||||
LikeCount: "like_count",
|
||||
CommentCount: "comment_count",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
Id: "id",
|
||||
BoardId: "board_id",
|
||||
UserId: "user_id",
|
||||
Title: "title",
|
||||
Content: "content",
|
||||
CoverImage: "cover_image",
|
||||
Status: "status",
|
||||
IsPinned: "is_pinned",
|
||||
IsEssence: "is_essence",
|
||||
ViewCount: "view_count",
|
||||
LikeCount: "like_count",
|
||||
CommentCount: "comment_count",
|
||||
CollectCount: "collect_count",
|
||||
LastCommentId: "last_comment_id",
|
||||
LastCommentAt: "last_comment_at",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewForumPostsDao creates and returns a new DAO object for table data access.
|
||||
|
||||
93
Backend/internal/dao/internal/forum_sections.go
Normal file
93
Backend/internal/dao/internal/forum_sections.go
Normal file
@@ -0,0 +1,93 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ForumSectionsDao is the data access object for the table forum_sections.
|
||||
type ForumSectionsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns ForumSectionsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// ForumSectionsColumns defines and stores column names for the table forum_sections.
|
||||
type ForumSectionsColumns struct {
|
||||
Id string // 频道/分区ID(主键)
|
||||
Name string // 频道名称
|
||||
Description string // 频道简介
|
||||
Icon string // 频道图标URL
|
||||
Status string // 状态:normal=正常 hidden=隐藏 deleted=删除
|
||||
DisplayOrder string // 排序值(越大越靠前)
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// forumSectionsColumns holds the columns for the table forum_sections.
|
||||
var forumSectionsColumns = ForumSectionsColumns{
|
||||
Id: "id",
|
||||
Name: "name",
|
||||
Description: "description",
|
||||
Icon: "icon",
|
||||
Status: "status",
|
||||
DisplayOrder: "display_order",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewForumSectionsDao creates and returns a new DAO object for table data access.
|
||||
func NewForumSectionsDao(handlers ...gdb.ModelHandler) *ForumSectionsDao {
|
||||
return &ForumSectionsDao{
|
||||
group: "default",
|
||||
table: "forum_sections",
|
||||
columns: forumSectionsColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *ForumSectionsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *ForumSectionsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *ForumSectionsDao) Columns() ForumSectionsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *ForumSectionsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *ForumSectionsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *ForumSectionsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -27,16 +27,12 @@ type UsersColumns struct {
|
||||
Nickname string // 昵称
|
||||
Gender string // 性别:0未知 1男 2女
|
||||
BirthDate string // 生日
|
||||
UserType string // 用户类型:normal普通用户,vip为VIP用户
|
||||
VipStartAt string // VIP开始时间
|
||||
VipEndAt string // VIP结束时间
|
||||
UserType string // 用户类型:1 user 2 admin
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
RealityRole string // 现实身份/角色
|
||||
AbnormalRole string // 异常身份/角色
|
||||
JobTitle string // 职位
|
||||
Commendation string //
|
||||
Admonition string //
|
||||
Email string //
|
||||
RedTrace string // 红轨
|
||||
YellowTrace string // 黄轨
|
||||
@@ -52,15 +48,11 @@ var usersColumns = UsersColumns{
|
||||
Gender: "gender",
|
||||
BirthDate: "birth_date",
|
||||
UserType: "user_type",
|
||||
VipStartAt: "vip_start_at",
|
||||
VipEndAt: "vip_end_at",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
RealityRole: "reality_role",
|
||||
AbnormalRole: "abnormal_role",
|
||||
JobTitle: "job_title",
|
||||
Commendation: "Commendation",
|
||||
Admonition: "Admonition",
|
||||
Email: "email",
|
||||
RedTrace: "red_trace",
|
||||
YellowTrace: "yellow_trace",
|
||||
|
||||
28
Backend/internal/model/do/forum_boards.go
Normal file
28
Backend/internal/model/do/forum_boards.go
Normal 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 // 更新时间
|
||||
}
|
||||
@@ -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 // 父评论ID(NULL=根评论,非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 // 父评论ID:NULL=一级评论;非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 // 软删除时间
|
||||
}
|
||||
|
||||
@@ -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 // 软删除时间
|
||||
}
|
||||
|
||||
23
Backend/internal/model/do/forum_sections.go
Normal file
23
Backend/internal/model/do/forum_sections.go
Normal 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 // 更新时间
|
||||
}
|
||||
@@ -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 // 黄轨
|
||||
|
||||
26
Backend/internal/model/entity/forum_boards.go
Normal file
26
Backend/internal/model/entity/forum_boards.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// ForumBoards is the golang structure for table forum_boards.
|
||||
type ForumBoards struct {
|
||||
Id uint64 `json:"id" orm:"id" description:"版块ID(主键)"` // 版块ID(主键)
|
||||
SectionId uint64 `json:"sectionId" orm:"section_id" description:"所属频道ID(关联 forum_sections.id,无外键;可为空=不分区)"` // 所属频道ID(关联 forum_sections.id,无外键;可为空=不分区)
|
||||
Name string `json:"name" orm:"name" description:"版块名称"` // 版块名称
|
||||
Description string `json:"description" orm:"description" description:"版块简介"` // 版块简介
|
||||
CoverImage string `json:"coverImage" orm:"cover_image" description:"版块封面图URL"` // 版块封面图URL
|
||||
Status string `json:"status" orm:"status" description:"状态:normal=正常 hidden=隐藏 deleted=删除"` // 状态:normal=正常 hidden=隐藏 deleted=删除
|
||||
DisplayOrder int `json:"displayOrder" orm:"display_order" description:"排序值(越大越靠前)"` // 排序值(越大越靠前)
|
||||
PostCount uint `json:"postCount" orm:"post_count" description:"帖子总数(冗余)"` // 帖子总数(冗余)
|
||||
TodayPostCount uint `json:"todayPostCount" orm:"today_post_count" description:"今日发帖数(冗余,可选)"` // 今日发帖数(冗余,可选)
|
||||
LastPostId uint64 `json:"lastPostId" orm:"last_post_id" description:"最后一篇帖子ID(冗余,可选)"` // 最后一篇帖子ID(冗余,可选)
|
||||
LastPostAt *gtime.Time `json:"lastPostAt" orm:"last_post_at" description:"最后发帖时间(冗余,可选)"` // 最后发帖时间(冗余,可选)
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
}
|
||||
@@ -10,15 +10,15 @@ import (
|
||||
|
||||
// ForumComments is the golang structure for table forum_comments.
|
||||
type ForumComments struct {
|
||||
Id uint64 `json:"id" orm:"id" description:"评论ID(主键)"` // 评论ID(主键)
|
||||
UserId uint64 `json:"userId" orm:"user_id" description:"评论发布者ID(关联users.id,无外键)"` // 评论发布者ID(关联users.id,无外键)
|
||||
PostId uint64 `json:"postId" orm:"post_id" description:"所属帖子ID(关联forum_posts.id,无外键)"` // 所属帖子ID(关联forum_posts.id,无外键)
|
||||
ParentId uint64 `json:"parentId" orm:"parent_id" description:"父评论ID(NULL=根评论,非NULL=回复某条评论)"` // 父评论ID(NULL=根评论,非NULL=回复某条评论)
|
||||
Content string `json:"content" orm:"content" description:"评论内容(支持emoji)"` // 评论内容(支持emoji)
|
||||
Status string `json:"status" orm:"status" description:"评论状态:normal=正常 deleted=软删除 audit=审核中 reject=审核驳回"` // 评论状态:normal=正常 deleted=软删除 audit=审核中 reject=审核驳回
|
||||
LikeCount uint `json:"likeCount" orm:"like_count" description:"点赞数"` // 点赞数
|
||||
ReplyCount uint `json:"replyCount" orm:"reply_count" description:"回复数(冗余字段)"` // 回复数(冗余字段)
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"评论创建时间"` // 评论创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"评论更新时间"` // 评论更新时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
|
||||
Id uint64 `json:"id" orm:"id" description:"评论ID(主键)"` // 评论ID(主键)
|
||||
PostId uint64 `json:"postId" orm:"post_id" description:"所属帖子ID(关联 forum_posts.id,无外键)"` // 所属帖子ID(关联 forum_posts.id,无外键)
|
||||
UserId uint64 `json:"userId" orm:"user_id" description:"评论发布者ID(关联 users.id,无外键)"` // 评论发布者ID(关联 users.id,无外键)
|
||||
ParentId uint64 `json:"parentId" orm:"parent_id" description:"父评论ID:NULL=一级评论;非NULL=二级评论(指向一级评论ID,无外键)"` // 父评论ID:NULL=一级评论;非NULL=二级评论(指向一级评论ID,无外键)
|
||||
ReplyToUserId uint64 `json:"replyToUserId" orm:"reply_to_user_id" description:"回复的用户ID(可选,用于展示“回复@xxx”,无外键)"` // 回复的用户ID(可选,用于展示“回复@xxx”,无外键)
|
||||
Content string `json:"content" orm:"content" description:"评论内容(支持emoji)"` // 评论内容(支持emoji)
|
||||
Status string `json:"status" orm:"status" description:"状态:normal=正常 deleted=软删 audit=审核中 reject=驳回"` // 状态:normal=正常 deleted=软删 audit=审核中 reject=驳回
|
||||
LikeCount uint `json:"likeCount" orm:"like_count" description:"点赞数(冗余)"` // 点赞数(冗余)
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
|
||||
}
|
||||
|
||||
@@ -10,16 +10,22 @@ import (
|
||||
|
||||
// ForumPosts is the golang structure for table forum_posts.
|
||||
type ForumPosts struct {
|
||||
Id uint64 `json:"id" orm:"id" description:"帖子ID(主键)"` // 帖子ID(主键)
|
||||
UserId uint64 `json:"userId" orm:"user_id" description:"发帖用户ID(关联users.id,无外键)"` // 发帖用户ID(关联users.id,无外键)
|
||||
Title string `json:"title" orm:"title" description:"帖子标题"` // 帖子标题
|
||||
Content string `json:"content" orm:"content" description:"帖子正文(支持富文本/emoji)"` // 帖子正文(支持富文本/emoji)
|
||||
CoverImage string `json:"coverImage" orm:"cover_image" description:"帖子封面图URL"` // 帖子封面图URL
|
||||
Status string `json:"status" orm:"status" description:"帖子状态:normal=正常 deleted=软删除 audit=审核中 reject=审核驳回"` // 帖子状态:normal=正常 deleted=软删除 audit=审核中 reject=审核驳回
|
||||
ViewCount uint `json:"viewCount" orm:"view_count" description:"浏览量(冗余字段)"` // 浏览量(冗余字段)
|
||||
LikeCount uint `json:"likeCount" orm:"like_count" description:"点赞数(冗余字段)"` // 点赞数(冗余字段)
|
||||
CommentCount uint `json:"commentCount" orm:"comment_count" description:"评论数(冗余字段)"` // 评论数(冗余字段)
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"发帖时间"` // 发帖时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
|
||||
Id uint64 `json:"id" orm:"id" description:"帖子ID(主键)"` // 帖子ID(主键)
|
||||
BoardId uint64 `json:"boardId" orm:"board_id" description:"所属版块ID(关联 forum_boards.id,无外键)"` // 所属版块ID(关联 forum_boards.id,无外键)
|
||||
UserId uint64 `json:"userId" orm:"user_id" description:"发帖用户ID(关联 users.id,无外键)"` // 发帖用户ID(关联 users.id,无外键)
|
||||
Title string `json:"title" orm:"title" description:"帖子标题"` // 帖子标题
|
||||
Content string `json:"content" orm:"content" description:"帖子正文(支持富文本/emoji)"` // 帖子正文(支持富文本/emoji)
|
||||
CoverImage string `json:"coverImage" orm:"cover_image" description:"帖子封面图URL"` // 帖子封面图URL
|
||||
Status string `json:"status" orm:"status" description:"状态:normal=正常 deleted=软删 audit=审核中 reject=驳回"` // 状态:normal=正常 deleted=软删 audit=审核中 reject=驳回
|
||||
IsPinned int `json:"isPinned" orm:"is_pinned" description:"是否置顶:0否 1是"` // 是否置顶:0否 1是
|
||||
IsEssence int `json:"isEssence" orm:"is_essence" description:"是否精华:0否 1是"` // 是否精华:0否 1是
|
||||
ViewCount uint `json:"viewCount" orm:"view_count" description:"浏览量(冗余)"` // 浏览量(冗余)
|
||||
LikeCount uint `json:"likeCount" orm:"like_count" description:"点赞数(冗余)"` // 点赞数(冗余)
|
||||
CommentCount uint `json:"commentCount" orm:"comment_count" description:"评论数(冗余)"` // 评论数(冗余)
|
||||
CollectCount uint `json:"collectCount" orm:"collect_count" description:"收藏数(冗余,可选)"` // 收藏数(冗余,可选)
|
||||
LastCommentId uint64 `json:"lastCommentId" orm:"last_comment_id" description:"最后一条评论ID(冗余,可选)"` // 最后一条评论ID(冗余,可选)
|
||||
LastCommentAt *gtime.Time `json:"lastCommentAt" orm:"last_comment_at" description:"最后评论时间(冗余,可选)"` // 最后评论时间(冗余,可选)
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"发帖时间"` // 发帖时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
|
||||
}
|
||||
|
||||
21
Backend/internal/model/entity/forum_sections.go
Normal file
21
Backend/internal/model/entity/forum_sections.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// ForumSections is the golang structure for table forum_sections.
|
||||
type ForumSections struct {
|
||||
Id uint64 `json:"id" orm:"id" description:"频道/分区ID(主键)"` // 频道/分区ID(主键)
|
||||
Name string `json:"name" orm:"name" description:"频道名称"` // 频道名称
|
||||
Description string `json:"description" orm:"description" description:"频道简介"` // 频道简介
|
||||
Icon string `json:"icon" orm:"icon" description:"频道图标URL"` // 频道图标URL
|
||||
Status string `json:"status" orm:"status" description:"状态:normal=正常 hidden=隐藏 deleted=删除"` // 状态:normal=正常 hidden=隐藏 deleted=删除
|
||||
DisplayOrder int `json:"displayOrder" orm:"display_order" description:"排序值(越大越靠前)"` // 排序值(越大越靠前)
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
}
|
||||
@@ -10,24 +10,20 @@ import (
|
||||
|
||||
// Users is the golang structure for table users.
|
||||
type Users struct {
|
||||
Id uint64 `json:"id" orm:"id" description:"用户ID"` // 用户ID
|
||||
Account string `json:"account" orm:"account" description:"账号"` // 账号
|
||||
Password string `json:"password" orm:"password" description:"密码哈希"` // 密码哈希
|
||||
Nickname string `json:"nickname" orm:"nickname" description:"昵称"` // 昵称
|
||||
Gender int `json:"gender" orm:"gender" description:"性别:0未知 1男 2女"` // 性别:0未知 1男 2女
|
||||
BirthDate *gtime.Time `json:"birthDate" orm:"birth_date" description:"生日"` // 生日
|
||||
UserType string `json:"userType" orm:"user_type" description:"用户类型:normal普通用户,vip为VIP用户"` // 用户类型:normal普通用户,vip为VIP用户
|
||||
VipStartAt *gtime.Time `json:"vipStartAt" orm:"vip_start_at" description:"VIP开始时间"` // VIP开始时间
|
||||
VipEndAt *gtime.Time `json:"vipEndAt" orm:"vip_end_at" description:"VIP结束时间"` // VIP结束时间
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
RealityRole string `json:"realityRole" orm:"reality_role" description:"现实身份/角色"` // 现实身份/角色
|
||||
AbnormalRole string `json:"abnormalRole" orm:"abnormal_role" description:"异常身份/角色"` // 异常身份/角色
|
||||
JobTitle string `json:"jobTitle" orm:"job_title" description:"职位"` // 职位
|
||||
Commendation int `json:"commendation" orm:"Commendation" description:""` //
|
||||
Admonition int `json:"admonition" orm:"Admonition" description:""` //
|
||||
Email string `json:"email" orm:"email" description:""` //
|
||||
RedTrace int `json:"redTrace" orm:"red_trace" description:"红轨"` // 红轨
|
||||
YellowTrace int `json:"yellowTrace" orm:"yellow_trace" description:"黄轨"` // 黄轨
|
||||
BlueTrace int `json:"blueTrace" orm:"blue_trace" description:"蓝轨"` // 蓝轨
|
||||
Id uint64 `json:"id" orm:"id" description:"用户ID"` // 用户ID
|
||||
Account string `json:"account" orm:"account" description:"账号"` // 账号
|
||||
Password string `json:"password" orm:"password" description:"密码哈希"` // 密码哈希
|
||||
Nickname string `json:"nickname" orm:"nickname" description:"昵称"` // 昵称
|
||||
Gender int `json:"gender" orm:"gender" description:"性别:0未知 1男 2女"` // 性别:0未知 1男 2女
|
||||
BirthDate *gtime.Time `json:"birthDate" orm:"birth_date" description:"生日"` // 生日
|
||||
UserType string `json:"userType" orm:"user_type" description:"用户类型:1 user 2 admin"` // 用户类型:1 user 2 admin
|
||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
|
||||
RealityRole string `json:"realityRole" orm:"reality_role" description:"现实身份/角色"` // 现实身份/角色
|
||||
AbnormalRole string `json:"abnormalRole" orm:"abnormal_role" description:"异常身份/角色"` // 异常身份/角色
|
||||
JobTitle string `json:"jobTitle" orm:"job_title" description:"职位"` // 职位
|
||||
Email string `json:"email" orm:"email" description:""` //
|
||||
RedTrace int `json:"redTrace" orm:"red_trace" description:"红轨"` // 红轨
|
||||
YellowTrace int `json:"yellowTrace" orm:"yellow_trace" description:"黄轨"` // 黄轨
|
||||
BlueTrace int `json:"blueTrace" orm:"blue_trace" description:"蓝轨"` // 蓝轨
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user