302 lines
12 KiB
Go
302 lines
12 KiB
Go
package v1
|
|
|
|
// 附件管理相关请求和响应结构
|
|
|
|
// AttachmentUploadReq 上传附件请求
|
|
type AttachmentUploadReq struct {
|
|
Type string `json:"type" v:"required|in:image,video,audio,document#附件类型不能为空|附件类型只能为image,video,audio,document"`
|
|
Category string `json:"category" v:"required|length:1,50#分类不能为空|分类长度为1-50个字符"`
|
|
Description string `json:"description" v:"max:200#描述长度不能超过200个字符"`
|
|
}
|
|
|
|
// AttachmentUploadRes 上传附件响应
|
|
type AttachmentUploadRes struct {
|
|
Id uint `json:"id"`
|
|
Filename string `json:"filename"`
|
|
Url string `json:"url"`
|
|
Size int64 `json:"size"`
|
|
Type string `json:"type"`
|
|
}
|
|
|
|
// AttachmentListReq 获取附件列表请求
|
|
type AttachmentListReq struct {
|
|
Page int `json:"page" v:"min:1#页码必须大于0"`
|
|
Size int `json:"size" v:"min:1|max:100#每页数量必须大于0|每页数量不能超过100"`
|
|
Type string `json:"type" v:"in:,image,video,audio,document#附件类型只能为image,video,audio,document"`
|
|
Category string `json:"category" v:"max:50#分类长度不能超过50个字符"`
|
|
Keyword string `json:"keyword" v:"max:50#关键词长度不能超过50个字符"`
|
|
StartDate string `json:"start_date" v:"date#开始日期格式不正确"`
|
|
EndDate string `json:"end_date" v:"date#结束日期格式不正确"`
|
|
MinSize int64 `json:"min_size" v:"min:0#最小文件大小不能小于0"`
|
|
MaxSize int64 `json:"max_size" v:"min:0#最大文件大小不能小于0"`
|
|
UserId uint `json:"user_id" v:"min:0#用户ID不能小于0"`
|
|
}
|
|
|
|
// AttachmentListRes 获取附件列表响应
|
|
type AttachmentListRes struct {
|
|
List []AttachmentItem `json:"list"`
|
|
Total int `json:"total"`
|
|
Page int `json:"page"`
|
|
Size int `json:"size"`
|
|
}
|
|
|
|
// AttachmentItem 附件列表项
|
|
type AttachmentItem struct {
|
|
Id uint `json:"id"`
|
|
Filename string `json:"filename"`
|
|
OriginalName string `json:"original_name"`
|
|
Url string `json:"url"`
|
|
Size int64 `json:"size"`
|
|
Type string `json:"type"`
|
|
Category string `json:"category"`
|
|
Description string `json:"description"`
|
|
UserId uint `json:"user_id"`
|
|
Username string `json:"username"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
}
|
|
|
|
// AttachmentDetailReq 获取附件详情请求
|
|
type AttachmentDetailReq struct {
|
|
Id uint `json:"id" v:"required|min:1#附件ID不能为空"`
|
|
}
|
|
|
|
// AttachmentDetailRes 获取附件详情响应
|
|
type AttachmentDetailRes struct {
|
|
Attachment AttachmentDetail `json:"attachment"`
|
|
}
|
|
|
|
// AttachmentDetail 附件详情
|
|
type AttachmentDetail struct {
|
|
Id uint `json:"id"`
|
|
Filename string `json:"filename"`
|
|
OriginalName string `json:"original_name"`
|
|
Url string `json:"url"`
|
|
Size int64 `json:"size"`
|
|
Type string `json:"type"`
|
|
Category string `json:"category"`
|
|
Description string `json:"description"`
|
|
UserId uint `json:"user_id"`
|
|
Username string `json:"username"`
|
|
DownloadCount int `json:"download_count"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
}
|
|
|
|
// AttachmentUpdateReq 更新附件请求
|
|
type AttachmentUpdateReq struct {
|
|
Id uint `json:"id" v:"required|min:1#附件ID不能为空"`
|
|
Category string `json:"category" v:"required|length:1,50#分类不能为空|分类长度为1-50个字符"`
|
|
Description string `json:"description" v:"max:200#描述长度不能超过200个字符"`
|
|
}
|
|
|
|
// AttachmentDeleteReq 删除附件请求
|
|
type AttachmentDeleteReq struct {
|
|
Id uint `json:"id" v:"required|min:1#附件ID不能为空"`
|
|
}
|
|
|
|
// AttachmentBatchDeleteReq 批量删除附件请求
|
|
type AttachmentBatchDeleteReq struct {
|
|
Ids []uint `json:"ids" v:"required|min:1#附件ID列表不能为空"`
|
|
}
|
|
|
|
// AttachmentDownloadReq 下载附件请求
|
|
type AttachmentDownloadReq struct {
|
|
Id uint `json:"id" v:"required|min:1#附件ID不能为空"`
|
|
}
|
|
|
|
// AttachmentDownloadRes 下载附件响应
|
|
type AttachmentDownloadRes struct {
|
|
Url string `json:"url"`
|
|
Filename string `json:"filename"`
|
|
}
|
|
|
|
// AttachmentCategoryListReq 获取附件分类列表请求
|
|
type AttachmentCategoryListReq struct {
|
|
Type string `json:"type" v:"in:,image,video,audio,document#附件类型只能为image,video,audio,document"`
|
|
}
|
|
|
|
// AttachmentCategoryListRes 获取附件分类列表响应
|
|
type AttachmentCategoryListRes struct {
|
|
Categories []AttachmentCategoryItem `json:"categories"`
|
|
}
|
|
|
|
// AttachmentCategoryItem 附件分类项
|
|
type AttachmentCategoryItem struct {
|
|
Category string `json:"category"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
// AttachmentStatisticsReq 获取附件统计请求
|
|
type AttachmentStatisticsReq struct {
|
|
StartDate string `json:"start_date" v:"date#开始日期格式不正确"`
|
|
EndDate string `json:"end_date" v:"date#结束日期格式不正确"`
|
|
Type string `json:"type" v:"in:,image,video,audio,document#附件类型只能为image,video,audio,document"`
|
|
}
|
|
|
|
// AttachmentStatisticsRes 获取附件统计响应
|
|
type AttachmentStatisticsRes struct {
|
|
TotalCount int `json:"total_count"` // 总附件数
|
|
TotalSize int64 `json:"total_size"` // 总文件大小
|
|
TypeStats []AttachmentTypeStatItem `json:"type_stats"` // 类型统计
|
|
CategoryStats []AttachmentCategoryStatItem `json:"category_stats"` // 分类统计
|
|
UploadChart []AttachmentUploadChartItem `json:"upload_chart"` // 上传图表数据
|
|
SizeChart []AttachmentSizeChartItem `json:"size_chart"` // 大小图表数据
|
|
PopularFiles []AttachmentPopularItem `json:"popular_files"` // 热门文件
|
|
RecentUploads []AttachmentRecentItem `json:"recent_uploads"` // 最近上传
|
|
}
|
|
|
|
// AttachmentTypeStatItem 附件类型统计项
|
|
type AttachmentTypeStatItem struct {
|
|
Type string `json:"type"`
|
|
Count int `json:"count"`
|
|
Size int64 `json:"size"`
|
|
Percentage string `json:"percentage"`
|
|
}
|
|
|
|
// AttachmentCategoryStatItem 附件分类统计项
|
|
type AttachmentCategoryStatItem struct {
|
|
Category string `json:"category"`
|
|
Count int `json:"count"`
|
|
Size int64 `json:"size"`
|
|
Percentage string `json:"percentage"`
|
|
}
|
|
|
|
// AttachmentUploadChartItem 附件上传图表项
|
|
type AttachmentUploadChartItem struct {
|
|
Date string `json:"date"`
|
|
Count int `json:"count"`
|
|
Size int64 `json:"size"`
|
|
}
|
|
|
|
// AttachmentSizeChartItem 附件大小图表项
|
|
type AttachmentSizeChartItem struct {
|
|
SizeRange string `json:"size_range"` // 大小范围,如 "0-1MB", "1-10MB"
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
// AttachmentPopularItem 热门附件项
|
|
type AttachmentPopularItem struct {
|
|
Id uint `json:"id"`
|
|
Filename string `json:"filename"`
|
|
Type string `json:"type"`
|
|
Size int64 `json:"size"`
|
|
DownloadCount int `json:"download_count"`
|
|
CreatedAt string `json:"created_at"`
|
|
}
|
|
|
|
// AttachmentRecentItem 最近上传附件项
|
|
type AttachmentRecentItem struct {
|
|
Id uint `json:"id"`
|
|
Filename string `json:"filename"`
|
|
OriginalName string `json:"original_name"`
|
|
Type string `json:"type"`
|
|
Size int64 `json:"size"`
|
|
UserId uint `json:"user_id"`
|
|
Username string `json:"username"`
|
|
CreatedAt string `json:"created_at"`
|
|
}
|
|
|
|
// AttachmentCleanupReq 清理附件请求
|
|
type AttachmentCleanupReq struct {
|
|
Type string `json:"type" v:"in:,image,video,audio,document#附件类型只能为image,video,audio,document"`
|
|
Days int `json:"days" v:"min:1#天数必须大于0"`
|
|
MinSize int64 `json:"min_size" v:"min:0#最小文件大小不能小于0"`
|
|
MaxSize int64 `json:"max_size" v:"min:0#最大文件大小不能小于0"`
|
|
Unused bool `json:"unused"` // 是否只清理未使用的附件
|
|
DryRun bool `json:"dry_run"` // 是否只是预览,不实际删除
|
|
}
|
|
|
|
// AttachmentCleanupRes 清理附件响应
|
|
type AttachmentCleanupRes struct {
|
|
DeletedCount int `json:"deleted_count"` // 删除数量
|
|
DeletedSize int64 `json:"deleted_size"` // 删除大小
|
|
DeletedFiles []string `json:"deleted_files"` // 删除的文件列表
|
|
}
|
|
|
|
// AttachmentMoveReq 移动附件请求
|
|
type AttachmentMoveReq struct {
|
|
Ids []uint `json:"ids" v:"required|min:1#附件ID列表不能为空"`
|
|
NewCategory string `json:"new_category" v:"required|length:1,50#新分类不能为空|新分类长度为1-50个字符"`
|
|
}
|
|
|
|
// AttachmentCopyReq 复制附件请求
|
|
type AttachmentCopyReq struct {
|
|
Id uint `json:"id" v:"required|min:1#附件ID不能为空"`
|
|
NewCategory string `json:"new_category" v:"length:1,50#新分类长度为1-50个字符"`
|
|
Description string `json:"description" v:"max:200#描述长度不能超过200个字符"`
|
|
}
|
|
|
|
// AttachmentCopyRes 复制附件响应
|
|
type AttachmentCopyRes struct {
|
|
Id uint `json:"id"`
|
|
Filename string `json:"filename"`
|
|
Url string `json:"url"`
|
|
}
|
|
|
|
// AttachmentRenameReq 重命名附件请求
|
|
type AttachmentRenameReq struct {
|
|
Id uint `json:"id" v:"required|min:1#附件ID不能为空"`
|
|
Filename string `json:"filename" v:"required|length:1,100#文件名不能为空|文件名长度为1-100个字符"`
|
|
}
|
|
|
|
// AttachmentSearchReq 搜索附件请求
|
|
type AttachmentSearchReq struct {
|
|
Query string `json:"query" v:"required|length:1,100#搜索关键词不能为空|搜索关键词长度为1-100个字符"`
|
|
Type string `json:"type" v:"in:,image,video,audio,document#附件类型只能为image,video,audio,document"`
|
|
Category string `json:"category" v:"max:50#分类长度不能超过50个字符"`
|
|
Page int `json:"page" v:"min:1#页码必须大于0"`
|
|
Size int `json:"size" v:"min:1|max:100#每页数量必须大于0|每页数量不能超过100"`
|
|
}
|
|
|
|
// AttachmentSearchRes 搜索附件响应
|
|
type AttachmentSearchRes struct {
|
|
List []AttachmentItem `json:"list"`
|
|
Total int `json:"total"`
|
|
Page int `json:"page"`
|
|
Size int `json:"size"`
|
|
}
|
|
|
|
// AttachmentExportReq 导出附件请求
|
|
type AttachmentExportReq struct {
|
|
Type string `json:"type" v:"in:,image,video,audio,document#附件类型只能为image,video,audio,document"`
|
|
Category string `json:"category" v:"max:50#分类长度不能超过50个字符"`
|
|
StartDate string `json:"start_date" v:"date#开始日期格式不正确"`
|
|
EndDate string `json:"end_date" v:"date#结束日期格式不正确"`
|
|
}
|
|
|
|
// AttachmentExportRes 导出附件响应
|
|
type AttachmentExportRes struct {
|
|
FileUrl string `json:"file_url"` // 导出文件URL
|
|
}
|
|
|
|
// AttachmentUserListReq 获取用户附件列表请求(用户端)
|
|
type AttachmentUserListReq struct {
|
|
Page int `json:"page" v:"min:1#页码必须大于0"`
|
|
Size int `json:"size" v:"min:1|max:50#每页数量必须大于0|每页数量不能超过50"`
|
|
Type string `json:"type" v:"in:,image,video,audio,document#附件类型只能为image,video,audio,document"`
|
|
Category string `json:"category" v:"max:50#分类长度不能超过50个字符"`
|
|
Keyword string `json:"keyword" v:"max:50#关键词长度不能超过50个字符"`
|
|
}
|
|
|
|
// AttachmentUserListRes 获取用户附件列表响应(用户端)
|
|
type AttachmentUserListRes struct {
|
|
List []AttachmentUserItem `json:"list"`
|
|
Total int `json:"total"`
|
|
Page int `json:"page"`
|
|
Size int `json:"size"`
|
|
}
|
|
|
|
// AttachmentUserItem 用户附件列表项
|
|
type AttachmentUserItem struct {
|
|
Id uint `json:"id"`
|
|
Filename string `json:"filename"`
|
|
OriginalName string `json:"original_name"`
|
|
Url string `json:"url"`
|
|
Size int64 `json:"size"`
|
|
Type string `json:"type"`
|
|
Category string `json:"category"`
|
|
Description string `json:"description"`
|
|
CreatedAt string `json:"created_at"`
|
|
}
|