Jelajahi Sumber

fix:修复研报添加版头,然后在版图素材库中删掉该版头,提示操作失败,并清空了研报内容

Roc 2 bulan lalu
induk
melakukan
ecaaa533a4
2 mengubah file dengan 4 tambahan dan 4 penghapusan
  1. 2 2
      controllers/report_v2.go
  2. 2 2
      controllers/smart_report/smart_report.go

+ 2 - 2
controllers/report_v2.go

@@ -686,7 +686,7 @@ func (this *ReportController) Detail() {
 			br.ErrMsg = "获取资源库版头失败, Err: " + err.Error()
 			return
 		}
-		if headResource.ResourceId > 0 {
+		if headResource != nil && headResource.ResourceId > 0 {
 			item.HeadImg = headResource.ImgUrl
 			item.HeadStyle = headResource.Style
 		}
@@ -699,7 +699,7 @@ func (this *ReportController) Detail() {
 			br.ErrMsg = "获取资源库版尾失败, Err: " + err.Error()
 			return
 		}
-		if endResource.ResourceId > 0 {
+		if endResource != nil && endResource.ResourceId > 0 {
 			item.EndImg = endResource.ImgUrl
 			item.EndStyle = endResource.Style
 		}

+ 2 - 2
controllers/smart_report/smart_report.go

@@ -396,7 +396,7 @@ func (this *SmartReportController) Detail() {
 			br.ErrMsg = "获取资源库版尾失败, Err: " + err.Error()
 			return
 		}
-		if headResource.ResourceId > 0 {
+		if headResource != nil && headResource.ResourceId > 0 {
 			resp.HeadImg = headResource.ImgUrl
 			resp.HeadStyle = headResource.Style
 		}
@@ -409,7 +409,7 @@ func (this *SmartReportController) Detail() {
 			br.ErrMsg = "获取资源库版头失败, Err: " + err.Error()
 			return
 		}
-		if endResource.ResourceId > 0 {
+		if endResource != nil && endResource.ResourceId > 0 {
 			resp.EndImg = endResource.ImgUrl
 			resp.EndStyle = endResource.Style
 		}