zwxi il y a 10 mois
Parent
commit
ff03764ffd
3 fichiers modifiés avec 23 ajouts et 4 suppressions
  1. 11 0
      models/smart_report/smart_report.go
  2. 4 4
      services/smart_report.go
  3. 8 0
      utils/config.go

+ 11 - 0
models/smart_report/smart_report.go

@@ -58,6 +58,9 @@ type SmartReport struct {
 	CanvasColor         string    `description:"画布颜色"`
 	ApproveTime         time.Time `description:"审批时间"`
 	ApproveId           int       `description:"审批ID"`
+	NeedSplice          int       `description:"0-不需要 1-需要"`
+	HeadResourceId      int       `description:"版头资源ID"`
+	EndResourceId       int       `description:"版尾资源ID"`
 }
 
 func (m *SmartReport) TableName() string {
@@ -216,6 +219,11 @@ type SmartReportItem struct {
 	HeadImg             string  `description:"报告头图地址"`
 	EndImg              string  `description:"报告尾图地址"`
 	CanvasColor         string  `description:"画布颜色"`
+	NeedSplice          int     `description:"0-不需要 1-需要"`
+	HeadResourceId      int       `description:"版头资源ID"`
+	EndResourceId       int       `description:"版尾资源ID"`
+	HeadStyle           string    `description:"版头样式"`
+	EndStyle            string    `description:"版尾样式"`
 }
 
 // FormatSmartReport2Item 格式化智能研报数据格式
@@ -263,6 +271,9 @@ func FormatSmartReport2Item(origin *SmartReport) (item *SmartReportItem) {
 	item.EndImg = origin.EndImg
 	item.CanvasColor = origin.CanvasColor
 	item.ApproveTime = utils.TimeTransferString(utils.FormatDateTime, origin.ApproveTime)
+	item.NeedSplice = origin.NeedSplice
+	item.HeadResourceId = origin.HeadResourceId
+	item.EndResourceId = origin.EndResourceId
 	return
 }
 

+ 4 - 4
services/smart_report.go

@@ -138,7 +138,7 @@ from pyppeteer import launch
 async def main():
     
     browser = await launch({
-        'executablePath': '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
+        'executablePath': '%s',
         'headless': True
     })
     page = await browser.newPage()
@@ -173,7 +173,7 @@ async def main():
 asyncio.run(main())
 `
 
-	pyCode = fmt.Sprintf(pyCode, reportUrl, filePath)
+	pyCode = fmt.Sprintf(pyCode, utils.ChromeDrivePath, reportUrl, filePath)
 
 	cmd := exec.Command("python3", "-c", pyCode)
 	_, err = cmd.CombinedOutput()
@@ -191,7 +191,7 @@ from pyppeteer import launch
 async def main():
     
     browser = await launch({
-        'executablePath': '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
+        'executablePath': '%s',
         'headless': True
     })
     page = await browser.newPage()
@@ -217,7 +217,7 @@ async def main():
 asyncio.run(main())
 `
 
-	pyCode = fmt.Sprintf(pyCode, reportUrl, filePath)
+	pyCode = fmt.Sprintf(pyCode, utils.ChromeDrivePath, reportUrl, filePath)
 
 	cmd := exec.Command("python3", "-c", pyCode)
 

+ 8 - 0
utils/config.go

@@ -236,6 +236,11 @@ var (
 	S3OpenAcl         string
 )
 
+// chrome配置
+var (
+	ChromeDrivePath       string // chrome浏览器地址
+)
+
 func init() {
 	tmpRunMode, err := web.AppConfig.String("run_mode")
 	if err != nil {
@@ -539,6 +544,9 @@ func init() {
 	EtaAppid = config["eta_appid"]
 	EtaSecret = config["eta_secret"]
 
+	// chrome配置
+	ChromeDrivePath = config["chrome_drive_path"]
+
 	// 初始化ES
 	initEs()
 }