浏览代码

Merge branch 'eta_2.3.9_report_width_1230@guomengyuan' of eta_server/eta_api into master

chenhan 1 周之前
父节点
当前提交
95bc1dea9d

+ 10 - 2
controllers/report_approve/report_approve.go

@@ -359,6 +359,8 @@ func (this *ReportApproveController) List() {
 	// 审批通过的报告显示下载按钮
 	reportImg := make(map[string]string)
 	reportPdf := make(map[string]string)
+	reportImgMobile := make(map[string]string)
+	reportPdfMobile := make(map[string]string)
 	{
 		var reportIds, enReportIds []int
 		for _, v := range ormList {
@@ -373,7 +375,7 @@ func (this *ReportApproveController) List() {
 			}
 		}
 		if len(reportIds) > 0 {
-			reports, e := models.GetReportFieldsByIds(reportIds, []string{"id", "detail_img_url", "detail_pdf_url"})
+			reports, e := models.GetReportFieldsByIds(reportIds, []string{"id", "detail_img_url", "detail_pdf_url", "detail_img_url_mobile", "detail_pdf_url_mobile"})
 			if e != nil {
 				br.Msg = "获取失败"
 				br.ErrMsg = fmt.Sprintf("GetReportFieldsByIds, %v", e)
@@ -383,10 +385,12 @@ func (this *ReportApproveController) List() {
 				k := fmt.Sprintf("%d-%d", report_approve.FlowReportTypeChinese, r.Id)
 				reportImg[k] = r.DetailImgUrl
 				reportPdf[k] = r.DetailPdfUrl
+				reportImgMobile[k] = r.DetailImgUrlMobile
+				reportPdfMobile[k] = r.DetailPdfUrlMobile
 			}
 		}
 		if len(enReportIds) > 0 {
-			enReports, e := models.GetEnglishReportFieldsByIds(enReportIds, []string{"id", "detail_img_url", "detail_pdf_url"})
+			enReports, e := models.GetEnglishReportFieldsByIds(enReportIds, []string{"id", "detail_img_url", "detail_pdf_url", "detail_img_url_mobile", "detail_pdf_url_mobile"})
 			if e != nil {
 				br.Msg = "获取失败"
 				br.ErrMsg = fmt.Sprintf("GetEnglishReportFieldsByIds, %v", e)
@@ -396,6 +400,8 @@ func (this *ReportApproveController) List() {
 				k := fmt.Sprintf("%d-%d", report_approve.FlowReportTypeEnglish, r.Id)
 				reportImg[k] = r.DetailImgUrl
 				reportPdf[k] = r.DetailPdfUrl
+				reportImgMobile[k] = r.DetailImgUrlMobile
+				reportPdfMobile[k] = r.DetailPdfUrlMobile
 			}
 		}
 	}
@@ -439,6 +445,8 @@ func (this *ReportApproveController) List() {
 		k := fmt.Sprintf("%d-%d", t.ReportType, t.ReportId)
 		t.DetailImgUrl = reportImg[k]
 		t.DetailPdfUrl = reportPdf[k]
+		t.DetailImgUrlMobile = reportImgMobile[k]
+		t.DetailPdfUrlMobile = reportPdfMobile[k]
 
 		respList = append(respList, t)
 	}

+ 1 - 2
models/data_manage/edb_info_relation.go

@@ -3,10 +3,9 @@ package data_manage
 import (
 	"eta/eta_api/global"
 	"eta/eta_api/utils"
+	"github.com/rdlucklib/rdluck_tools/paging"
 	"gorm.io/gorm"
 	"time"
-
-	"github.com/rdlucklib/rdluck_tools/paging"
 )
 
 type EdbInfoRelation struct {

+ 20 - 0
models/english_report.go

@@ -51,6 +51,8 @@ type EnglishReport struct {
 	ApproveId          int       `description:"审批ID"`
 	DetailImgUrl       string    `description:"报告详情长图地址"`
 	DetailPdfUrl       string    `description:"报告详情PDF地址"`
+	DetailImgUrlMobile string    `description:"报告详情长图地址-手机端"`
+	DetailPdfUrlMobile string    `description:"报告详情PDF地址-手机端"`
 	EmailHasFail       int       `description:"是否存在邮件发送失败的记录: 0-否; 1-是"`
 }
 
@@ -324,6 +326,8 @@ type EnglishReportList struct {
 	ApproveTime        string    `description:"审批时间"`
 	DetailImgUrl       string    `description:"报告详情长图地址"`
 	DetailPdfUrl       string    `description:"报告详情PDF地址"`
+	DetailImgUrlMobile string    `description:"报告详情长图地址-手机端"`
+	DetailPdfUrlMobile string    `description:"报告详情PDF地址-手机端"`
 }
 
 type EnglishReportListResp struct {
@@ -1043,6 +1047,20 @@ func ModifyEnglishReportImgUrl(reportId int, detailImgUrl string) (err error) {
 	return
 }
 
+func ModifyEnglishReportPdfUrlMobile(reportId int, detailPdfUrlMobile string) (err error) {
+	o := global.DbMap[utils.DbNameReport]
+	sql := `UPDATE english_report SET detail_pdf_url_mobile=? WHERE id=? `
+	err = o.Exec(sql, detailPdfUrlMobile, reportId).Error
+	return
+}
+
+func ModifyEnglishReportImgUrlMobile(reportId int, detailImgUrlMobile string) (err error) {
+	o := global.DbMap[utils.DbNameReport]
+	sql := `UPDATE english_report SET detail_img_url_mobile=? WHERE id=? `
+	err = o.Exec(sql, detailImgUrlMobile, reportId).Error
+	return
+}
+
 func FormatEnglishReport2ListItem(origin *EnglishReport) (item *EnglishReportList) {
 	if origin == nil {
 		return
@@ -1087,6 +1105,8 @@ func FormatEnglishReport2ListItem(origin *EnglishReport) (item *EnglishReportLis
 	item.ApproveTime = utils.TimeTransferString(utils.FormatDateTime, origin.ApproveTime)
 	item.DetailImgUrl = origin.DetailImgUrl
 	item.DetailPdfUrl = origin.DetailPdfUrl
+	item.DetailImgUrlMobile = origin.DetailImgUrlMobile
+	item.DetailPdfUrlMobile = origin.DetailPdfUrlMobile
 	return
 }
 

+ 55 - 39
models/report.go

@@ -6,11 +6,10 @@ import (
 	"eta/eta_api/global"
 	"eta/eta_api/utils"
 	"fmt"
-	"strings"
-	"time"
-
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"gorm.io/gorm"
+	"strings"
+	"time"
 )
 
 // 报告状态
@@ -34,42 +33,43 @@ const (
 )
 
 type Report struct {
-	Id                 int       `gorm:"column:id;primaryKey;autoIncrement" description:"报告Id"`
-	AddType            int       `description:"新增方式:1:新增报告,2:继承报告"`
-	ClassifyIdFirst    int       `description:"一级分类id"`
-	ClassifyNameFirst  string    `description:"一级分类名称"`
-	ClassifyIdSecond   int       `description:"二级分类id"`
-	ClassifyNameSecond string    `description:"二级分类名称"`
-	Title              string    `description:"标题"`
-	Abstract           string    `description:"摘要"`
-	Author             string    `description:"作者"`
-	Frequency          string    `description:"频度"`
-	CreateTime         string    `description:"创建时间"`
-	ModifyTime         time.Time `description:"修改时间"`
-	State              int       `description:"1:未发布;2:已发布;3-待提交;4-待审批;5-已驳回;6-已通过"`
-	PublishTime        time.Time `description:"发布时间"`
-	Stage              int       `description:"期数"`
-	MsgIsSend          int       `description:"消息是否已发送,0:否,1:是"`
-	ThsMsgIsSend       int       `description:"客户群消息是否已发送,0:否,1:是"`
-	Content            string    `description:"内容"`
-	VideoUrl           string    `description:"音频文件URL"`
-	VideoName          string    `description:"音频文件名称"`
-	VideoPlaySeconds   string    `description:"音频播放时长"`
-	VideoSize          string    `description:"音频文件大小,单位M"`
-	ContentSub         string    `description:"内容前两个章节"`
-	ReportCode         string    `description:"报告唯一编码"`
-	ReportVersion      int       `description:"1:旧版,2:新版"`
-	HasChapter         int       `description:"是否有章节 0-否 1-是"`
-	ChapterType        string    `description:"章节类型 day-晨报 week-周报"`
-	OldReportId        int       `description:"research_report表ID, 大于0则表示该报告为老后台同步过来的"`
-	MsgSendTime        time.Time `description:"模版消息发送时间"`
-	AdminId            int       `description:"创建者账号"`
-	AdminRealName      string    `description:"创建者姓名"`
-	ApproveTime        time.Time `description:"审批时间"`
-	ApproveId          int       `description:"审批ID"`
-	DetailImgUrl       string    `description:"报告详情长图地址"`
-	DetailPdfUrl       string    `description:"报告详情PDF地址"`
-
+	Id                  int       `orm:"column(id)" description:"报告Id"`
+	AddType             int       `description:"新增方式:1:新增报告,2:继承报告"`
+	ClassifyIdFirst     int       `description:"一级分类id"`
+	ClassifyNameFirst   string    `description:"一级分类名称"`
+	ClassifyIdSecond    int       `description:"二级分类id"`
+	ClassifyNameSecond  string    `description:"二级分类名称"`
+	Title               string    `description:"标题"`
+	Abstract            string    `description:"摘要"`
+	Author              string    `description:"作者"`
+	Frequency           string    `description:"频度"`
+	CreateTime          string    `description:"创建时间"`
+	ModifyTime          time.Time `description:"修改时间"`
+	State               int       `description:"1:未发布;2:已发布;3-待提交;4-待审批;5-已驳回;6-已通过"`
+	PublishTime         time.Time `description:"发布时间"`
+	Stage               int       `description:"期数"`
+	MsgIsSend           int       `description:"消息是否已发送,0:否,1:是"`
+	ThsMsgIsSend        int       `description:"客户群消息是否已发送,0:否,1:是"`
+	Content             string    `description:"内容"`
+	VideoUrl            string    `description:"音频文件URL"`
+	VideoName           string    `description:"音频文件名称"`
+	VideoPlaySeconds    string    `description:"音频播放时长"`
+	VideoSize           string    `description:"音频文件大小,单位M"`
+	ContentSub          string    `description:"内容前两个章节"`
+	ReportCode          string    `description:"报告唯一编码"`
+	ReportVersion       int       `description:"1:旧版,2:新版"`
+	HasChapter          int       `description:"是否有章节 0-否 1-是"`
+	ChapterType         string    `description:"章节类型 day-晨报 week-周报"`
+	OldReportId         int       `description:"research_report表ID, 大于0则表示该报告为老后台同步过来的"`
+	MsgSendTime         time.Time `description:"模版消息发送时间"`
+	AdminId             int       `description:"创建者账号"`
+	AdminRealName       string    `description:"创建者姓名"`
+	ApproveTime         time.Time `description:"审批时间"`
+	ApproveId           int       `description:"审批ID"`
+	DetailImgUrl        string    `description:"报告详情长图地址"`
+	DetailPdfUrl        string    `description:"报告详情PDF地址"`
+	DetailImgUrlMobile  string    `description:"报告详情长图地址-手机端"`
+	DetailPdfUrlMobile  string    `description:"报告详情PDF地址-手机端"`
 	ContentStruct       string    `description:"内容组件"`
 	LastModifyAdminId   int       `description:"最后更新人ID"`
 	LastModifyAdminName string    `description:"最后更新人姓名"`
@@ -147,6 +147,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"`
@@ -1570,6 +1572,20 @@ func ModifyReportImgUrl(reportId int, detailImgUrl string) (err error) {
 	return
 }
 
+func ModifyReportPdfUrlMobile(reportId int, detailPdfUrlMobile string) (err error) {
+	o := global.DbMap[utils.DbNameReport]
+	sql := `UPDATE report SET detail_pdf_url_mobile=? WHERE id=? `
+	err = o.Exec(sql, detailPdfUrlMobile, reportId).Error
+	return
+}
+
+func ModifyReportImgUrlMobile(reportId int, detailImgUrlMobile string) (err error) {
+	o := global.DbMap[utils.DbNameReport]
+	sql := `UPDATE report SET detail_img_url_mobile=? WHERE id=? `
+	err = o.Exec(sql, detailImgUrlMobile, reportId).Error
+	return
+}
+
 // UpdatePdfUrlReportById 清空pdf相关字段
 func UpdatePdfUrlReportById(reportId int) (err error) {
 	o := global.DbMap[utils.DbNameReport]

+ 2 - 0
models/report_approve/report_approve.go

@@ -200,6 +200,8 @@ type ReportApproveItem struct {
 	ModifyTime            string `description:"修改时间"`
 	DetailImgUrl          string `description:"报告详情长图地址"`
 	DetailPdfUrl          string `description:"报告详情PDF地址"`
+	DetailImgUrlMobile    string `description:"报告详情长图地址-手机端"`
+	DetailPdfUrlMobile    string `description:"报告详情PDF地址-手机端"`
 }
 
 // FormatReportApproveOrm2Item 格式化报告审批

+ 2 - 0
models/smart_report/smart_report.go

@@ -51,6 +51,8 @@ type SmartReport struct {
 	MsgSendTime         time.Time `description:"模版消息发送时间"`
 	DetailImgUrl        string    `description:"报告详情长图地址"`
 	DetailPdfUrl        string    `description:"报告详情PDF地址"`
+	DetailImgUrlMobile  string    `description:"报告详情长图地址-手机端"`
+	DetailPdfUrlMobile  string    `description:"报告详情PDF地址-手机端"`
 	CreateTime          time.Time `description:"创建时间"`
 	ModifyTime          time.Time `description:"修改时间"`
 	HeadImg             string    `description:"报告头图地址"`

+ 221 - 97
services/smart_report.go

@@ -167,10 +167,10 @@ async def main():
         'path': "%s",
         'printBackground': True,
         'margin': {
-            'top': '10mm',
-            'bottom': '10mm',
-            'left': '10mm',
-            'right': '10mm'
+            'top': '20px',
+            'bottom': '20px',
+            'left': '20px',
+            'right': '20px'
         }
     })
     await browser.close()
@@ -325,124 +325,248 @@ func Report2pdfAndJpeg(reportUrl string, reportId, reportType int) {
 
 	reportCode := utils.MD5(strconv.Itoa(reportId))
 
-	pdfPath := `./static/` + reportCode + ".pdf"
-	jpegPath := `./static/` + reportCode + ".jpg"
+	// pc端
+	go func() {
+		pdfPath := `./static/` + reportCode + "_1200.pdf"
+		jpegPath := `./static/` + reportCode + "_1200.jpg"
 
-	width := 1200
-	//if reportType == 3 {
-	//	width = 800
-	//}
-	err = ReportToPdf(width, reportUrl, pdfPath)
-	if err != nil {
-		utils.FileLog.Info("ReportToPdf failed: , error: \n" + err.Error())
-		go alarm_msg.SendAlarmMsg("ReportToPdf failed:"+err.Error(), 3)
-	}
-
-	file, err := os.Open(pdfPath)
-	if err != nil {
-		utils.FileLog.Info("Open failed: , error: \n" + err.Error())
-		go alarm_msg.SendAlarmMsg("Open failed:"+err.Error(), 3)
-		return
-	}
+		width := 1200
+		//if reportType == 3 {
+		//	width = 800
+		//}
+		err = ReportToPdf(width, reportUrl, pdfPath)
+		if err != nil {
+			utils.FileLog.Info("ReportToPdf failed: , error: \n" + err.Error())
+			go alarm_msg.SendAlarmMsg("ReportToPdf failed:"+err.Error(), 3)
+		}
 
-	ext := path.Ext(file.Name())
+		file, err := os.Open(pdfPath)
+		if err != nil {
+			utils.FileLog.Info("Open failed: , error: \n" + err.Error())
+			go alarm_msg.SendAlarmMsg("Open failed:"+err.Error(), 3)
+			return
+		}
 
-	randStr := utils.GetRandStringNoSpecialChar(28)
-	fileName := randStr + ext
-	defer file.Close() //关闭上传文件
+		ext := path.Ext(file.Name())
 
-	resourceUrl := ``
-	ossClient := NewOssClient()
-	if ossClient == nil {
-		utils.FileLog.Info("初始化OSS服务失败")
-		return
-	}
-	resourceUrl, err = ossClient.UploadFile(fileName, pdfPath, "")
-	if err != nil {
-		utils.FileLog.Info("文件上传失败, Err: \n" + err.Error())
-		go alarm_msg.SendAlarmMsg("文件上传失败:"+err.Error(), 3)
-		return
-	}
-	defer func() {
-		_ = os.Remove(pdfPath)
-	}()
+		randStr := utils.GetRandStringNoSpecialChar(28)
+		fileName := randStr + ext
+		defer file.Close() //关闭上传文件
 
-	if reportType == 3 {
-		// 更新pdf url
-		ob := new(smart_report.SmartReport)
-		ob.SmartReportId = reportId
-		ob.DetailPdfUrl = resourceUrl
-		if err = ob.Update([]string{"DetailPdfUrl"}); err != nil {
-			utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+		resourceUrl := ``
+		ossClient := NewOssClient()
+		if ossClient == nil {
+			utils.FileLog.Info("初始化OSS服务失败")
 			return
 		}
-	} else if reportType == 2 {
-		err = models.ModifyEnglishReportPdfUrl(reportId, resourceUrl)
+		resourceUrl, err = ossClient.UploadFile(fileName, pdfPath, "")
 		if err != nil {
-			utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+			utils.FileLog.Info("文件上传失败, Err: \n" + err.Error())
+			go alarm_msg.SendAlarmMsg("文件上传失败:"+err.Error(), 3)
 			return
 		}
-	} else if reportType == 1 {
-		err = models.ModifyReportPdfUrl(reportId, resourceUrl)
+		defer func() {
+			_ = os.Remove(pdfPath)
+		}()
+
+		if reportType == 3 {
+			// 更新pdf url
+			ob := new(smart_report.SmartReport)
+			ob.SmartReportId = reportId
+			ob.DetailPdfUrl = resourceUrl
+			if err = ob.Update([]string{"DetailPdfUrl"}); err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		} else if reportType == 2 {
+			err = models.ModifyEnglishReportPdfUrl(reportId, resourceUrl)
+			if err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		} else if reportType == 1 {
+			err = models.ModifyReportPdfUrl(reportId, resourceUrl)
+			if err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		}
+
+		time.Sleep(1 * time.Minute)
+
+		err = ReportToJpeg(width, reportUrl, jpegPath)
+		if err != nil {
+			utils.FileLog.Info("ReportToJpeg failed: , error: \n" + err.Error())
+		}
+		file, err = os.Open(jpegPath)
 		if err != nil {
-			utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+			utils.FileLog.Info("open file failed: , error: \n" + err.Error())
 			return
 		}
-	}
 
-	time.Sleep(1 * time.Minute)
+		ext = path.Ext(file.Name())
 
-	err = ReportToJpeg(width, reportUrl, jpegPath)
-	if err != nil {
-		utils.FileLog.Info("ReportToJpeg failed: , error: \n" + err.Error())
-	}
-	file, err = os.Open(jpegPath)
-	if err != nil {
-		utils.FileLog.Info("open file failed: , error: \n" + err.Error())
-		return
-	}
+		randStr = utils.GetRandStringNoSpecialChar(28)
+		fileName = randStr + ext
+		defer file.Close() //关闭上传文件
+
+		resourceUrl = ``
+		ossClient = NewOssClient()
+		if ossClient == nil {
+			utils.FileLog.Info("初始化OSS服务失败")
+			return
+		}
+		resourceUrl, err = ossClient.UploadFile(fileName, jpegPath, "")
+		if err != nil {
+			utils.FileLog.Info("文件上传失败, Err: \n" + err.Error())
+			return
+		}
+		defer func() {
+			_ = os.Remove(jpegPath)
+		}()
+
+		if reportType == 3 {
+			// 更新jpeg url
+			ob := new(smart_report.SmartReport)
+			ob.SmartReportId = reportId
+			ob.DetailImgUrl = resourceUrl
+			if err = ob.Update([]string{"DetailImgUrl"}); err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		} else if reportType == 2 {
+			err = models.ModifyEnglishReportImgUrl(reportId, resourceUrl)
+			if err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		} else if reportType == 1 {
+			err = models.ModifyReportImgUrl(reportId, resourceUrl)
+			if err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		}
+	}()
 
-	ext = path.Ext(file.Name())
+	// 移动端
+	go func() {
+		pdfPathMobile := `./static/` + reportCode + "_600.pdf"
+		jpegPathMobile := `./static/` + reportCode + "_600.jpg"
 
-	randStr = utils.GetRandStringNoSpecialChar(28)
-	fileName = randStr + ext
-	defer file.Close() //关闭上传文件
+		width := 600
+		err = ReportToPdf(width, reportUrl, pdfPathMobile)
+		if err != nil {
+			utils.FileLog.Info("ReportToPdf failed: , error: \n" + err.Error())
+			go alarm_msg.SendAlarmMsg("ReportToPdf failed:"+err.Error(), 3)
+		}
 
-	resourceUrl = ``
-	ossClient = NewOssClient()
-	if ossClient == nil {
-		utils.FileLog.Info("初始化OSS服务失败")
-		return
-	}
-	resourceUrl, err = ossClient.UploadFile(fileName, jpegPath, "")
-	if err != nil {
-		utils.FileLog.Info("文件上传失败, Err: \n" + err.Error())
-		return
-	}
-	defer func() {
-		_ = os.Remove(jpegPath)
-	}()
+		file, err := os.Open(pdfPathMobile)
+		if err != nil {
+			utils.FileLog.Info("Open failed: , error: \n" + err.Error())
+			go alarm_msg.SendAlarmMsg("Open failed:"+err.Error(), 3)
+			return
+		}
+
+		ext := path.Ext(file.Name())
 
-	if reportType == 3 {
-		// 更新jpeg url
-		ob := new(smart_report.SmartReport)
-		ob.SmartReportId = reportId
-		ob.DetailImgUrl = resourceUrl
-		if err = ob.Update([]string{"DetailImgUrl"}); err != nil {
-			utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+		randStr := utils.GetRandStringNoSpecialChar(28)
+		fileName := randStr + ext
+		defer file.Close() //关闭上传文件
+
+		resourceUrl := ``
+		ossClient := NewOssClient()
+		if ossClient == nil {
+			utils.FileLog.Info("初始化OSS服务失败")
 			return
 		}
-	} else if reportType == 2 {
-		err = models.ModifyEnglishReportImgUrl(reportId, resourceUrl)
+		resourceUrl, err = ossClient.UploadFile(fileName, pdfPathMobile, "")
 		if err != nil {
-			utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+			utils.FileLog.Info("文件上传失败, Err: \n" + err.Error())
+			go alarm_msg.SendAlarmMsg("文件上传失败:"+err.Error(), 3)
 			return
 		}
-	} else if reportType == 1 {
-		err = models.ModifyReportImgUrl(reportId, resourceUrl)
+		defer func() {
+			_ = os.Remove(pdfPathMobile)
+		}()
+
+		if reportType == 3 {
+			// 更新pdf url
+			ob := new(smart_report.SmartReport)
+			ob.SmartReportId = reportId
+			ob.DetailPdfUrlMobile = resourceUrl
+			if err = ob.Update([]string{"DetailPdfUrlMobile"}); err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		} else if reportType == 2 {
+			err = models.ModifyEnglishReportPdfUrlMobile(reportId, resourceUrl)
+			if err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		} else if reportType == 1 {
+			err = models.ModifyReportPdfUrlMobile(reportId, resourceUrl)
+			if err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		}
+
+		time.Sleep(1 * time.Minute)
+
+		err = ReportToJpeg(width, reportUrl, jpegPathMobile)
+		if err != nil {
+			utils.FileLog.Info("ReportToJpeg failed: , error: \n" + err.Error())
+		}
+		file, err = os.Open(jpegPathMobile)
 		if err != nil {
-			utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+			utils.FileLog.Info("open file failed: , error: \n" + err.Error())
 			return
 		}
-	}
+
+		ext = path.Ext(file.Name())
+
+		randStr = utils.GetRandStringNoSpecialChar(28)
+		fileName = randStr + ext
+		defer file.Close() //关闭上传文件
+
+		resourceUrl = ``
+		ossClient = NewOssClient()
+		if ossClient == nil {
+			utils.FileLog.Info("初始化OSS服务失败")
+			return
+		}
+		resourceUrl, err = ossClient.UploadFile(fileName, jpegPathMobile, "")
+		if err != nil {
+			utils.FileLog.Info("文件上传失败, Err: \n" + err.Error())
+			return
+		}
+		defer func() {
+			_ = os.Remove(jpegPathMobile)
+		}()
+
+		if reportType == 3 {
+			// 更新jpeg url
+			ob := new(smart_report.SmartReport)
+			ob.SmartReportId = reportId
+			ob.DetailImgUrlMobile = resourceUrl
+			if err = ob.Update([]string{"DetailImgUrlMobile"}); err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		} else if reportType == 2 {
+			err = models.ModifyEnglishReportImgUrlMobile(reportId, resourceUrl)
+			if err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		} else if reportType == 1 {
+			err = models.ModifyReportImgUrlMobile(reportId, resourceUrl)
+			if err != nil {
+				utils.FileLog.Info("更新研报失败, Err: \n" + err.Error())
+				return
+			}
+		}
+	}()
 }