This commit is contained in:
2026-03-19 16:55:24 +08:00
parent 3d47d20fb8
commit f86247c930
3 changed files with 48 additions and 3 deletions

View File

@@ -54,7 +54,16 @@ func (l *DownloadReportPdfLogic) DownloadReportPdf(req *types.DownloadReportPdfR
}
resp = &types.DownloadReportPdfResp{
FileName: fmt.Sprintf("report_%s.pdf", req.OrderNo),
FileName: func() string {
fileKey := req.OrderNo
if fileKey == "" {
fileKey = orderId
}
if fileKey == "" {
fileKey = "unknown"
}
return fmt.Sprintf("report_%s.pdf", fileKey)
}(),
Content: pdfBytes,
}
return resp, nil

View File

@@ -31,8 +31,16 @@ func (l *DownloadReportPdfLogic) DownloadReportPdf(req *types.DownloadReportPdfR
return nil, fmt.Errorf("生成报告 PDF 失败: %w", err)
}
fileKey := req.OrderNo
if fileKey == "" {
fileKey = req.OrderId
}
if fileKey == "" {
fileKey = "unknown"
}
resp = &types.DownloadReportPdfResp{
FileName: fmt.Sprintf("report_%s.pdf", req.OrderNo),
FileName: fmt.Sprintf("report_%s.pdf", fileKey),
Content: pdfBytes,
}
return resp, nil