feat: 新增批量获取文件下载预签名 URL 接口

新增 POST /api/admin/storage/batch-download-urls,支持一次传入最多 50 个 file_key,返回对应预签名下载 URL 映射。解决列表页批量展示图片需多次请求的问题。

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-18 10:08:45 +08:00
parent e52671eaed
commit 2413c2fe14
3 changed files with 127 additions and 0 deletions

View File

@@ -11,3 +11,14 @@ type GetUploadURLResponse struct {
FileKey string `json:"file_key" description:"文件路径标识,上传成功后用于调用业务接口"`
ExpiresIn int `json:"expires_in" description:"URL 有效期(秒)"`
}
// GetBatchDownloadURLsRequest 批量获取文件下载预签名 URL 请求
type GetBatchDownloadURLsRequest struct {
FileKeys []string `json:"file_keys" validate:"required,min=1,max=50,dive,required" required:"true" minLength:"1" description:"文件路径标识列表,最多 50 个"`
}
// GetBatchDownloadURLsResponse 批量获取文件下载预签名 URL 响应
type GetBatchDownloadURLsResponse struct {
URLs map[string]string `json:"urls" description:"file_key 到预签名下载 URL 的映射"`
ExpiresIn int `json:"expires_in" description:"URL 有效期(秒)"`
}