feat: 管理端板块管理与旧版数据导入,补充部署运营文档
- 新增管理端板块管理页面与后端接口(admin_board) - 新增旧版数据导入:legacyimport 服务、导入面板、importusers 命令行工具 - 聊天用户卡片、板块图标等 UI 组件与界面优化 - 补充 about/公告/1Panel 部署等文档 - gitignore 排除 dist/ 构建产物与 .agents/ 本地工具目录
This commit is contained in:
@@ -116,7 +116,7 @@ type User struct {
|
||||
Username string `gorm:"uniqueIndex;size:128;not null" json:"username"`
|
||||
Email string `gorm:"index;size:128;default:''" json:"-"`
|
||||
Password string `gorm:"size:128;not null" json:"-"`
|
||||
Nickname string `gorm:"size:64" json:"nickname"`
|
||||
Nickname string `gorm:"size:64" json:"nickname"` // 全站唯一:LOWER 函数唯一索引在 db.go InitDB 中创建(应用层校验见 service/auth.go)
|
||||
Avatar string `gorm:"size:512" json:"avatar"`
|
||||
Signature string `gorm:"size:255;default:''" json:"signature"` // 个性签名
|
||||
Role Role `gorm:"size:16;default:user" json:"role"`
|
||||
@@ -161,11 +161,40 @@ type Board struct {
|
||||
Icon string `gorm:"size:64;default:''" json:"icon"`
|
||||
ColorIndex int `gorm:"default:-1" json:"color_index"`
|
||||
SortOrder int `gorm:"default:0" json:"sort_order"`
|
||||
PostPolicy string `gorm:"size:16;default:'all'" json:"post_policy"` // all=全员可发;staff=仅管理员及以上
|
||||
Visible bool `gorm:"default:true" json:"visible"` // false 时不在前台列表/导航展示(仅隐藏入口)
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
}
|
||||
|
||||
// 板块发帖策略常量
|
||||
const (
|
||||
BoardPostPolicyAll = "all" // 全员可发帖
|
||||
BoardPostPolicyStaff = "staff" // 仅管理员及以上(含管辖该板的版主)可发帖
|
||||
)
|
||||
|
||||
// NormalizeBoardPostPolicy 归一化发帖策略,非法值回落 all
|
||||
func NormalizeBoardPostPolicy(v string) string {
|
||||
switch v {
|
||||
case BoardPostPolicyStaff:
|
||||
return BoardPostPolicyStaff
|
||||
default:
|
||||
return BoardPostPolicyAll
|
||||
}
|
||||
}
|
||||
|
||||
// ImportRecord 外部数据导入去重记录(旧站/WordPress/Typecho 等来源):
|
||||
// 同一来源同一源对象只导入一次,保证「预检→正式导入→重复导入」全程幂等。
|
||||
type ImportRecord struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Source string `gorm:"size:32;not null;uniqueIndex:idx_import_dedupe,priority:1" json:"source"` // jiang13 / wordpress / typecho
|
||||
Kind string `gorm:"size:16;not null;uniqueIndex:idx_import_dedupe,priority:2" json:"kind"` // board / post / comment
|
||||
SourceID string `gorm:"size:64;not null;uniqueIndex:idx_import_dedupe,priority:3" json:"source_id"`
|
||||
NewID uint `json:"new_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// Post 帖子
|
||||
type Post struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
|
||||
Reference in New Issue
Block a user