23 lines
1.0 KiB
Go
23 lines
1.0 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
// OperationLog 操作日志
|
|
// 记录用户的关键操作行为
|
|
type OperationLog struct {
|
|
ID uint64 `json:"id" gorm:"primaryKey"`
|
|
UserID uint64 `json:"user_id" gorm:"index;default:0"` // 操作人
|
|
Username string `json:"username" gorm:"size:64"` // 操作人用户名
|
|
Action string `json:"action" gorm:"size:32;index;not null"` // 操作类型: login/upload/download/delete/share...
|
|
Resource string `json:"resource" gorm:"size:32;index"` // 资源类型: file/folder/user/system
|
|
Detail string `json:"detail" gorm:"size:512"` // 操作详情
|
|
IP string `json:"ip" gorm:"size:64"` // 客户端IP
|
|
UserAgent string `json:"user_agent" gorm:"size:256"` // 客户端UA
|
|
Status int `json:"status" gorm:"default:1"` // 1=成功 0=失败
|
|
CreatedAt time.Time `json:"created_at" gorm:"index"`
|
|
}
|
|
|
|
func (OperationLog) TableName() string {
|
|
return "fs_operation_log"
|
|
}
|