ziwen 1 an în urmă
părinte
comite
6f42c932ed
2 a modificat fișierele cu 21 adăugiri și 3 ștergeri
  1. 18 2
      controllers/yanxuan_special.go
  2. 3 1
      models/cygx_yanxuan_special.go

+ 18 - 2
controllers/yanxuan_special.go

@@ -155,6 +155,17 @@ func (this *YanxuanSpecialController) Detail() {
 		item.IsCollect = 1
 	}
 
+	industryTagList, tmpErr := models.GetYanxuanSpecialIndustry("")
+	if tmpErr != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
+		return
+	}
+	industryTagMap := make(map[string]int, 0)
+	for _, v := range industryTagList {
+		industryTagMap[v] = 1
+	}
+
 	var resp models.CygxYanxuanSpecialResp
 	resp.CygxYanxuanSpecialItem = *item
 	if item.DocUrl != "" {
@@ -178,10 +189,15 @@ func (this *YanxuanSpecialController) Detail() {
 	if item.Tags != "" {
 		tagList := strings.Split(item.Tags, ",")
 		for _, s := range tagList {
-			resp.TagList = append(resp.TagList, s)
+			if _,ok := industryTagMap[s]; ok{
+				resp.IndustryTags = append(resp.IndustryTags, s)
+			} else {
+				resp.CompanyTags = append(resp.CompanyTags, s)
+			}
 		}
 	} else {
-		resp.TagList = []string{}
+		resp.IndustryTags = []string{}
+		resp.CompanyTags = []string{}
 	}
 
 	go services.AddSpecialRecord(this.User, specialId)

+ 3 - 1
models/cygx_yanxuan_special.go

@@ -55,7 +55,9 @@ type CygxYanxuanSpecialItem struct {
 
 type CygxYanxuanSpecialResp struct {
 	CygxYanxuanSpecialItem
-	Docs []Doc
+	Docs         []Doc
+	CompanyTags  []string
+	IndustryTags []string
 }
 
 type Doc struct {