rdluck 4 years ago
parent
commit
e37dc5f1d4
4 changed files with 77 additions and 80 deletions
  1. 1 0
      controllers/article.go
  2. 1 1
      controllers/search.go
  3. 12 12
      models/article_interview_apply.go
  4. 63 67
      services/task.go

+ 1 - 0
controllers/article.go

@@ -371,6 +371,7 @@ func (this *ArticleCommonController) Detail() {
 	} else {
 		resp.HasPermission = 1
 	}
+	detail.Body=html.UnescapeString(detail.Body)
 	resp.Detail = detail
 	br.Ret = 200
 	br.Success = true

+ 1 - 1
controllers/search.go

@@ -47,7 +47,7 @@ func (this *SearchController) SearchList() {
 		}
 		categoryName := strings.Join(categoryNameArr, ",")
 	*/
-	indexName := "article"
+	indexName := "article_list"
 	result, err := services.EsMatchQuery(indexName, keyWord)
 	//indexName := "article_list"
 	//result, err := services.EsMatchPhraseQuery(indexName, keyWord)

+ 12 - 12
models/article_interview_apply.go

@@ -64,17 +64,17 @@ type ArticleInterviewApplyList struct {
 	ArticleId        int
 	UserId           int
 	CreateTime       string
-	Title            string    `description:"标题"`
-	TitleEn          string    `description:"英文标题 "`
-	UpdateFrequency  string    `description:"更新周期"`
-	CreateDate       string    `description:"创建时间"`
-	PublishDate      string    `description:"发布时间"`
-	Body             string    `description:"内容"`
-	Abstract         string    `description:"摘要"`
-	CategoryName     string    `description:"一级分类"`
-	SubCategoryName  string    `description:"二级分类"`
-	Status           string    `description:"'待邀请','待访谈','已完成','已取消'"`
+	Title            string `description:"标题"`
+	TitleEn          string `description:"英文标题 "`
+	UpdateFrequency  string `description:"更新周期"`
+	CreateDate       string `description:"创建时间"`
+	PublishDate      string `description:"发布时间"`
+	Body             string `description:"内容"`
+	Abstract         string `description:"摘要"`
+	CategoryName     string `description:"一级分类"`
+	SubCategoryName  string `description:"二级分类"`
+	Status           string `description:"'待邀请','待访谈','已完成','已取消'"`
 	InterviewTime    string `description:"访谈时间"`
-	ExpertBackground string    `description:"专家背景"`
-	ExpertNumber     string    `description:"专家编号"`
+	ExpertBackground string `description:"专家背景"`
+	ExpertNumber     string `description:"专家编号"`
 }

+ 63 - 67
services/task.go

@@ -24,75 +24,74 @@ func Task() {
 
 	//修复报告内容
 	//GetArticleAll()
-
 	//indexName := "article_list"
 	//		mappingJson := `{
 	//"mappings": {
-	//  "dynamic": true,
-	//  "properties": {
-	//    "ArticleId": {
-	//      "type": "integer"
-	//    },
-	//    "Title": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "TitleEn": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "UpdateFrequency": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "CreateDate": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "PublishDate": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "Abstract": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "CategoryName": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "SubCategoryName": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "InterviewDate": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "ExpertBackground": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "ExpertNumber": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "Department": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "BodyText": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    },
-	//    "ArticleIdMd5": {
-	//      "type": "text",
-	//      "analyzer": "ik_smart"
-	//    }
-	//  }
+	// "dynamic": true,
+	// "properties": {
+	//   "ArticleId": {
+	//     "type": "integer"
+	//   },
+	//   "Title": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "TitleEn": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "UpdateFrequency": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "CreateDate": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "PublishDate": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "Abstract": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "CategoryName": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "SubCategoryName": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "InterviewDate": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "ExpertBackground": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "ExpertNumber": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "Department": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "BodyText": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   },
+	//   "ArticleIdMd5": {
+	//     "type": "text",
+	//     "analyzer": "ik_smart"
+	//   }
+	// }
 	//}
 	//}`
-	// EsCreateIndex(indexName,mappingJson)
+	//EsCreateIndex(indexName,mappingJson)
 
 	//插入数据
 	//allList, err := models.GetArticleAll()
@@ -142,9 +141,6 @@ func Task() {
 	////bm.Put(key,1,1*time.Second)
 	//b:=bm.IsExist(key)
 	//fmt.Println(b)
-	indexName := "article_list"
-	keyWord:=`康立明`
-	EsV7Search(indexName,keyWord)
 	fmt.Println("end")
 }