2 커밋 4a68e85112 ... e71bf453dc

작성자 SHA1 메시지 날짜
  zhangchuanxing e71bf453dc Merge branch 'cygx_14.2' of http://8.136.199.33:3000/hongze/hongze_clpt into debug 1 일 전
  zhangchuanxing 463ca9b48a no message 1 일 전
6개의 변경된 파일66개의 추가작업 그리고 35개의 파일을 삭제
  1. 31 31
      controllers/report.go
  2. 1 0
      controllers/search.go
  3. 8 0
      models/activity.go
  4. 1 1
      models/resource_data.go
  5. 10 2
      services/es_comprehensive.go
  6. 15 1
      services/industrial_management.go

+ 31 - 31
controllers/report.go

@@ -1114,19 +1114,19 @@ func (this *MobileReportController) SearchResource() {
 	keyWord := this.GetString("KeyWord")
 	var condition string
 
-	articleTypeIds, err := services.GetYanXuanArticleTypeIds()
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
-		return
-	}
-	if articleTypeIds == "" {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "研选分类ID不能为空"
-		return
-	}
+	//articleTypeIds, err := services.GetYanXuanArticleTypeIds()
+	//if err != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
+	//	return
+	//}
+	//if articleTypeIds == "" {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "研选分类ID不能为空"
+	//	return
+	//}
 
-	condition = `  AND a.publish_status = 1 AND a.article_type_id NOT IN (` + articleTypeIds + `)  AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%'  )  `
+	condition = `  AND a.publish_status = 1  AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%'  )  `
 	listHz, err := models.GetSearchResourceList(condition)
 	if err != nil {
 		br.Msg = "获取信息失败"
@@ -1134,22 +1134,22 @@ func (this *MobileReportController) SearchResource() {
 		return
 	}
 
-	condition = `  AND a.publish_status = 1 AND a.article_type_id IN (` + articleTypeIds + `)  AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%'  )  `
-	listYx, err := models.GetSearchResourceList(condition)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
-		return
-	}
+	//condition = `  AND a.publish_status = 1 AND a.article_type_id IN (` + articleTypeIds + `)  AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%'  )  `
+	//listYx, err := models.GetSearchResourceList(condition)
+	//if err != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+	//	return
+	//}
 
-	if len(listYx) > 0 {
-		listYx, err = services.HandleIndustryList(listYx, user, "Yx")
-		if err != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取信息失败,Err:" + err.Error()
-			return
-		}
-	}
+	//if len(listYx) > 0 {
+	//	listYx, err = services.HandleIndustryList(listYx, user, "Yx")
+	//	if err != nil {
+	//		br.Msg = "获取信息失败"
+	//		br.ErrMsg = "获取信息失败,Err:" + err.Error()
+	//		return
+	//	}
+	//}
 	if len(listHz) > 0 {
 		listHz, err = services.HandleIndustryList(listHz, user, "Hz")
 		if err != nil {
@@ -1165,11 +1165,11 @@ func (this *MobileReportController) SearchResource() {
 	if len(listHz) == 0 {
 		listHz = make([]*models.IndustrialManagement, 0)
 	}
-	if len(listYx) == 0 {
-		listYx = make([]*models.IndustrialManagement, 0)
-	}
+	//if len(listYx) == 0 {
+	//	listYx = make([]*models.IndustrialManagement, 0)
+	//}
 	resp.ListHz = listHz
-	resp.ListYx = listYx
+	resp.ListYx = make([]*models.IndustrialManagement, 0)
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 1 - 0
controllers/search.go

@@ -396,6 +396,7 @@ func (this *MobileSearchController) ComprehensiveList() {
 		br.ErrMsg = "检索失败,Err:" + err.Error()
 		return
 	}
+	fmt.Println("tmpTotalResult", tmpTotalResult)
 
 	list, err := services.GetResourceDataEsList(tmpResult, user)
 	if err != nil {

+ 8 - 0
models/activity.go

@@ -647,3 +647,11 @@ func GetActivityListByCondition(condition string, pars []interface{}) (items []*
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
+
+// 获取所有未开始、进行中的活动ID
+func GetActivityIdListNoEnd() (items []*CygxActivity, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT activity_id  FROM cygx_activity WHERE  active_state IN (1,2) `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 1 - 1
models/resource_data.go

@@ -134,7 +134,7 @@ func GetResourceDataListCondition(condition string, pars []interface{}, startSiz
 	if condition != "" {
 		sql += condition
 	}
-	sql += `  ORDER BY search_order_time DESC   LIMIT ?,? `
+	sql += `  ORDER BY  sort DESC , search_order_time DESC   LIMIT ?,? `
 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
 	return
 }

+ 10 - 2
services/es_comprehensive.go

@@ -857,10 +857,18 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 }
 
 func SqlComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*SearchComprehensiveItem, total int, err error) {
+	listListNoEnd, e := models.GetActivityIdListNoEnd()
+	var activityIds []string
+	for _, v := range listListNoEnd {
+		activityIds = append(activityIds, strconv.Itoa(v.ActivityId))
+	}
+	activityIds = append(activityIds, "0")
+
+	conditionActivity := " AND IF   ( source IN('activity') , source_id IN (" + strings.Join(activityIds, ",") + ") != 31 ,1=1 )"
 	keyWord = "%" + keyWord + "%"
 	var conditionTitle string
 	var parsTitle []interface{}
-	conditionTitle = " AND  is_hide = 0  AND search_title LIKE ? AND IF   ( source IN('activityvoice','activityvideo') , chart_permission_id != 31 ,1=1 ) "
+	conditionTitle = " AND  is_hide = 0  AND search_title LIKE ? AND IF   ( source IN('activityvoice','activityvideo') , chart_permission_id != 31 ,1=1 ) " + conditionActivity
 	parsTitle = append(parsTitle, keyWord)
 	totalTitle, e := models.GetResourceDataCount(conditionTitle, parsTitle)
 	if e != nil {
@@ -871,7 +879,7 @@ func SqlComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*
 	var conditionContent string
 	var parsContent []interface{}
 
-	conditionContent = " AND  is_hide = 0  AND search_content LIKE ? AND search_title  NOT LIKE ?   AND IF   ( source IN('activityvoice','activityvideo') , chart_permission_id != 31 ,1=1 )   "
+	conditionContent = " AND  is_hide = 0  AND search_content LIKE ? AND search_title  NOT LIKE ?   AND IF   ( source IN('activityvoice','activityvideo') , chart_permission_id != 31 ,1=1 )   " + conditionActivity
 	parsContent = append(parsContent, keyWord, keyWord)
 	totalContent, e := models.GetResourceDataCount(conditionContent, parsContent)
 	if e != nil {

+ 15 - 1
services/industrial_management.go

@@ -314,6 +314,20 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 				list[k].IsNew = true
 			}
 		}
+		if v.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
+			v.Source = 1
+		} else {
+			v.Source = 2
+		}
+
+		if v.TimeLineData == "" {
+			v.ListTimeLine = make([]models.TimeLineReportResp, 0)
+		} else {
+			if err = json.Unmarshal([]byte(v.TimeLineData), &v.ListTimeLine); err != nil {
+				e = errors.New("Unmarshal, Err: " + e.Error())
+				return
+			}
+		}
 	}
 	items = list
 	return
@@ -449,7 +463,7 @@ func GetCygxIndustryFllowListTypeMapByMobile(mobile string) (mapFollowTypeResp m
 }
 
 //func init() {
-//	IndustrialManagementTimeLineDateList3(78)
+//	IndustrialManagementTimeLineDateList3(542)
 //}
 
 // 时间线关联文章的三条数据