Documentation
¶
Index ¶
Constants ¶
View Source
const ( Enabled = 1 Disabled = 2 )
View Source
const ( MenuDirectory = 1 MenuPage = 2 MenuAction = 3 MenuLink = 4 )
View Source
const ( ScopeAll = "all" ScopeSelf = "self" ScopeDepartment = "department" ScopeDepartments = "departments" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
Base
Scope string `` /* 139-byte string literal not displayed */
Name string `json:"name" gorm:"not null;size:255;comment:附件名称" binding:"required,max=255"`
FileID uint `json:"file_id" gorm:"not null;default:0;uniqueIndex:idx_admin_attachment_file;comment:文件ID"`
CategoryID uint `json:"category_id" gorm:"not null;default:0;index;comment:附件分类ID:0为未分类"`
CreatedBy uint `json:"created_by" gorm:"not null;default:0;index;comment:上传管理员ID"`
File File `json:"file" gorm:"foreignKey:FileID"`
}
func (Attachment) TableName ¶
func (Attachment) TableName() string
type Base ¶
type Base struct {
ID uint `json:"id" gorm:"not null;primaryKey"`
CreatedAt int64 `json:"created_at" gorm:"not null;autoCreateTime:milli"`
UpdatedAt int64 `json:"updated_at" gorm:"not null;autoUpdateTime:milli"`
DeletedAt soft_delete.DeletedAt `json:"-" gorm:"not null;softDelete:milli;index;default:0"`
}
Base 复用主键、UTC 时间和软删除字段.
type Category ¶
type Category struct {
Base
Code *string `json:"code" gorm:"size:30;uniqueIndex;comment:自动分类标识,空值为自建分类"`
Name string `json:"name" gorm:"not null;size:100;comment:附件分类名称" binding:"required,max=100"`
ParentID uint `json:"parent_id" gorm:"not null;default:0;comment:上级分类ID:0为顶级;index"`
Sort int `json:"sort" gorm:"not null;default:0;comment:排序:升序"`
}
type ChatConversation ¶ added in v0.1.1
type ChatConversation struct {
ID uint `json:"id" gorm:"primaryKey"`
Type string `json:"type" gorm:"not null;size:16;comment:会话类型:direct单聊 support客服"`
Identify string `json:"-" gorm:"not null;size:180;uniqueIndex;comment:包含身份域的会话唯一标识"`
LastMessageID uint `json:"last_message_id" gorm:"not null;default:0;index;comment:最后消息ID"`
LastMessageAt int64 `json:"last_message_at" gorm:"not null;default:0;comment:最后消息时间(Unix毫秒)"`
CreatedAt int64 `json:"created_at" gorm:"not null;autoCreateTime:milli"`
UpdatedAt int64 `json:"updated_at" gorm:"not null;autoUpdateTime:milli"`
}
func (ChatConversation) TableName ¶ added in v0.1.1
func (ChatConversation) TableName() string
type ChatEvent ¶ added in v0.1.1
type ChatEvent struct {
ID uint `json:"id" gorm:"primaryKey;index:idx_chat_event_pending,priority:3"`
ConversationID uint `json:"conversation_id" gorm:"not null;index;comment:会话ID"`
Type string `json:"type" gorm:"not null;size:64;comment:实时事件类型"`
Data json.RawMessage `json:"data" gorm:"not null;type:json;comment:公开事件数据"`
Attempts int `json:"-" gorm:"not null;default:0;comment:投递尝试次数"`
AvailableAt int64 `json:"-" gorm:"not null;default:0;index:idx_chat_event_pending,priority:2;comment:下次投递或租约到期时间"`
PublishedAt int64 `json:"-" gorm:"not null;default:0;index:idx_chat_event_pending,priority:1;comment:发布到WS收件流的时间"`
CreatedAt int64 `json:"created_at" gorm:"not null;autoCreateTime:milli"`
}
type ChatMember ¶ added in v0.1.1
type ChatMember struct {
ConversationID uint `json:"conversation_id" gorm:"primaryKey;comment:会话ID"`
Realm string `json:"realm" gorm:"primaryKey;size:32;index:idx_chat_member_identity;comment:身份域:admin或业务定义"`
Subject string `json:"subject" gorm:"primaryKey;size:64;index:idx_chat_member_identity;comment:身份域内的主体ID"`
LastReadMessageID uint `json:"last_read_message_id" gorm:"not null;default:0;comment:已读消息位置"`
CreatedAt int64 `json:"created_at" gorm:"not null;autoCreateTime:milli"`
}
func (ChatMember) TableName ¶ added in v0.1.1
func (ChatMember) TableName() string
type ChatMessage ¶ added in v0.1.1
type ChatMessage struct {
ID uint `json:"id" gorm:"primaryKey;index:idx_chat_message_history,priority:2"`
ConversationID uint `json:"conversation_id" gorm:"not null;index:idx_chat_message_history,priority:1;comment:会话ID"`
SenderRealm string `` /* 159-byte string literal not displayed */
SenderSubject string `` /* 160-byte string literal not displayed */
RequestID string `json:"request_id" gorm:"not null;size:64;uniqueIndex:idx_chat_message_request;comment:发送幂等标识"`
Type string `json:"type" gorm:"not null;size:24;default:text;comment:消息类型:text文本 event事件"`
Status string `json:"status" gorm:"not null;size:16;default:completed;comment:queued streaming completed failed cancelled"`
Content string `json:"content" gorm:"not null;type:text;comment:消息正文"`
ReplyToID uint `json:"reply_to_id" gorm:"not null;default:0;comment:同会话被回复消息ID"`
Payload json.RawMessage `json:"payload" gorm:"type:json;comment:按消息类型定义的扩展数据"`
CreatedAt int64 `json:"created_at" gorm:"not null;autoCreateTime:milli;index:idx_chat_message_sender_time,priority:3"`
UpdatedAt int64 `json:"updated_at" gorm:"not null;autoUpdateTime:milli"`
}
func (ChatMessage) TableName ¶ added in v0.1.1
func (ChatMessage) TableName() string
type Department ¶
type Department struct {
Base
Name string `json:"name" gorm:"not null;size:100;comment:部门名称" binding:"required,max=100"`
ParentID uint `json:"parent_id" gorm:"not null;default:0;index;comment:上级部门ID:0为顶级"`
Leader string `json:"leader" gorm:"not null;size:100;comment:负责人"`
Phone string `json:"phone" gorm:"not null;size:40;comment:联系电话"`
Email string `json:"email" gorm:"not null;size:180;comment:联系邮箱"`
Sort int `json:"sort" gorm:"not null;default:0;comment:排序:升序"`
Status int `json:"status" gorm:"not null;type:smallint;default:1;comment:状态:1正常 2停用" binding:"oneof=1 2"`
Remark string `json:"remark" gorm:"not null;comment:备注;size:500"`
}
func (Department) TableName ¶
func (Department) TableName() string
type File ¶
type File struct {
Location storage.Config `json:"-" gorm:"not null;serializer:json;type:text;comment:上传时的存储位置(JSON):驱动和路径参数,不含密钥"`
ID uint `json:"id" gorm:"not null;primaryKey"`
MD5 string `json:"md5" gorm:"not null;size:32;index:idx_admin_file_lookup;comment:文件MD5摘要"`
SHA256 string `json:"sha256" gorm:"not null;size:64;uniqueIndex;comment:文件SHA-256摘要"`
Size int64 `json:"size" gorm:"not null;default:0;index:idx_admin_file_lookup;comment:文件大小(字节)"`
Path string `json:"-" gorm:"not null;size:500;comment:存储路径"`
MIME string `json:"mime" gorm:"not null;size:150;comment:文件媒体类型"`
CreatedAt int64 `json:"created_at" gorm:"not null;autoCreateTime:milli"`
}
type Log ¶
type Log struct {
Location string `json:"location" gorm:"not null;default:'';size:255;comment:IP地理位置"`
CountryCode string `json:"country_code" gorm:"not null;default:'';size:2;comment:IP所在国家代码"`
RequestData string `json:"request_data" gorm:"not null;type:text;comment:请求参数:敏感字段脱敏"`
ResponseData string `json:"response_data" gorm:"not null;type:text;comment:响应摘要:敏感字段脱敏"`
Sender string `json:"sender" gorm:"not null;default:'';size:180;comment:邮件发件地址:非邮件日志为空"`
Recipient string `json:"recipient" gorm:"not null;default:'';size:180;comment:邮件收件地址:非邮件日志为空"`
ID uint `json:"id" gorm:"not null;primaryKey"`
Kind string `` /* 127-byte string literal not displayed */
UserID uint `json:"user_id" gorm:"not null;default:0;index;comment:管理员ID"`
Username string `json:"username" gorm:"not null;size:80;comment:管理员账号"`
Method string `json:"method" gorm:"not null;size:10;comment:HTTP请求方法"`
Path string `json:"path" gorm:"not null;size:500;comment:请求路径"`
IP string `json:"ip" gorm:"not null;size:80;comment:客户端IP"`
Status int `json:"status" gorm:"not null;default:0;comment:HTTP响应状态码"`
Duration int64 `json:"duration" gorm:"not null;default:0;comment:请求耗时(毫秒)"`
Message string `json:"message" gorm:"not null;type:text;comment:日志内容"`
CreatedAt int64 `json:"created_at" gorm:"not null;autoCreateTime:milli;index:idx_admin_logs_kind_time"`
}
type Menu ¶
type Menu struct {
Base
Type int `json:"type" gorm:"not null;default:0;comment:类型:1目录 2菜单 3按钮 4外链" binding:"required,oneof=1 2 3 4"`
Path string `json:"path" gorm:"not null;size:500;comment:前端路由路径"`
Component string `json:"component" gorm:"not null;size:500;comment:前端组件路径"`
Status int `json:"status" gorm:"not null;type:smallint;default:1;comment:状态:1正常 2停用" binding:"required,oneof=1 2"`
Hidden bool `json:"hidden" gorm:"not null;default:false;comment:隐藏菜单:0否 1是"`
KeepAlive bool `json:"keep_alive" gorm:"not null;default:false;comment:缓存页面:0否 1是"`
FixedTab bool `json:"fixed_tab" gorm:"not null;default:false;comment:固定页签:0否 1是"`
FullPage bool `json:"full_page" gorm:"not null;default:false;comment:独立全屏:0否 1是"`
Key string `` /* 129-byte string literal not displayed */
ParentKey string `json:"parent_key" gorm:"not null;size:150;index;comment:上级菜单Key:空为顶级"`
Title string `json:"title" gorm:"not null;size:100;comment:菜单或权限名称" binding:"required,max=100"`
URL string `json:"url" gorm:"not null;size:1500;comment:菜单目标地址:站内路径或HTTP(S)地址" binding:"max=1500"`
Icon string `json:"icon" gorm:"not null;size:100;comment:菜单图标"`
Mode string `json:"mode" gorm:"not null;size:20;comment:打开方式:iframe后台内嵌 new_tab新窗口"`
SystemKey string `json:"system_key" gorm:"not null;size:100;comment:受控外部系统Key"`
Sort int `json:"sort" gorm:"not null;default:0;comment:排序:升序"`
}
Menu 保存自定义目录、外链菜单和操作权限, 内置菜单由代码定义.
type Post ¶
type Post struct {
Base
Name string `json:"name" gorm:"not null;size:100;comment:岗位名称" binding:"required,max=100"`
Code string `json:"code" gorm:"not null;size:100;uniqueIndex;comment:岗位唯一编码" binding:"required,max=100"`
Sort int `json:"sort" gorm:"not null;default:0;comment:排序:升序"`
Status int `json:"status" gorm:"not null;type:smallint;default:1;comment:状态:1正常 2停用" binding:"oneof=1 2"`
Remark string `json:"remark" gorm:"not null;comment:备注;size:500"`
}
type Role ¶
type Role struct {
Base
Name string `json:"name" gorm:"not null;size:100;comment:角色名称" binding:"required,max=100"`
Code string `json:"code" gorm:"not null;size:100;uniqueIndex;comment:角色唯一编码" binding:"required,max=100"`
Level int `json:"level" gorm:"not null;default:1;comment:管理级别:数值越大级别越高"`
Status int `json:"status" gorm:"not null;type:smallint;default:1;comment:状态:1正常 2停用" binding:"oneof=1 2"`
Sort int `json:"sort" gorm:"not null;default:0;comment:排序:升序"`
Remark string `json:"remark" gorm:"not null;comment:备注;size:500"`
DataScope string `` /* 140-byte string literal not displayed */
DepartmentIDs []uint `json:"department_ids" gorm:"not null;serializer:json;default:'[]';comment:指定部门ID列表(JSON)"`
}
type RolePermission ¶
type RolePermission struct {
RoleID uint `json:"role_id" gorm:"not null;primaryKey;comment:角色ID"`
Key string `json:"key" gorm:"not null;size:150;primaryKey;comment:授权权限Key"`
}
func (RolePermission) TableName ¶
func (RolePermission) TableName() string
type Session ¶
type Session struct {
ID string `json:"id" gorm:"not null;size:64;primaryKey"`
UserID uint `json:"user_id" gorm:"not null;default:0;index;comment:管理员ID"`
AccessHash string `json:"-" gorm:"not null;size:64;uniqueIndex;comment:访问凭证摘要"`
RefreshHash string `json:"-" gorm:"not null;size:64;uniqueIndex;comment:刷新凭证摘要"`
ExpiresAt int64 `json:"expires_at" gorm:"not null;default:0;index;comment:访问凭证到期时间(Unix毫秒)"`
RefreshExpiresAt int64 `json:"-" gorm:"not null;default:0;index;comment:刷新凭证到期时间(Unix毫秒)"`
CreatedAt int64 `json:"created_at" gorm:"not null;autoCreateTime:milli"`
IP string `json:"ip" gorm:"not null;size:80;comment:登录IP"`
UserAgent string `json:"user_agent" gorm:"not null;size:500;comment:客户端信息"`
}
Session 仅保存凭证摘要, 每次请求重新读取账号和角色状态.
type Setting ¶
type Setting struct {
ID uint `json:"id" gorm:"primaryKey"`
Key string `json:"key" gorm:"not null;size:100;uniqueIndex;comment:配置唯一标识"`
Name string `json:"name" gorm:"not null;size:100;comment:配置名称"`
Value string `json:"value" gorm:"not null;type:json;comment:配置内容JSON:保密字段保存密文"`
Revision int64 `json:"revision" gorm:"not null;default:1;comment:配置版本:防止并发写入旧缓存"`
CreatedAt int64 `json:"created_at" gorm:"not null;autoCreateTime:milli"`
UpdatedAt int64 `json:"updated_at" gorm:"not null;autoUpdateTime:milli"`
UpdatedBy uint `json:"updated_by" gorm:"not null;default:0;comment:最后修改管理员ID"`
}
type User ¶
type User struct {
Base
Username string `json:"username" gorm:"not null;size:80;uniqueIndex;comment:登录账号" binding:"required,max=80"`
Password string `json:"-" gorm:"not null;size:100;comment:密码哈希"`
Realname string `json:"realname" gorm:"not null;size:100;comment:姓名"`
Email string `json:"email" gorm:"not null;size:180;comment:邮箱"`
Phone string `json:"phone" gorm:"not null;size:40;comment:手机号"`
Avatar string `json:"avatar" gorm:"not null;size:500;comment:头像地址"`
Gender string `json:"gender" gorm:"not null;size:1;default:0;comment:性别:0未知 1男 2女"`
DepartmentID uint `json:"dept_id" gorm:"not null;default:0;index;comment:所属部门ID"`
Status int `json:"status" gorm:"not null;type:smallint;default:1;comment:状态:1正常 2停用"`
Super bool `json:"is_super" gorm:"not null;default:false;comment:超级管理员:0否 1是"`
Dashboard string `` /* 126-byte string literal not displayed */
Remark string `json:"remark" gorm:"not null;comment:备注;size:500"`
LoginTime int64 `json:"login_time" gorm:"not null;default:0;comment:最后登录时间(Unix毫秒)"`
Roles []Role `json:"role_list" gorm:"many2many:admin_user_roles"`
Posts []Post `json:"post_list" gorm:"many2many:admin_user_posts"`
}
Click to show internal directories.
Click to hide internal directories.