package dto import "time" // FileVO 文件视图对象 - 返回给前端 type FileVO struct { ID uint64 `json:"id"` Name string `json:"name"` Extension string `json:"extension"` FolderID uint64 `json:"folder_id"` Size int64 `json:"size"` StorageKey string `json:"storage_key"` StoragePolicyID uint64 `json:"storage_policy_id"` MimeType string `json:"mime_type"` IsFavorite int8 `json:"is_favorite"` DownloadCount int `json:"download_count"` Version int `json:"version"` // 乐观锁版本号 DownloadURL string `json:"download_url,omitempty"` // CDN下载链接 PreviewURL string `json:"preview_url,omitempty"` // CDN预览链接 CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // FolderVO 文件夹视图对象 type FolderVO struct { ID uint64 `json:"id"` Name string `json:"name"` ParentID uint64 `json:"parent_id"` Path string `json:"path"` Version int `json:"version"` // 乐观锁版本号 CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // FileListVO 文件列表响应 - 包含文件和文件夹 type FileListVO struct { Folders []FolderVO `json:"folders"` // 文件夹列表 Files []FileVO `json:"files"` // 文件列表 } // CreateFolderRequest 创建文件夹请求 type CreateFolderRequest struct { Name string `json:"name" binding:"required,max=256"` // 文件夹名称 ParentID uint64 `json:"parent_id"` // 父文件夹ID, 0=根目录 } // RenameRequest 重命名请求 type RenameRequest struct { NewName string `json:"new_name" binding:"required,max=256"` // 新名称 Version int `json:"version"` // 乐观锁版本号(可选) } // MoveRequest 移动请求 type MoveRequest struct { TargetFolderID uint64 `json:"target_folder_id" binding:"required"` // 目标文件夹ID } // ShareCreateRequest 创建分享请求 type ShareCreateRequest struct { FileID uint64 `json:"file_id" binding:"required"` Password string `json:"password"` ExpireHours int `json:"expire_hours"` MaxDownload int `json:"max_download"` AllowPreview int `json:"allow_preview"` // 1=允许 0=禁止, 默认1 AllowDownload int `json:"allow_download"` // 1=允许 0=禁止, 默认1 } // ShareVO 分享视图对象 type ShareVO struct { ID uint64 `json:"id"` ShareCode string `json:"share_code"` ShareURL string `json:"share_url"` HasPassword bool `json:"has_password"` ExpireAt *time.Time `json:"expire_at"` MaxDownload int `json:"max_download"` DownloadCount int `json:"download_count"` AllowPreview int8 `json:"allow_preview"` AllowDownload int8 `json:"allow_download"` CreatedAt time.Time `json:"created_at"` } // ShareVerifyRequest 验证分享密码请求 type ShareVerifyRequest struct { Password string `json:"password" binding:"required"` } // ShareFileVO 分享文件视图对象(公开) type ShareFileVO struct { Name string `json:"name"` Extension string `json:"extension"` Size int64 `json:"size"` MimeType string `json:"mime_type"` PreviewURL string `json:"preview_url"` // 预览链接 AllowPreview bool `json:"allow_preview"` AllowDownload bool `json:"allow_download"` CreatedAt time.Time `json:"created_at"` } // ========== 分片上传 ========== // ChunkUploadInitRequest 初始化分片上传请求 type ChunkUploadInitRequest struct { FileName string `json:"file_name" binding:"required"` FileSize int64 `json:"file_size" binding:"required"` MD5 string `json:"md5"` // 客户端计算的MD5(可选, 用于秒传) FolderID uint64 `json:"folder_id"` PolicyID uint64 `json:"policy_id"` // 存储策略ID } // ChunkUploadInitVO 初始化分片上传响应 type ChunkUploadInitVO struct { UploadID string `json:"upload_id"` // 上传会话ID Instant bool `json:"instant"` // 是否秒传 FileID uint64 `json:"file_id"` // 秒传时返回文件ID ChunkSize int64 `json:"chunk_size"` // 分片大小 Total int `json:"total"` // 总分片数 } // ChunkUploadChunkVO 单分片上传响应 type ChunkUploadChunkVO struct { Index int `json:"index"` Size int64 `json:"size"` Status string `json:"status"` // ok / exists } // ChunkUploadProgressVO 上传进度响应 type ChunkUploadProgressVO struct { UploadID string `json:"upload_id"` FileName string `json:"file_name"` FileSize int64 `json:"file_size"` ChunkSize int64 `json:"chunk_size"` TotalChunks int `json:"total_chunks"` Uploaded int `json:"uploaded"` Missing []int `json:"missing"` // 未上传的分片索引 Status int8 `json:"status"` // 1=上传中 2=已完成 3=已取消 }