fix
This commit is contained in:
@@ -281,6 +281,15 @@ func (s *QiNiuStorageService) UploadFromReader(ctx context.Context, reader io.Re
|
||||
return s.UploadFile(ctx, fileBytes, fileName)
|
||||
}
|
||||
|
||||
// DownloadFileByKey 通过存储 key 下载文件(每次生成最新访问 URL,避免私有空间签名过期)
|
||||
func (s *QiNiuStorageService) DownloadFileByKey(ctx context.Context, key string) ([]byte, error) {
|
||||
if key == "" {
|
||||
return nil, fmt.Errorf("文件 key 不能为空")
|
||||
}
|
||||
fileURL := s.GetFileURL(ctx, key)
|
||||
return s.DownloadFile(ctx, fileURL)
|
||||
}
|
||||
|
||||
// DownloadFile 从七牛云下载文件
|
||||
func (s *QiNiuStorageService) DownloadFile(ctx context.Context, fileURL string) ([]byte, error) {
|
||||
s.logger.Info("开始从七牛云下载文件", zap.String("file_url", fileURL))
|
||||
|
||||
@@ -1070,6 +1070,10 @@ func (h *FinanceHandler) AdminDownloadInvoiceFile(c *gin.Context) {
|
||||
|
||||
result, err := h.adminInvoiceAppService.DownloadInvoiceFile(c.Request.Context(), applicationID)
|
||||
if err != nil {
|
||||
h.logger.Error("下载发票文件失败",
|
||||
zap.String("application_id", applicationID),
|
||||
zap.Error(err),
|
||||
)
|
||||
h.responseBuilder.InternalError(c, "下载发票文件失败")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user