2 Komitmen e71bf453dc ... 222900d5d2

Pembuat SHA1 Pesan Tanggal
  zhangchuanxing 222900d5d2 Merge branch 'cygx_14.2' of http://8.136.199.33:3000/hongze/hongze_clpt into debug 1 hari lalu
  zhangchuanxing c0ed50da62 no message 1 hari lalu
2 mengubah file dengan 41 tambahan dan 4 penghapusan
  1. 4 4
      controllers/report.go
  2. 37 0
      services/industrial_management.go

+ 4 - 4
controllers/report.go

@@ -1151,16 +1151,16 @@ func (this *MobileReportController) SearchResource() {
 	//	}
 	//}
 	if len(listHz) > 0 {
-		listHz, err = services.HandleIndustryList(listHz, user, "Hz")
+		listHz, err = services.HandleIndustryListHzAndYx(listHz, user, "Hz")
 		if err != nil {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取信息失败,Err:" + err.Error()
 			return
 		}
 	}
-	if keyWord != "" {
-		//go services.AddUserSearchLog(user, keyWord, 4)
-	}
+	//if keyWord != "" {
+	//go services.AddUserSearchLog(user, keyWord, 4)
+	//}
 	resp := new(models.SearchResourceResp)
 	if len(listHz) == 0 {
 		listHz = make([]*models.IndustrialManagement, 0)

+ 37 - 0
services/industrial_management.go

@@ -333,6 +333,43 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 	return
 }
 
+func HandleIndustryListHzAndYx(list []*models.IndustrialManagement, user *models.WxUserItem, resource string) (items []*models.IndustrialManagement, err error) {
+	var listHz []*models.IndustrialManagement
+	var lisYx []*models.IndustrialManagement
+	for _, v := range list {
+		if v.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
+			lisYx = append(lisYx, v)
+		} else {
+			listHz = append(listHz, v)
+		}
+	}
+	listHz, err = HandleIndustryList(listHz, user, "Hz")
+	if err != nil {
+		return
+	}
+	lisYx, err = HandleIndustryList(lisYx, user, "Yx")
+	if err != nil {
+		return
+	}
+	maplistHz := make(map[int]*models.IndustrialManagement)
+	maplistYx := make(map[int]*models.IndustrialManagement)
+	for _, v := range listHz {
+		maplistHz[v.IndustrialManagementId] = v
+	}
+	for _, v := range lisYx {
+		maplistYx[v.IndustrialManagementId] = v
+	}
+	for _, v := range list {
+		if maplistHz[v.IndustrialManagementId] != nil {
+			items = append(items, maplistHz[v.IndustrialManagementId])
+		}
+		if maplistYx[v.IndustrialManagementId] != nil {
+			items = append(items, maplistYx[v.IndustrialManagementId])
+		}
+	}
+	return
+}
+
 // 通过文章ID获取文章所关联的产业
 func GetArticleIndustrialByArticleId(articleIds []int) (itemMap map[int][]*models.IndustrialManagementResp, err error) {
 	lenarticleIds := len(articleIds)