初始化

This commit is contained in:
2026-07-03 16:01:08 +08:00
parent dc90e889e1
commit b51ee98afa
37 changed files with 6282 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
package model
import "time"
// UploadSession 分片上传会话
// 记录大文件分片上传的进度, 支持断点续传
type UploadSession struct {
ID string `json:"id" gorm:"primaryKey;size:64"` // 会话ID
FileID uint64 `json:"file_id" gorm:"default:0"` // 上传完成后的文件ID
FileName string `json:"file_name" gorm:"size:256;not null"` // 原始文件名
FileSize int64 `json:"file_size" gorm:"not null"` // 文件总大小
ChunkSize int64 `json:"chunk_size" gorm:"not null"` // 分片大小
TotalChunks int `json:"total_chunks" gorm:"not null"` // 总分片数
UploadedChunks string `json:"uploaded_chunks" gorm:"type:text"` // 已上传分片索引, 逗号分隔: "0,1,2"
MD5 string `json:"md5" gorm:"size:32"` // 文件MD5
SHA256 string `json:"sha256" gorm:"size:64"` // 文件SHA256
FolderID uint64 `json:"folder_id" gorm:"not null"` // 目标文件夹
OwnerID uint64 `json:"owner_id" gorm:"not null"` // 上传者
PolicyID uint64 `json:"policy_id" gorm:"default:1"` // 存储策略ID
Status int8 `json:"status" gorm:"default:1"` // 1=上传中 2=已完成 3=已取消
TempDir string `json:"temp_dir" gorm:"size:512"` // 临时分片目录
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (UploadSession) TableName() string {
return "fs_upload_session"
}