فهرست منبع

fix:版头版尾

Roc 8 ماه پیش
والد
کامیت
d40d2b426d
2فایلهای تغییر یافته به همراه24 افزوده شده و 0 حذف شده
  1. 22 0
      controllers/report_share.go
  2. 2 0
      models/report.go

+ 22 - 0
controllers/report_share.go

@@ -39,6 +39,28 @@ func (this *ReportShareController) Detail() {
 	report.Content = html.UnescapeString(report.Content)
 	report.ContentStruct = html.UnescapeString(report.ContentStruct)
 
+	if report.HeadResourceId > 0 {
+		headResource, err := models.GetResourceItemById(report.HeadResourceId)
+		if err != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "获取资源库版头失败, Err: " + err.Error()
+			return
+		}
+		report.HeadImg = headResource.ImgUrl
+		report.HeadStyle = headResource.Style
+	}
+
+	if report.EndResourceId > 0 {
+		endResource, err := models.GetResourceItemById(report.EndResourceId)
+		if err != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "获取资源库版头失败, Err: " + err.Error()
+			return
+		}
+		report.EndImg = endResource.ImgUrl
+		report.EndStyle = endResource.Style
+	}
+
 	resp := new(models.ReportShareDetailResp)
 	// 免责声明
 	conf, e := models.GetBusinessConf()

+ 2 - 0
models/report.go

@@ -42,6 +42,8 @@ type Report struct {
 	Uv                  int       `description:"uv"`
 	HeadImg             string    `description:"报告头图地址"`
 	EndImg              string    `description:"报告尾图地址"`
+	HeadStyle           string    `description:"版头样式"`
+	EndStyle            string    `description:"版尾样式"`
 	CanvasColor         string    `description:"画布颜色"`
 	NeedSplice          int       `description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"`
 	HeadResourceId      int       `description:"版头资源ID"`