Browse Source

研报宽度-pdf下载移动端实现

gmy 2 months ago
parent
commit
7dbb26faf6
2 changed files with 8 additions and 6 deletions
  1. 2 0
      models/report.go
  2. 6 6
      services/smart_report.go

+ 2 - 0
models/report.go

@@ -133,6 +133,8 @@ type ReportList struct {
 	ApproveTime        string                    `description:"审批时间"`
 	DetailImgUrl       string                    `description:"报告详情长图地址"`
 	DetailPdfUrl       string                    `description:"报告详情PDF地址"`
+	DetailImgUrlMobile string                    `description:"报告详情长图地址-手机端"`
+	DetailPdfUrlMobile string                    `description:"报告详情PDF地址-手机端"`
 
 	CollaborateType     int8      `description:"协作方式,1:个人,2:多人协作。默认:1"`
 	ReportLayout        int8      `description:"报告布局,1:常规布局,2:智能布局。默认:1"`

+ 6 - 6
services/smart_report.go

@@ -327,7 +327,7 @@ func Report2pdfAndJpeg(reportUrl string, reportId, reportType int) {
 	reportCode := utils.MD5(strconv.Itoa(reportId))
 
 	// pc端
-	{
+	go func() {
 		pdfPath := `./static/` + reportCode + "_1200.pdf"
 		jpegPath := `./static/` + reportCode + "_1200.jpg"
 
@@ -448,10 +448,10 @@ func Report2pdfAndJpeg(reportUrl string, reportId, reportType int) {
 				return
 			}
 		}
-	}
+	}()
 
 	// 移动端
-	{
+	go func() {
 		pdfPathMobile := `./static/` + reportCode + "_600.pdf"
 		jpegPathMobile := `./static/` + reportCode + "_600.jpg"
 
@@ -495,7 +495,7 @@ func Report2pdfAndJpeg(reportUrl string, reportId, reportType int) {
 			// 更新pdf url
 			ob := new(smart_report.SmartReport)
 			ob.SmartReportId = reportId
-			ob.DetailPdfUrl = resourceUrl
+			ob.DetailPdfUrlMobile = resourceUrl
 			if err = ob.Update([]string{"DetailPdfUrlMobile"}); err != nil {
 				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
 				return
@@ -551,7 +551,7 @@ func Report2pdfAndJpeg(reportUrl string, reportId, reportType int) {
 			// 更新jpeg url
 			ob := new(smart_report.SmartReport)
 			ob.SmartReportId = reportId
-			ob.DetailImgUrl = resourceUrl
+			ob.DetailImgUrlMobile = resourceUrl
 			if err = ob.Update([]string{"DetailImgUrlMobile"}); err != nil {
 				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
 				return
@@ -569,5 +569,5 @@ func Report2pdfAndJpeg(reportUrl string, reportId, reportType int) {
 				return
 			}
 		}
-	}
+	}()
 }