|
@@ -302,9 +302,14 @@ func Report2pdfAndJpeg(reportUrl string, reportId, reportType int) {
|
|
|
if reportUrl == `` {
|
|
|
return
|
|
|
}
|
|
|
- report, err := models.GetReportById(reportId)
|
|
|
+ var report *models.ReportDetail
|
|
|
+
|
|
|
// 先清空字段
|
|
|
if reportType == 1 {
|
|
|
+ report, err = models.GetReportById(reportId)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
err = models.UpdatePdfUrlReportById(reportId)
|
|
|
if err != nil {
|
|
|
utils.FileLog.Info("清空pdf长图字段失败, Err: \n" + err.Error())
|
|
@@ -333,8 +338,10 @@ func Report2pdfAndJpeg(reportUrl string, reportId, reportType int) {
|
|
|
go func() {
|
|
|
width := 1200
|
|
|
top, bottom, left, right := 20, 20, 20, 20
|
|
|
- if report.ReportLayout == 3 {
|
|
|
- top, bottom, left, right = 0, 0, 0, 0
|
|
|
+ if reportType == 1 {
|
|
|
+ if report != nil && report.ReportLayout == 3 {
|
|
|
+ top, bottom, left, right = 0, 0, 0, 0
|
|
|
+ }
|
|
|
}
|
|
|
err := ReportToPdf(width, reportUrl, pdfPath, top, bottom, left, right)
|
|
|
if err != nil {
|
|
@@ -460,7 +467,13 @@ func Report2pdfAndJpeg(reportUrl string, reportId, reportType int) {
|
|
|
// 移动端
|
|
|
pdfPathMobile := `./static/` + reportCode + "_600.pdf"
|
|
|
jpegPathMobile := `./static/` + reportCode + "_600.jpeg"
|
|
|
- if report.ReportLayout != 3 {
|
|
|
+ var mobilePdf = true
|
|
|
+ if reportType == 1 && report != nil {
|
|
|
+ if report.ReportLayout == 3 {
|
|
|
+ mobilePdf = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if mobilePdf {
|
|
|
go func() {
|
|
|
width := 600
|
|
|
top, bottom, left, right := 20, 20, 20, 20
|