package model import "time" // UploadFile 上传文件记录表(MD5去重用) type UploadFile struct { ID uint `gorm:"primaryKey" json:"id"` Md5 string `gorm:"size:32;uniqueIndex;not null" json:"md5"` FilePath string `gorm:"size:512;not null" json:"file_path"` // 相对路径,如 classes/20260101_1_abc.jpg FileUrl string `gorm:"size:512;not null" json:"file_url"` // 可访问URL,如 /uploads/classes/xxx.jpg FileName string `gorm:"size:255" json:"file_name"` FileSize int64 `gorm:"default:0" json:"file_size"` FileType string `gorm:"size:32" json:"file_type"` // class/photo/avatar UploaderID uint `gorm:"index" json:"uploader_id"` RefCount int `gorm:"default:1" json:"ref_count"` // 引用次数 CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }