Răsfoiți Sursa

英文研报详情显示分类

xyxie 1 an în urmă
părinte
comite
79c13ac750
2 a modificat fișierele cu 19 adăugiri și 0 ștergeri
  1. 17 0
      controllers/english_report/report.go
  2. 2 0
      models/english_report.go

+ 17 - 0
controllers/english_report/report.go

@@ -267,6 +267,23 @@ func (this *EnglishReportController) Detail() {
 	}
 	item.Content = html.UnescapeString(item.Content)
 	item.ContentSub = html.UnescapeString(item.ContentSub)
+	classifyNameMap := make(map[int]*models.EnglishClassifyFullName)
+	if item.ClassifyIdSecond > 0 {
+		nameList, tErr := models.GetEnglishClassifyFullNameByIds([]int{item.ClassifyIdSecond})
+		if tErr != nil {
+			br.Msg = "获取分类名称失败"
+			br.ErrMsg = "获取分类名称失败, ERR:" + tErr.Error()
+			return
+		}
+		for _, v := range nameList {
+			classifyNameMap[v.Id] = v
+		}
+		//处理分类名
+		if n, ok := classifyNameMap[item.ClassifyIdSecond]; ok {
+			item.ClassifyNameRoot = n.RootName
+			item.ClassifyIdRoot = n.RootId
+		}
+	}
 
 	// 获取邮件配置-是否有权限群发
 	conf := new(models.EnglishReportEmailConf)

+ 2 - 0
models/english_report.go

@@ -211,6 +211,8 @@ type EnglishReportDetail struct {
 	EmailState         int    `description:"群发邮件状态: 0-未发送; 1-已发送"`
 	EmailAuth          bool   `description:"是否有权限群发邮件"`
 	EmailHasFail       bool   `description:"是否存在邮件发送失败的记录"`
+	ClassifyIdRoot     int    `description:"顶级分类id"`
+	ClassifyNameRoot   string `description:"顶级分类名称"`
 }
 
 func GetEnglishReportById(reportId int) (item *EnglishReportDetail, err error) {