Browse Source

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into cygx_9.6

xingzai 2 years ago
parent
commit
5d6cbd471e

+ 55 - 21
controllers/activity.go

@@ -12,7 +12,6 @@ import (
 	"strconv"
 	"strings"
 	"time"
-	"unicode/utf8"
 )
 
 // 活动
@@ -638,6 +637,7 @@ func (this *ActivityCoAntroller) ScheduleList() {
 // @Title  活动详情
 // @Description 获取活动详情接口
 // @Param   ActivityId   query   int  true       "活动ID"
+// @Param   IsSendWx   query   int  false       "是否是通过微信模版进来的 1是,其它否"
 // @Success Ret=200 {object} models.CygxActivityResp
 // @router /detail [get]
 func (this *ActivityCoAntroller) Detail() {
@@ -655,6 +655,7 @@ func (this *ActivityCoAntroller) Detail() {
 	}
 	uid := user.UserId
 	activityId, _ := this.GetInt("ActivityId")
+	isSendWx, _ := this.GetInt("IsSendWx")
 	if activityId < 1 {
 		br.Msg = "请输入活动ID"
 		return
@@ -926,23 +927,23 @@ func (this *ActivityCoAntroller) Detail() {
 		if activityInfo.IsHideAppointment == 0 {
 			activityInfo.IsShowAppointment = services.IsShowAppointment(activityInfo.ActivityTypeId, activityInfo.ChartPermissionName)
 		}
-		if activityInfo.ReportLink != "" {
-			artList := strings.Split(activityInfo.ReportLink, "{|}")
-			if len(artList) > 0 {
-				for _, v := range artList {
-					artitem := new(models.ActivityArticleResp)
-					artitem.ReportLink = v
-					artIdSlice := strings.Split(v, "/")
-					if len(artIdSlice) > 0 {
-						articleId, _ := strconv.Atoi(artIdSlice[len(artIdSlice)-1])
-						artitem.ArticleId = articleId
-					}
-					activityInfo.ArticleList = append(activityInfo.ArticleList, artitem)
-				}
-			}
-		} else {
-			activityInfo.ArticleList = make([]*models.ActivityArticleResp, 0)
-		}
+		//if activityInfo.ReportLink != "" {
+		//	artList := strings.Split(activityInfo.ReportLink, "{|}")
+		//	if len(artList) > 0 {
+		//		for _, v := range artList {
+		//			artitem := new(models.ActivityArticleResp)
+		//			artitem.ReportLink = v
+		//			artIdSlice := strings.Split(v, "/")
+		//			if len(artIdSlice) > 0 {
+		//				articleId, _ := strconv.Atoi(artIdSlice[len(artIdSlice)-1])
+		//				artitem.ArticleId = articleId
+		//			}
+		//			activityInfo.ArticleList = append(activityInfo.ArticleList, artitem)
+		//		}
+		//	}
+		//} else {
+		//	activityInfo.ArticleList = make([]*models.ActivityArticleResp, 0)
+		//}
 		activityInfo.ActivityTypeName = strings.Replace(activityInfo.ActivityTypeName, "(C类)", "", -1)
 
 		//处理活动关联的产业
@@ -1060,6 +1061,32 @@ func (this *ActivityCoAntroller) Detail() {
 			return
 		}
 		activityInfo.SignupType = mapActivitySignup[activityId]
+		//判断是不是通过微信模版推送消息进来的
+		if isSendWx == 1 && len(industrialList) > 0 {
+			industryUserFollowMap, err := services.GetIndustryUserFollowMap(user)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
+				return
+			}
+			for _, v := range industrialList {
+				if industryUserFollowMap[v.IndustrialManagementId] {
+					activityInfo.IsFollowButton = true
+				}
+			}
+			activityInfo.IsShowFollowButton = true
+		}
+		if activityInfo.ReportLink != "" {
+			artList, err := services.GetActivityReportLinkToArticleList(activityInfo)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "解析文章关联的报告内容失败:" + activityInfo.ReportLink
+				return
+			}
+			activityInfo.ArticleList = artList
+		} else {
+			activityInfo.ArticleList = make([]*models.ActivityArticleResp, 0)
+		}
 		//处理按钮是否展示问题
 		resp.Detail = services.ActivityButtonShow(activityInfo)
 	}
@@ -3142,6 +3169,12 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 	//}
 	//isMaker := user.IsMaker
 
+	mapCity, err := services.GetActivityCityResp()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
 	//var sqlExport string
 	resp := new(models.ActivityTypeListHomeResp)
 	for k, v := range list {
@@ -3172,9 +3205,10 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 			if v2.YidongActivityId != 0 {
 				v2.IsExternalLabel = true
 			}
-			if utf8.RuneCountInString(v2.City) != 2 {
-				labelList[k2].City = ""
-			}
+			labelList[k2].City = mapCity[fmt.Sprint(v2.KeyWord, "{|}", v.ActivityTypeId)]
+			//if utf8.RuneCountInString(v2.City) != 2 {
+			//	labelList[k2].City = ""
+			//}
 			labelList[k2].KeyWord = services.LabelStrV5(v2.KeyWord, v2.IsShowSubjectName, v2.TemporaryLabel)
 			labelList[k2].ImgUrlBg = v.ImgUrlBgs
 			if _, ok := mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", labelList[k2].KeyWord)]; ok {

+ 30 - 0
controllers/article.go

@@ -40,6 +40,7 @@ type ArticleControllerMobile struct {
 // @Title 获取报告详情
 // @Description 获取报告详情接口
 // @Param   ArticleId   query   int  true       "报告ID"
+// @Param   IsSendWx   query   int  false       "是否是通过微信模版进来的 1是,其它否"
 // @Success 200 {object} models.ArticleDetailResp
 // @router /detail [get]
 func (this *ArticleController) Detail() {
@@ -58,6 +59,7 @@ func (this *ArticleController) Detail() {
 
 	uid := user.UserId
 	articleId, err := this.GetInt("ArticleId")
+	isSendWx, _ := this.GetInt("IsSendWx")
 	if articleId <= 0 {
 		br.Msg = "文章不存在"
 		br.ErrMsg = "文章不存在,文章ID错误"
@@ -80,6 +82,34 @@ func (this *ArticleController) Detail() {
 		br.ErrMsg = "获取信息失败,Err:" + err.Error()
 		return
 	}
+	if isSendWx == 1 {
+		var condition string
+		var pars []interface{}
+		pars = make([]interface{}, 0)
+		condition = ` AND article_id  = ? `
+		pars = append(pars, articleId)
+		industrialList, err := models.GetIndustrialArticleGroupManagementList(condition, pars)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取信息失败,Err:" + err.Error()
+			return
+		}
+		if len(industrialList) > 0 {
+			industryUserFollowMap, err := services.GetIndustryUserFollowMap(user)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
+				return
+			}
+			for _, v := range industrialList {
+				fmt.Println(v.IndustrialManagementId)
+				if industryUserFollowMap[v.IndustrialManagementId] {
+					detail.IsFollowButton = true
+				}
+			}
+			detail.IsShowFollowButton = true
+		}
+	}
 	//是否属于专项调研报告
 	if detail.SubCategoryName == "专项调研" {
 		detail.IsSpecialArticle = true

+ 130 - 0
controllers/industry.go

@@ -0,0 +1,130 @@
+package controllers
+
+import (
+	"encoding/json"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"strconv"
+	"time"
+)
+
+// 报告
+type IndustryController struct {
+	BaseAuthController
+}
+
+// @Title 关注/取消关注产业
+// @Description 关注/取消关注 接口
+// @Param	request	body models.CygxIndustryFllowRep true "type json string"
+// @Success 200
+// @router /follow [post]
+func (this *IndustryController) Fllow() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	uid := user.UserId
+	var req models.IndustryFllowArryReq
+	resp := new(models.CygxIndustryFllowResp)
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	sourceId := req.SourceId
+	source := req.Source
+	doType := req.DoType
+	var status int
+	var condition string
+	var pars []interface{}
+	var industrialIds []int
+	if source == "article" {
+		pars = make([]interface{}, 0)
+		condition = ` AND article_id  = ? `
+		pars = append(pars, sourceId)
+		industrialList, err := models.GetIndustrialArticleGroupManagementList(condition, pars)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取信息失败,Err:" + err.Error()
+			return
+		}
+		if len(industrialList) > 0 {
+			for _, v := range industrialList {
+				industrialIds = append(industrialIds, v.IndustrialManagementId)
+			}
+		}
+	} else if source == "activity" {
+		//处理活动关联的产业
+		industrialList, err := models.GetIndustrialActivityGroupManagementList(sourceId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取活动关联的产业列表信息失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(sourceId)
+			return
+		}
+		if len(industrialList) > 0 {
+			for _, v := range industrialList {
+				industrialIds = append(industrialIds, v.IndustrialManagementId)
+			}
+		}
+	} else {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "资源类型有误:" + source
+		return
+	}
+	lenindustrialIds := len(industrialIds)
+	if lenindustrialIds == 0 {
+		br.Msg = "操作失败!"
+		br.ErrMsg = "对应的产业不存在:" + source + "ID:" + strconv.Itoa(sourceId)
+		return
+	}
+	//批量取关与关注
+	if doType == "add" {
+		status = 1
+		var industryFllowItems []*models.CygxIndustryFllow
+		for _, v := range industrialIds {
+			item := new(models.CygxIndustryFllow)
+			item.IndustrialManagementId = v
+			item.UserId = uid
+			item.Email = user.Email
+			item.Mobile = user.Mobile
+			item.RealName = user.RealName
+			item.CompanyId = user.CompanyId
+			item.CompanyName = user.CompanyName
+			item.Type = 1
+			item.CreateTime = time.Now()
+			item.ModifyTime = time.Now()
+			industryFllowItems = append(industryFllowItems, item)
+		}
+		err = models.AddCygxIndustryFllowMulti(industryFllowItems)
+	} else if doType == "cancel" {
+		status = 2
+		pars = make([]interface{}, 0)
+		condition = ` AND  industrial_management_id IN (` + utils.GetOrmInReplace(lenindustrialIds) + `)`
+		pars = append(pars, industrialIds)
+		err = models.RemoveCygxIndustryFllowArry(uid, condition, pars)
+	} else {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "操作方式有误:" + doType
+		return
+	}
+	if err != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "取消关注失败,Err:" + err.Error()
+		return
+	}
+	resp.Status = status
+	//处理是否关注全部赛道字段
+	//go services.IndustryFllowWithTrack(industrialManagementId, count, uid)
+	br.Msg = "操作成功"
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}

+ 62 - 18
controllers/report.go

@@ -258,6 +258,7 @@ func (this *ReportController) IndustryList() {
 // @Description 产业下所关联的文章分类列表接口
 // @Param   IndustrialManagementId   query   int  true       "产业ID"
 // @Param   ShowTimeLine   query   int  true       "是否展示时间线 0不展示,1展示"
+// @Param   IsSendWx   query   int  false       "是否是通过微信模版进来的 1是,其它否"
 // @Success 200 {object} models.IndustrialToArticleCategoryListRep
 // @router /toArticleCategoryList [get]
 func (this *ReportController) ArticleCategoryList() {
@@ -279,6 +280,7 @@ func (this *ReportController) ArticleCategoryList() {
 		return
 	}
 	showTimeLine, _ := this.GetInt("ShowTimeLine", 0)
+	isSendWx, _ := this.GetInt("IsSendWx")
 
 	detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
 	if err != nil {
@@ -440,7 +442,16 @@ func (this *ReportController) ArticleCategoryList() {
 	if videoSimple.Id > 0 {
 		resp.IndustryVideo = videoSimple
 	}
-
+	if isSendWx == 1 {
+		industryUserFollowMap, err := services.GetIndustryUserFollowMap(user)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
+			return
+		}
+		resp.IsFollowButton = industryUserFollowMap[industrialManagementId]
+		resp.IsShowFollowButton = true
+	}
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
@@ -2820,6 +2831,17 @@ func (this *ReportController) SearchReportAndResource() {
 	pageSize, _ := this.GetInt("PageSize")
 	var condition string
 	var sqlGroup 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
+	}
 	//匹配报告标题、
 	condition = `AND ( a.title LIKE '%` + keyWord + `%' OR  a.body LIKE '%` + keyWord + `%' OR  a.annotation LIKE '%` + keyWord + `%' OR  a.abstract LIKE '%` + keyWord + `%') AND a.publish_status = 1 `
 	sqlGroup = ` GROUP BY  a.article_id  ORDER BY a.publish_date DESC  `
@@ -2828,14 +2850,13 @@ func (this *ReportController) SearchReportAndResource() {
 	} else {
 		sqlGroup += ` LIMIT 100 `
 	}
-	ListYxReport, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+condition+sqlGroup, user.UserId)
+	ListYxReport, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+articleTypeIds+`) `+condition+sqlGroup, user.UserId)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取研选文章列表失败,Err:" + err.Error()
 		return
 	}
-
-	ListHzReport, err := models.GetReoprtSearchList(` AND a.article_type_id NOT IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+condition+sqlGroup, user.UserId)
+	ListHzReport, err := models.GetReoprtSearchList(` AND a.article_type_id NOT IN (`+articleTypeIds+`) `+condition+sqlGroup, user.UserId)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取弘则报告文章列表失败,Err:" + err.Error()
@@ -2861,8 +2882,9 @@ func (this *ReportController) SearchReportAndResource() {
 		} else {
 			sqlGroupIk += ` LIMIT 20 `
 		}
+		conditionIk += ` AND ( a.title NOT LIKE '%` + keyWord + `%' AND  a.body NOT LIKE '%` + keyWord + `%' AND  a.annotation NOT LIKE '%` + keyWord + `%' AND  a.abstract NOT LIKE '%` + keyWord + `%') `
 		//研选的联想词列表
-		ListYxReportIk, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+conditionIk+sqlGroupIk, user.UserId)
+		ListYxReportIk, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+articleTypeIds+`) `+conditionIk+sqlGroupIk, user.UserId)
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取研选IK文章列表失败,Err:" + err.Error()
@@ -2874,7 +2896,7 @@ func (this *ReportController) SearchReportAndResource() {
 			}
 		}
 		//弘则的联想词列表
-		ListHzReportIk, err := models.GetReoprtSearchList(`  AND a.article_type_id NOT IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+conditionIk+sqlGroupIk, user.UserId)
+		ListHzReportIk, err := models.GetReoprtSearchList(`  AND a.article_type_id NOT IN (`+articleTypeIds+`) `+conditionIk+sqlGroupIk, user.UserId)
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取研选IK文章列表失败,Err:" + err.Error()
@@ -2967,7 +2989,7 @@ func (this *ReportController) SearchReportAndResource() {
 		}
 	}
 
-	condition = `  AND a.publish_status = 1 AND a.article_type_id NOT IN (` + utils.YAN_XUAN_ARTICLE_TYPE_IDS + `)  AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%'  )  `
+	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 + `%'  )  `
 
 	listHzResource, err := models.GetSearchResourceList(user.UserId, condition, 0, pageSize)
 	if err != nil {
@@ -2976,8 +2998,14 @@ func (this *ReportController) SearchReportAndResource() {
 		return
 	}
 
-	condition = `  AND a.publish_status = 1 AND a.article_type_id IN (` + utils.YAN_XUAN_ARTICLE_TYPE_IDS + `)  AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%'  )  `
+	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 + `%'  )  `
 
+	hotMapindustrial, e := services.IndustrialManagementHotMapGropuPermission()
+	if e != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取hot标签失败,IndustrialManagementHotMapGropuPermission ,Err:" + err.Error()
+		return
+	}
 	listYxResource, err := models.GetSearchResourceList(user.UserId, condition, 0, pageSize)
 	if err != nil {
 		br.Msg = "获取信息失败"
@@ -2994,18 +3022,25 @@ func (this *ReportController) SearchReportAndResource() {
 	industrialIdArr := make([]int, 0)
 	nowTime := time.Now().Local()
 	threeMonBefore := nowTime.AddDate(0, -3, 0)
-	mapHot := make(map[string]int)
+	mapHot := make(map[int]bool)
 
-	hotCondition := ` ORDER BY sum_num DESC  `
-	listHot, err := models.GetThemeHeatList(user.UserId, hotCondition, 0, 3)
+	//if themeType == 2 {
+	mapHot, err = services.GetYanXuanIndustrialManagementIdHotMap(articleTypeIds)
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		br.ErrMsg = "GetYanXuanIndustrialManagementIdNewMap,Err:" + err.Error()
 		return
 	}
-	for _, v := range listHot {
-		industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
-		mapHot[v.IndustryName] = v.IndustrialManagementId
+
+	//conditionOrder := ` ORDER BY sum_num DESC  `
+	//listHot, err := models.GetThemeHeatList(user.UserId, condition, conditionOrder, 0, 3)
+	//if err != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+	//	return
+	//}
+	for k, _ := range mapHot {
+		industrialIdArr = append(industrialIdArr, k)
 	}
 	orderSrt := "man.recommended_index DESC,update_time DESC"
 	for k, v := range listHzResource {
@@ -3028,6 +3063,7 @@ func (this *ReportController) SearchReportAndResource() {
 		if fllowMap[v.IndustrialManagementId] > 0 {
 			listHzResource[k].IsFollw = true
 		}
+		v.IsHot = hotMapindustrial[v.IndustrialManagementId]
 		industrialIdSlice := make([]int, 0)
 		articleIdArr := make([]int, 0)
 		industrialIdSlice = append(industrialIdSlice, v.IndustrialManagementId)
@@ -3069,6 +3105,8 @@ func (this *ReportController) SearchReportAndResource() {
 		//	maptimelineUPdateTime := make(map[int]string)
 		listtimelinePublishdate, err := models.GetTimeLineReportIndustrialPublishdateList(industrialIdArr)
 		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "GetTimeLineReportIndustrialPublishdateList,Err:" + err.Error()
 			return
 		}
 		for _, v := range listtimelinePublishdate {
@@ -3097,6 +3135,11 @@ func (this *ReportController) SearchReportAndResource() {
 		}
 		industrialIds = strings.TrimRight(industrialIds, ",")
 		articleList, err := models.GetReportIndustrialReadNumList(user.UserId, industrialIds, user.CreatedTime)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "GetReportIndustrialReadNumList,Err:" + err.Error()
+			return
+		}
 		mapHistroyindustrialId := make(map[int]int)
 		for _, v := range articleList {
 			mapHistroyindustrialId[v.IndustrialManagementId] = v.Readnum
@@ -3109,6 +3152,8 @@ func (this *ReportController) SearchReportAndResource() {
 		//var morningMeetingTime string
 		recrodList, err := models.GetTimeLineRecordAllCount(user.UserId, time.Now().Format(utils.FormatDate))
 		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "GetTimeLineRecordAllCount,Err:" + err.Error()
 			return
 		}
 		var industrialManagementIdstr string
@@ -3189,13 +3234,12 @@ func (this *ReportController) SearchReportAndResource() {
 				listYxResource[k].IsNew = true
 			}
 		}
-		if mapHot[v.IndustryName] > 0 {
-			listYxResource[k].IsHot = true
-		}
+		listYxResource[k].IsHot = mapHot[v.IndustrialManagementId]
 		listYxResource[k].Source = 2
 		if fllowMap[v.IndustrialManagementId] > 0 {
 			listYxResource[k].IsFollw = true
 		}
+		v.IsHot = hotMapindustrial[v.IndustrialManagementId]
 		industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
 	}
 

+ 395 - 135
controllers/research.go

@@ -1,15 +1,17 @@
 package controllers
 
 import (
-	"errors"
+	"encoding/json"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
 	"strconv"
+	"strings"
 	"time"
 )
 
-//研选
+// 研选
 type ResearchController struct {
 	BaseAuthController
 }
@@ -31,12 +33,21 @@ func (this *ResearchController) NewList() {
 		br.Ret = 408
 		return
 	}
-	//chartPermissionId, _ := this.GetInt("ChartPermissionId")
-	//if chartPermissionId < 1 {
-	//	br.Msg = "请输入分类ID"
-	//	return
-	//}
-	list, err := models.GetIndustrialManagementNewList("")
+	articleTypeIds, err := services.GetYanXuanArticleTypeIds()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
+		return
+	}
+	if articleTypeIds == "" {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "研选分类ID不能为空"
+		return
+	}
+	var condition string
+	var conditionOrder string
+	condition = ` AND a.article_type_id IN (` + articleTypeIds + `)  `
+	list, err := models.GetIndustrialManagementNewList(condition)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
@@ -44,8 +55,8 @@ func (this *ResearchController) NewList() {
 	}
 	mapHot := make(map[string]int)
 
-	condition := ` ORDER BY sum_num DESC  `
-	listHot, err := models.GetThemeHeatList(user.UserId, condition, 0, 3)
+	conditionOrder = ` ORDER BY sum_num DESC  `
+	listHot, err := models.GetThemeHeatList(user.UserId, condition, conditionOrder, 0, 3)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
@@ -84,17 +95,33 @@ func (this *ResearchController) CollectionList() {
 		br.Ret = 408
 		return
 	}
-	//chartPermissionId, _ := this.GetInt("ChartPermissionId")
-	//if chartPermissionId < 1 {
-	//	br.Msg = "请输入分类ID"
-	//	return
-	//}
+
+	pageSize, _ := this.GetInt("PageSize", 15)
 	var condition string
-	condition = `   AND a.article_type_id > 0  AND publish_status = 1 GROUP BY a.article_id ORDER BY collect_num_order DESC, publish_date DESC LIMIT 15 `
-	list, err := models.GetArticleCollectionList(condition, user.UserId)
+	var pars []interface{}
+	articleTypeIds, err := services.GetYanXuanArticleTypeIds()
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
+		return
+	}
+	if articleTypeIds != "" {
+		condition = ` AND a.article_type_id IN (` + articleTypeIds + `)  `
+	} else {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "研选分类ID不能为空"
+		return
+	}
+	// 根据关注时间一个月前至昨日的增量数据排序
+	nowTime := time.Now().Local()
+	startTime := nowTime.AddDate(0, -1, 0)
+	endTime := nowTime.AddDate(0, 0, -1)
+	condition += ` AND ac.create_time BETWEEN ? AND ? `
+	pars = append(pars, startTime, endTime)
+	list, err := models.GetReportCollectionBillboardListYx(pageSize, pars, condition)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取报告阅读增量排行榜失败, Err:" + err.Error()
 		return
 	}
 	for k, v := range list {
@@ -102,6 +129,28 @@ func (this *ResearchController) CollectionList() {
 			list[k].IsCollect = true
 		}
 	}
+	var articleIds []int
+	for k, v := range list {
+		if v.MyCollectNum > 0 {
+			list[k].IsCollect = true
+		}
+		articleIds = append(articleIds, v.ArticleId)
+	}
+	//处理关联的产业
+	industrialMap, err := services.GetArticleIndustrialByArticleId(articleIds)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取关联的产业信息失败,GetArticleIndustrialByArticleId Err:" + err.Error()
+		return
+	}
+	for k, v := range list {
+		if len(industrialMap[v.ArticleId]) > 0 {
+			list[k].List = industrialMap[v.ArticleId]
+		} else {
+			list[k].List = make([]*models.IndustrialManagementResp, 0)
+		}
+		list[k].PublishDate = utils.StrTimeToTime(v.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
+	}
 	resp := new(models.ArticleCollectionLIstResp)
 	resp.List = list
 	br.Ret = 200
@@ -130,11 +179,6 @@ func (this *ResearchController) HotList() {
 		br.Ret = 408
 		return
 	}
-	//chartPermissionId, _ := this.GetInt("ChartPermissionId")
-	//if chartPermissionId < 1 {
-	//	br.Msg = "请输入分类ID"
-	//	return
-	//}
 	themeType, _ := this.GetInt("ThemeType")
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
@@ -147,70 +191,61 @@ func (this *ResearchController) HotList() {
 	}
 	startSize = utils.StartIndex(currentIndex, pageSize)
 	var condition string
-	if themeType != 2 {
-		condition = `ORDER BY sum_num DESC `
+	var conditionOrder 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
+	}
+	condition = ` AND a.article_type_id IN (` + articleTypeIds + `)  `
+	if themeType == 2 {
+		conditionOrder = `ORDER BY publish_date DESC  `
 	} else {
-		condition = `ORDER BY publish_date DESC `
+		conditionOrder = `ORDER BY sum_num DESC   `
 	}
 
-	total, err := models.GetThemeHeatListCount("")
+	total, err := models.GetThemeHeatListCount(condition)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 	}
-	list, err := models.GetThemeHeatList(user.UserId, condition, startSize, pageSize)
+	list, err := models.GetThemeHeatList(user.UserId, condition, conditionOrder, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
 		return
 	}
-	//newMap := make(map[int]string)
-	//listNew, err := models.GetIndustrialManagementNewList("")
-	//if err != nil {
-	//	br.Msg = "获取信息失败"
-	//	br.ErrMsg = "获取产业最新信息失败,Err:" + err.Error()
-	//	return
-	//}
-	//for _, v := range listNew {
-	//	newMap[v.IndustrialManagementId] = v.IndustryName
-	//}
-	condition = ` AND a.article_type_id > 0  `
 	listSubjcet, err := models.GetThemeHeatSubjectList(condition)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
 		return
 	}
-	mapHot := make(map[string]int)
-
-	condition = ` ORDER BY sum_num DESC `
-	listHot, err := models.GetThemeHeatList(user.UserId, condition, 0, 3)
+	mapHot := make(map[int]bool)
+	mapNew, err := services.GetYanXuanIndustrialManagementIdNewMap(articleTypeIds)
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		br.ErrMsg = "GetYanXuanIndustrialManagementIdNewMap,Err:" + err.Error()
 		return
 	}
-	for _, v := range listHot {
-		mapHot[v.IndustryName] = v.IndustrialManagementId
+	//if themeType == 2 {
+	mapHot, err = services.GetYanXuanIndustrialManagementIdHotMap(articleTypeIds)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetYanXuanIndustrialManagementIdNewMap,Err:" + err.Error()
+		return
 	}
-	nowTime := time.Now().Local()
-	threeMonBefore := nowTime.AddDate(0, -3, 0)
+	//}
 	for k, v := range list {
-		//if newMap[v.IndustrialManagementId] != "" {
-		//	list[k].IsNew = true
-		//}
-		// 关联报告发布时间均在3个月内则标记New
-		if v.MinReportTime != "" {
-			t, e := time.Parse(utils.FormatDateTime, v.MinReportTime)
-			if e != nil {
-				err = errors.New("报告最早发布时间有误,GetindustryVideo " + e.Error())
-				return
-			}
-			if t.After(threeMonBefore) {
-				list[k].IsNew = true
-			}
-		}
+		list[k].IsNew = mapNew[v.IndustrialManagementId]
+		list[k].IsHot = mapHot[v.IndustrialManagementId]
 		if v.FllowNum > 0 {
 			list[k].IsFollw = true
 		}
@@ -219,9 +254,6 @@ func (this *ResearchController) HotList() {
 				list[k].IndustrialSubjectList = append(list[k].IndustrialSubjectList, v2)
 			}
 		}
-		if mapHot[v.IndustryName] > 0 {
-			list[k].IsHot = true
-		}
 	}
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp := new(models.IndustrialManagementHotListResp)
@@ -236,6 +268,9 @@ func (this *ResearchController) HotList() {
 // @Title KOL榜列表
 // @Description KOL榜列表接口
 // @Param   ChartPermissionId   query   int  true       "分类ID"
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   ThemeType   query   int  true       "主题类型,1关注度、2更新时间 "
 // @Success 200 {object} models.DepartmentListResp
 // @router /kolList [get]
 func (this *ResearchController) KolList() {
@@ -250,16 +285,62 @@ func (this *ResearchController) KolList() {
 		br.Ret = 408
 		return
 	}
-	//chartPermissionId, _ := this.GetInt("ChartPermissionId")
-	//if chartPermissionId < 1 {
-	//	br.Msg = "请输入分类ID"
-	//	return
+	themeType, _ := this.GetInt("ThemeType")
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize15
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+	articleTypeIds, err := services.GetYanXuanArticleTypeIds()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
+		return
+	}
+	if articleTypeIds == "" {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "研选分类ID不能为空"
+		return
+	}
+	var condition string
+	var conditionOrder string
+	condition = ` AND a.article_type_id IN (` + articleTypeIds + `)  `
+
+	total, err := models.GetDepartmentlistCount(condition)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+
+	if themeType == 2 {
+		conditionOrder = `ORDER BY publish_date DESC  `
+	} else {
+		conditionOrder = `ORDER BY sum_num DESC `
+	}
+	mapHot := make(map[int]bool)
+	//if themeType == 2 {
+	conditionHot := `ORDER BY sum_num DESC `
+	listhot, err := models.GetDepartmentList(condition, conditionHot, user.UserId, 0, 3)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取信息失败,Err:" + err.Error()
+		return
+	}
+	for _, v := range listhot {
+		mapHot[v.DepartmentId] = true
+	}
 	//}
 
-	list, err := models.GetDepartmentList(user.UserId)
+	list, err := models.GetDepartmentList(condition, conditionOrder, user.UserId, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		br.ErrMsg = "获取信息失败,Err:" + err.Error()
 		return
 	}
 	listIndustrial, err := models.GetIndustrialDepartmentList()
@@ -281,8 +362,13 @@ func (this *ResearchController) KolList() {
 				}
 			}
 		}
+		//if themeType == 2 {
+		v.IsHot = mapHot[v.DepartmentId]
+		//}
 	}
 	resp := new(models.DepartmentListResp)
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.Paging = page
 	resp.List = list
 	br.Ret = 200
 	br.Success = true
@@ -318,11 +404,22 @@ func (this *ResearchController) ThemeDetail() {
 		source = 1
 	}
 
+	articleTypeIds, err := services.GetYanXuanArticleTypeIds()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
+		return
+	}
+	if articleTypeIds == "" {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "研选分类ID不能为空"
+		return
+	}
 	var condition string
 	if source == 1 {
-		condition = `  AND a.category_name LIKE '%研选%' `
+		condition = ` AND a.article_type_id IN (` + articleTypeIds + `)  `
 	} else {
-		condition = `  AND a.category_name  NOT LIKE '%研选%' `
+		condition = ` AND a.article_type_id  NOT IN (` + articleTypeIds + `)  `
 	}
 	resp := new(models.GetThemeDetailResp)
 	list, err := models.GetThemeDetail(user.UserId, industrialManagementId, condition)
@@ -331,75 +428,52 @@ func (this *ResearchController) ThemeDetail() {
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
 		return
 	}
-
-	var itemsNull []*models.GetThemeAericleListResp
-	subjectMap := make(map[string]string)
-	articleMap := make(map[int]int)
+	var articleIds []int
 	for _, v := range list {
 		resp.IndustryName = v.IndustryName
 		resp.IndustrialManagementId = v.IndustrialManagementId
-		itemSubJect := new(models.IndustrialSubject)
-		itemSubJect.SubjectName = v.SubjectName
-		itemSubJect.IndustrialSubjectId = v.IndustrialSubjectId
-		if subjectMap[v.SubjectName] == "" && v.SubjectName != "" {
-			resp.ListSubject = append(resp.ListSubject, itemSubJect)
-		}
-
-		subjectMap[v.SubjectName] = v.IndustryName
 		if v.FllowNum > 0 {
 			resp.IsFollw = true
 		}
-
-		if v.SubjectName == "" {
-			item := new(models.GetThemeAericleListResp)
-			item.ArticleId = v.ArticleId
-			item.Title = v.Title
-			item.PublishDate = v.PublishDate
-			item.SubjectName = v.SubjectName
-			item.DepartmentId = v.DepartmentId
-			item.NickName = v.NickName
-			item.Pv = v.Pv
-			item.CollectNum = v.CollectNum
-			itemsNull = append(itemsNull, item)
-
-		}
+		articleIds = append(articleIds, v.ArticleId)
 	}
-
-	for _, v := range resp.ListSubject {
-		subjetcGroup := new(models.GetThemeAericleListBuSubjectResp)
-		for _, v2 := range list {
-			if v2.IndustrialSubjectId == v.IndustrialSubjectId && articleMap[v2.ArticleId] == 0 {
-				item := new(models.GetThemeAericleListResp)
-				item.ArticleId = v2.ArticleId
-				item.Title = v2.Title
-				item.PublishDate = v2.PublishDate
-				item.SubjectName = v2.SubjectName
-				item.IndustrialSubjectId = v2.IndustrialSubjectId
-				for _, v3 := range list {
-					if v3.ArticleId == v2.ArticleId && v3.SubjectName != v2.SubjectName && v3.SubjectName != "" {
-						item.SubjectName += "/" + v3.SubjectName
-					}
-				}
-				item.DepartmentId = v2.DepartmentId
-				item.NickName = v2.NickName
-				item.Pv = v2.Pv
-				item.CollectNum = v2.CollectNum
-				item.MyCollectNum = v2.MyCollectNum
-				if v2.MyCollectNum > 0 {
-					item.IsCollect = true
-				}
-				resp.List = append(resp.List, item)
-				articleMap[v2.ArticleId] = v2.ArticleId
-				//subjetcGroup.List = append(subjetcGroup.List, item)
-			}
-			subjetcGroup.SubjectName = v.SubjectName
+	mapArticleSubjectName, subjectMap, err := services.GetArticleSubjectName(articleIds)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	for _, v2 := range list {
+		item := new(models.GetThemeAericleListResp)
+		item.ArticleId = v2.ArticleId
+		item.Title = v2.Title
+		item.PublishDate = v2.PublishDate
+		item.SubjectName = v2.SubjectName
+		item.IndustrialSubjectId = v2.IndustrialSubjectId
+		item.DepartmentId = v2.DepartmentId
+		item.NickName = v2.NickName
+		item.Pv = v2.Pv
+		item.CollectNum = v2.CollectNum
+		item.MyCollectNum = v2.MyCollectNum
+		if v2.MyCollectNum > 0 {
+			item.IsCollect = true
 		}
+		item.SubjectName = mapArticleSubjectName[v2.ArticleId]
+		resp.List = append(resp.List, item)
+	}
 
+	listSub, err := models.GetcygxIndustrialSubject(industrialManagementId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
 	}
-	//当标的为空时进行合并
-	if len(itemsNull) > 0 {
-		for _, v := range itemsNull {
-			resp.List = append(resp.List, v)
+	for _, v := range listSub {
+		itemSubJect := new(models.IndustrialSubject)
+		itemSubJect.SubjectName = v.SubjectName
+		itemSubJect.IndustrialSubjectId = v.IndustrialSubjectId
+		if subjectMap[v.IndustrialSubjectId] != "" {
+			resp.ListSubject = append(resp.ListSubject, itemSubJect)
 		}
 	}
 	br.Ret = 200
@@ -430,8 +504,21 @@ func (this *ResearchController) DepartmentIdDetail() {
 		br.Msg = "请输入作者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
+	}
+	var condition string
+	condition = ` AND a.article_type_id IN (` + articleTypeIds + `)  `
 	resp := new(models.DepartmentDetailResp)
-	detail, err := models.GetDepartmentDetail(user.UserId, departmentId)
+	detail, err := models.GetDepartmentDetail(user.UserId, departmentId, condition)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取作者信息失败,Err:" + err.Error()
@@ -446,18 +533,33 @@ func (this *ResearchController) DepartmentIdDetail() {
 	if detail.MyFllowNum > 0 {
 		resp.IsFllow = true
 	}
-	var condition string
-	condition = `  AND a.department_id = ` + strconv.Itoa(departmentId) + ` ORDER BY a.publish_date DESC  `
+	condition += `  AND a.department_id = ` + strconv.Itoa(departmentId) + `  GROUP BY a.article_id  ORDER BY a.publish_date DESC  `
 	list, err := models.GetArticleCollectionList(condition, user.UserId)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
 		return
 	}
+	var articleIds []int
 	for k, v := range list {
 		if v.MyCollectNum > 0 {
 			list[k].IsCollect = true
 		}
+		articleIds = append(articleIds, v.ArticleId)
+	}
+	//处理关联的产业
+	industrialMap, err := services.GetArticleIndustrialByArticleId(articleIds)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取关联的产业信息失败,GetArticleIndustrialByArticleId Err:" + err.Error()
+		return
+	}
+	for k, v := range list {
+		if len(industrialMap[v.ArticleId]) > 0 {
+			list[k].List = industrialMap[v.ArticleId]
+		} else {
+			list[k].List = make([]*models.IndustrialManagementResp, 0)
+		}
 	}
 
 	condition = ` AND a.department_id =  ` + strconv.Itoa(departmentId)
@@ -548,3 +650,161 @@ func (this *ResearchController) HotKeyWord() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 研选文章类型列表
+// @Description 研选文章类型列表接口
+// @Success 200 {object} models.CygxArticleTypeListResp
+// @router /article/typeList [get]
+func (this *ResearchController) ArticleType() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	key := utils.YAN_XUAN_TAB_KEY
+	conf, e := models.GetConfigByCode(key)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取首页头部导航失败, Err: " + e.Error()
+		return
+	}
+	if conf.ConfigValue == "" {
+		br.Msg = "获取失败"
+		br.ErrMsg = "首页头部导航配置值有误"
+		return
+	}
+	list := new(models.CygxArticleTypeListResp)
+	if e = json.Unmarshal([]byte(conf.ConfigValue), &list); e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "首页头部导航配置值解析失败, Err: " + e.Error()
+		return
+	}
+	resp := new(models.CygxArticleTypeListResp)
+	resp = list
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 研选最新报告列表
+// @Description 研选最新报告列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   ArticleTypeIds   query   array  true       "文章类型ID多个用  , 隔开"
+// @Success 200 {object} models.IndustrialManagementNewList
+// @router /article/newList [get]
+func (this *ResearchController) ArticleNewList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	articleTypeIds := this.GetString("ArticleTypeIds")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = paging.StartIndex(currentIndex, pageSize)
+	var condition string
+	var conditiontype string
+	var pars []interface{}
+	condition = `    AND publish_status = 1  `
+	if articleTypeIds == "" {
+		conditiontype = " AND is_show_yanx  = 1 "
+	} else {
+		conditiontype = ` AND   group_id IN  (` + articleTypeIds + `) `
+	}
+	listType, err := models.GetCygxArticleTypeListCondition(conditiontype)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	articleTypeIds = ""
+	for _, v := range listType {
+		articleTypeIds += strconv.Itoa(v.ArticleTypeId) + ","
+	}
+	articleTypeIds = strings.TrimRight(articleTypeIds, ",")
+	condition += `   AND a.article_type_id IN (` + articleTypeIds + `) `
+	total, err := models.GetArticleResearchCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetArticleResearchCount,Err:" + err.Error()
+		return
+	}
+	list, err := models.GetArticleResearchList(condition, pars, startSize, pageSize, user.UserId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	var articleIds []int
+	for k, v := range list {
+		if v.MyCollectNum > 0 {
+			list[k].IsCollect = true
+		}
+		articleIds = append(articleIds, v.ArticleId)
+	}
+	//处理关联的产业
+	industrialMap, err := services.GetArticleIndustrialByArticleId(articleIds)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取关联的产业信息失败,GetArticleIndustrialByArticleId Err:" + err.Error()
+		return
+	}
+	for k, v := range list {
+		if len(industrialMap[v.ArticleId]) > 0 {
+			list[k].List = industrialMap[v.ArticleId]
+		} else {
+			list[k].List = make([]*models.IndustrialManagementResp, 0)
+		}
+	}
+	//处理对应的文章类型标签按钮
+	nameMap, styleMap, err := services.GetArticleTypeMap()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetArticleTypeMap Err:" + err.Error()
+		return
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp := new(models.ArticleResearchListResp)
+	for _, v := range list {
+		item := models.ArticleResearchResp{
+			ArticleId:       v.ArticleId,
+			Title:           v.Title,
+			PublishDate:     v.PublishDate,
+			DepartmentId:    v.DepartmentId,
+			NickName:        v.NickName,
+			IsCollect:       v.IsCollect,
+			Pv:              v.Pv,
+			CollectNum:      v.CollectNum,
+			ArticleTypeName: nameMap[v.ArticleTypeId],
+			ButtonStyle:     styleMap[v.ArticleTypeId],
+			List:            v.List,
+		}
+		resp.List = append(resp.List, &item)
+	}
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 3 - 1
controllers/tactics.go

@@ -130,7 +130,9 @@ func (this *TacticsController) List() {
 		//	condition = ` AND category_id IN(` + strconv.Itoa(categoryId) + `)`
 		//}
 
-		if detail.PolymerizationId != "" {
+		if detail.CeLueFieldId != "" {
+			condition = ` AND ce_lue_field_id IN(` + detail.CeLueFieldId + `)`
+		} else if detail.PolymerizationId != "" {
 			condition = ` AND category_id IN(` + detail.PolymerizationId + `)`
 		} else {
 			condition = ` AND category_id IN(` + strconv.Itoa(categoryId) + `)`

+ 31 - 0
models/activity.go

@@ -114,6 +114,7 @@ type ActivityRep struct {
 type ActivityArticleResp struct {
 	ReportLink string `description:"报告链接"`
 	ArticleId  int    `description:"报告id(报告链接跳转使用)"`
+	Title      string `description:"报告id(报告链接跳转使用)"`
 }
 
 // 活动详情
@@ -195,6 +196,12 @@ type ActivityDetail struct {
 	SourceType              int                        `description:"活动来源。 1:活动 、2:专项产业调研"`
 	TripImgLink             string                     `description:"专项产业调研行程链接"`
 	ActivityTimeEnd         string                     `description:"专项产业调研活动预期结束时间"`
+	IsShowFollowButton      bool                       `description:"是否展示关注取关按钮"`
+	IsFollowButton          bool                       `description:"是否关注"`
+}
+type ListArticleActivity struct {
+	Title   string `description:"文章标题"`
+	ArtleId int    `description:"产业id"`
 }
 
 type CygxActivityResp struct {
@@ -733,6 +740,30 @@ func GetActivityLabelListAll(condition, sortTime string, pars []interface{}, sta
 	return
 }
 
+// 主题列表
+func GetActivityLabelListCity() (items []*CygxActivity, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			activity_id,
+			activity_type_id,
+			activity_time,
+			label,
+			temporary_label,
+			is_show_subject_name,
+			yidong_activity_id,
+			city 
+		FROM
+			cygx_activity AS art 
+		WHERE
+			1 = 1 
+			AND art.active_state IN ( 1, 2 ) 
+			AND city != '' 
+		ORDER BY
+			activity_time ASC  `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
 type GetCygxActivityLabelListRep struct {
 	Label  string `description:"主题"`
 	ImgUrl string `description:"图片路径"`

+ 8 - 0
models/article.go

@@ -46,6 +46,7 @@ type CygxArticle struct {
 	Annotation       string `description:"核心观点"`
 	TypeName         string `description:"策略平台报告类型"`
 	ModifyTimeByCl   string `description:"策略平台报告更新时间"`
+	CeLueFieldId     int    `description:"策略平台领域ID"`
 }
 
 type CygxArticleEs struct {
@@ -162,6 +163,8 @@ type ArticleDetail struct {
 	ArticleTypeId           int    `description:"文章类型ID"`
 	IsSpecialArticle        bool   `description:"是否属于专项调研报告"`
 	Annotation              string `description:"核心观点"`
+	IsShowFollowButton      bool   `description:"是否展示关注取关按钮"`
+	IsFollowButton          bool   `description:"是否关注"`
 }
 
 type ArticleDetailFileLink struct {
@@ -449,6 +452,11 @@ type ArticleId struct {
 	ArticleId int `description:"文章id"`
 }
 
+type ArticleIdAndTitle struct {
+	Title     string `description:"标题"`
+	ArticleId int    `description:"文章id"`
+}
+
 // 获取自定义分类的文章ID
 func GetCustomArticleId() (item []*ArticleId, err error) {
 	o := orm.NewOrm()

+ 22 - 3
models/article_type.go

@@ -17,9 +17,20 @@ type CygxArticleType struct {
 	IcoLink            string    `description:"图标链接地址"`
 	IcoLinkM           string    `description:"移动端图标链接地址"`
 	IsShowLinkButton   int       `description:"这种报告类型是否展示查看报告链接"`
+	ButtonStyle        string    `description:"按钮展示样式"`
 }
 
-//详情
+type CygxArticleTypeResp struct {
+	ArticleTypeId   int    `description:"文章类型ID"`
+	ArticleTypeName string `description:"类型名称"`
+	ButtonStyle     string `description:"按钮展示样式"`
+}
+
+type CygxArticleTypeListResp struct {
+	List []*CygxArticleTypeResp
+}
+
+// 详情
 func GetCygxArticleTypeDetailById(activityTypeId int) (item *CygxArticleType, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_article_type WHERE article_type_id = ? `
@@ -27,7 +38,7 @@ func GetCygxArticleTypeDetailById(activityTypeId int) (item *CygxArticleType, er
 	return
 }
 
-//获取数量
+// 获取数量
 func GetCygxArticleTypeCount(condition string) (count int, err error) {
 	o := orm.NewOrm()
 	sqlCount := `SELECT COUNT(1) AS count  FROM cygx_article_type WHERE  1=1 ` + condition
@@ -35,7 +46,7 @@ func GetCygxArticleTypeCount(condition string) (count int, err error) {
 	return
 }
 
-//报告类型列表
+// 报告类型列表
 func GetCygxArticleTypeList() (items []*CygxArticleType, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_article_type ORDER BY sort DESC`
@@ -43,6 +54,14 @@ func GetCygxArticleTypeList() (items []*CygxArticleType, err error) {
 	return
 }
 
+// 报告类型列表
+func GetCygxArticleTypeListCondition(condition string) (items []*CygxArticleType, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_article_type   WHERE  1=1 ` + condition + ` ORDER BY sort DESC`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
 func GetArticleTypeInfo(activityTypeId int) (item *CygxArticleType, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_article_type   WHERE  article_type_id=? `

+ 1 - 1
models/chart.go

@@ -174,7 +174,7 @@ func GetChartList(condition string, pars []interface{}, startSize, pageSize int)
 	if condition != "" {
 		sql += condition
 	}
-	sql += ` ORDER BY create_date DESC LIMIT ?,? `
+	sql += ` ORDER BY chart_id DESC LIMIT ?,? `
 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
 	return
 }

+ 22 - 1
models/industrial_article_group_subject.go

@@ -13,7 +13,13 @@ type CygxIndustrialArticleGroupSubject struct {
 	CreateTime          time.Time `description:"创建时间"`
 }
 
-//列表
+type SubjectArticlGroupList struct {
+	SubjectName         string `description:"标的名称"`
+	ArticleId           int    `description:"cygx_article表的文章ID"`
+	IndustrialSubjectId int    `description:"cygx_industrial_subject表的文章ID"`
+}
+
+// 列表
 func GetSubjectArticleGroupManagementList(condition string, pars []interface{}) (items []*CygxIndustrialArticleGroupSubject, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -25,3 +31,18 @@ func GetSubjectArticleGroupManagementList(condition string, pars []interface{})
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
+
+// 列表
+func GetSubjectArticlGroupList(condition string, pars []interface{}) (items []*SubjectArticlGroupList, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			 s.subject_name,
+			 s.industrial_subject_id,
+			 ag.article_id
+		FROM
+			cygx_industrial_article_group_subject AS ag
+			INNER JOIN cygx_industrial_subject AS s ON s.industrial_subject_id = ag.industrial_subject_id
+			WHERE 1= 1  ` + condition
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 47 - 33
models/industrial_management.go

@@ -25,7 +25,7 @@ type IndustrialManagementCount struct {
 	IndustrialManagementId int `orm:"column(industrial_management_id);pk" description:"产业id"`
 }
 
-//获取产业置顶数量分类列表
+// 获取产业置顶数量分类列表
 func GetIndustrialManagemenCountTop(sqlChartPermissionId string, uid int, condition string) (items []*IndustrialManagementCount, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -41,7 +41,7 @@ func GetIndustrialManagemenCountTop(sqlChartPermissionId string, uid int, condit
 	return
 }
 
-//获取产业不置顶数量
+// 获取产业不置顶数量
 func GetIndustrialManagemenCountNoTop(sqlChartPermissionId string, uid int, condition string) (items []*IndustrialManagementCount, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -57,7 +57,7 @@ func GetIndustrialManagemenCountNoTop(sqlChartPermissionId string, uid int, cond
 	return
 }
 
-//产业列表
+// 产业列表
 func GetIndustrialManagementAll(uid int, condition, orderSrt string, startSize, pageSize int) (items []*IndustrialManagement, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -83,7 +83,7 @@ func GetIndustrialManagementAll(uid int, condition, orderSrt string, startSize,
 	return
 }
 
-//产业列表
+// 产业列表
 func GetIndustrialManagementAllCount(condition string) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -105,7 +105,7 @@ func GetIndustrialManagementAllCount(condition string) (count int, err error) {
 	return
 }
 
-//产业列表 -置顶
+// 产业列表 -置顶
 func GetIndustrialManagementTopAll(uid int, condition string, startSize, pageSize int) (items []*IndustrialManagement, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -130,7 +130,7 @@ func GetIndustrialManagementTopAll(uid int, condition string, startSize, pageSiz
 	return
 }
 
-//标的列表
+// 标的列表
 func GetIndustrialSubjectAll(IndustrialManagementId int) (items []*IndustrialSubject, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_industrial_subject WHERE industrial_management_id = ? `
@@ -138,7 +138,7 @@ func GetIndustrialSubjectAll(IndustrialManagementId int) (items []*IndustrialSub
 	return
 }
 
-//标的列表
+// 标的列表
 func GetIndustrialSubjectAllByIndustrialId(industrialIdArr []int) (items []*IndustrialSubject, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_industrial_subject WHERE industrial_management_id IN  (` + utils.GetOrmInReplace(len(industrialIdArr)) + `)   `
@@ -146,7 +146,18 @@ func GetIndustrialSubjectAllByIndustrialId(industrialIdArr []int) (items []*Indu
 	return
 }
 
-//分析师列表
+// GetTopOneMonthArtReadNumIndustry 获取近一个月报告阅读数量最多的产业信息 根据行业分组
+func GetTopOneMonthArtReadNumIndustryAll(condition string, pars []interface{}) (items []*IndustrialManagement, err error) {
+	sql := `SELECT * FROM cygx_industrial_management WHERE 1 = 1 `
+	if condition != `` {
+		sql += condition
+	}
+	sql += ` ORDER BY article_read_num DESC `
+	_, err = orm.NewOrm().Raw(sql, pars).QueryRows(&items)
+	return
+}
+
+// 分析师列表
 func GetIndustrialAnalystAll(IndustrialManagementId int) (items []*IndustrialAnalyst, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_industrial_analyst where industrial_management_id = ? `
@@ -154,7 +165,7 @@ func GetIndustrialAnalystAll(IndustrialManagementId int) (items []*IndustrialAna
 	return
 }
 
-//获取产业数量
+// 获取产业数量
 func GetIndustrialManagementCount(IndustrialManagementId int) (count int, err error) {
 	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_industrial_management WHERE industrial_management_id=? `
 	o := orm.NewOrm()
@@ -169,7 +180,7 @@ func GetIndustrialManagementDetail(industrialManagementId int) (items *Industria
 	return
 }
 
-//获取该产业下最新的文章详情
+// 获取该产业下最新的文章详情
 func GetIndustrialNewArticleDetail(industrialManagementId int) (item *ArticleDetail, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -194,7 +205,7 @@ func GetIndustrialNewArticleDetail(industrialManagementId int) (item *ArticleDet
 	return
 }
 
-//修改产业是否属于新标签
+// 修改产业是否属于新标签
 func UpdateIndustrialIsNewLabel() (err error) {
 	o := orm.NewOrm()
 	resultTime := time.Now().AddDate(0, -2, 0).Format(utils.FormatDateTime)
@@ -209,7 +220,7 @@ type IndustrialManagementId struct {
 	IndustrialManagementId string `description:"产业Id"`
 }
 
-//获取归类产业报告数量大于10的
+// 获取归类产业报告数量大于10的
 func GetIndustrialMorethan10() (items []*IndustrialManagementId, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM
@@ -219,7 +230,7 @@ func GetIndustrialMorethan10() (items []*IndustrialManagementId, err error) {
 	return
 }
 
-//修改产业是否属于深度标签
+// 修改产业是否属于深度标签
 func UpdateIndustrialIsDeepLabel(idStr string) (err error) {
 	o := orm.NewOrm()
 	msql := `UPDATE cygx_industrial_management
@@ -266,7 +277,7 @@ type IndustrialManagementIdName struct {
 	IsReport     string `description:"1观点,0纪要"`
 }
 
-//获取归类产业报告数量大于10的
+// 获取归类产业报告数量大于10的
 func GetIndustrialManagementIds() (items []*IndustrialManagementIdInt, err error) {
 	o := orm.NewOrm()
 	//sql := `SELECT a.industrial_management_id FROM
@@ -282,12 +293,12 @@ func GetIndustrialManagementIds() (items []*IndustrialManagementIdInt, err error
 
 func GetcygxIndustrialSubject(industrialManagementId int) (items []*IndustrialSubject, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT subject_name FROM cygx_industrial_subject  WHERE industrial_management_id = ?`
+	sql := `SELECT subject_name,industrial_subject_id FROM cygx_industrial_subject  WHERE industrial_management_id = ?`
 	_, err = o.Raw(sql, industrialManagementId).QueryRows(&items)
 	return
 }
 
-//通过名称获取
+// 通过名称获取
 func GetcygxIndustrialSubjectByName(name string) (industrial_management_id string, err error) {
 	o := orm.NewOrm()
 	sql := `	SELECT industrial_subject_id FROM cygx_industrial_subject  WHERE subject_name = ?`
@@ -327,7 +338,7 @@ func UpdateIndustrialManagementArtReadNum(num, industrialManagementId int) (err
 	return
 }
 
-//更新产业布局时间
+// 更新产业布局时间
 func UpdateIndustrialManagementLayoutTime(layoutTime string, industrialManagementId int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE cygx_industrial_management SET layout_time = ? WHERE industrial_management_id = ?`
@@ -335,7 +346,7 @@ func UpdateIndustrialManagementLayoutTime(layoutTime string, industrialManagemen
 	return
 }
 
-//获取产业下阅读数量第三的产业详情
+// 获取产业下阅读数量第三的产业详情
 func GetIndustrialManagementHot3(chartPermissionId int) (item *IndustrialManagementRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_industrial_management WHERE chart_permission_id = ? ORDER BY article_read_num DESC LIMIT 2,1`
@@ -343,7 +354,7 @@ func GetIndustrialManagementHot3(chartPermissionId int) (item *IndustrialManagem
 	return
 }
 
-//获取产业关联标的的数量
+// 获取产业关联标的的数量
 func GetIndustrialManagementSubjectCount(industrialManagementId int) (count int, err error) {
 	sqlCount := ` SELECT COUNT(1) AS count FROM
 				cygx_industrial_subject AS s 
@@ -356,7 +367,7 @@ func GetIndustrialManagementSubjectCount(industrialManagementId int) (count int,
 	return
 }
 
-//获取产业关联标的列表
+// 获取产业关联标的列表
 func GetIndustrialManagementSubjectList(articleId int) (items []*IndustrialSubject, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -388,7 +399,7 @@ type IndustrialManagementNewList struct {
 	List []*IndustrialManagementNewResp
 }
 
-//近期更新主题列表
+// 近期更新主题列表
 func GetIndustrialManagementNewList(condition string) (items []*IndustrialManagementNewResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -412,7 +423,7 @@ func GetIndustrialManagementNewList(condition string) (items []*IndustrialManage
 	return
 }
 
-//获取产业关联标的列表
+// 获取产业关联标的列表
 func GetIndustrialManagementForSubjecName(subjectName string, chartPermissionId int) (items []*IndustrialSubject, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT s.subject_name,s.industrial_subject_id,m.industrial_management_id,m.industry_name,layout_time
@@ -423,7 +434,7 @@ func GetIndustrialManagementForSubjecName(subjectName string, chartPermissionId
 	return
 }
 
-//报告分类的新增与修改
+// 报告分类的新增与修改
 func ReportArticleClassificationEditNew(reportId int, industrialManagementIdStr string, articleId int, ndustrialSubjectIdStr string) (err error) {
 	to, err := orm.NewOrm().Begin()
 	if err != nil {
@@ -479,7 +490,7 @@ func ReportArticleClassificationEditNew(reportId int, industrialManagementIdStr
 	return
 }
 
-//通过标的名称获取相关联的活动ID
+// 通过标的名称获取相关联的活动ID
 func GetActivityIdListBySubjecName(subjectName string) (items []*ActivityIdRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT  * FROM cygx_industrial_activity_group_subject WHERE industrial_subject_id	 IN (SELECT industrial_subject_id FROM cygx_industrial_subject WHERE subject_name IN(` + subjectName + `) ) GROUP BY activity_id`
@@ -487,7 +498,7 @@ func GetActivityIdListBySubjecName(subjectName string) (items []*ActivityIdRep,
 	return
 }
 
-//产业关注榜
+// 产业关注榜
 func GetIndustrialManagementFllowBillboard(pars []interface{}, condition, orderSrt string, startSize, pageSize int) (items []*IndustrialManagement, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -507,7 +518,7 @@ func GetIndustrialManagementFllowBillboard(pars []interface{}, condition, orderS
 	return
 }
 
-//获取标的列表
+// 获取标的列表
 func GetSubjectList(pars []interface{}, condition string) (items []*IndustrialManagementIdInt, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -524,7 +535,7 @@ func GetSubjectList(pars []interface{}, condition string) (items []*IndustrialMa
 	return
 }
 
-//获取标的列表
+// 获取标的列表
 func GetIndustrialListByarticleId(pars []interface{}, condition string) (items []*IndustrialManagementIdInt, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -540,7 +551,7 @@ func GetIndustrialListByarticleId(pars []interface{}, condition string) (items [
 	return
 }
 
-//修改产业关注数量
+// 修改产业关注数量
 func UpdateIndustrialManagementFllowNum(num, industrialManagementId int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE cygx_industrial_management SET user_fllow_num = ? WHERE industrial_management_id = ?`
@@ -548,7 +559,7 @@ func UpdateIndustrialManagementFllowNum(num, industrialManagementId int) (err er
 	return
 }
 
-//通过id 获取详情
+// 通过id 获取详情
 func GetIndustrialManagemenDetailByAaticleID(articleId int) (items []*IndustrialManagementRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -564,7 +575,7 @@ func GetIndustrialManagemenDetailByAaticleID(articleId int) (items []*Industrial
 	return
 }
 
-//获取所有的产业
+// 获取所有的产业
 func GetindustrialManagement() (items []*IndustrialManagementRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -638,8 +649,11 @@ type IndustrialManagementArticle struct {
 	PublishDate            string `description:"发布时间"`
 }
 
-//时间线的更新时间
+// 时间线的更新时间
 func GetTimeLineReportIndustrialPublishdateList(industrialIdArr []int) (items []*IndustrialManagementArticle, err error) {
+	if len(industrialIdArr) == 0 {
+		return
+	}
 	o := orm.NewOrm()
 	sql := `SELECT	
 			mmc.id,
@@ -659,7 +673,7 @@ func GetTimeLineReportIndustrialPublishdateList(industrialIdArr []int) (items []
 	return
 }
 
-//获取该产业下最新的文章详情
+// 获取该产业下最新的文章详情
 func GetNewArticleDetailByIndustrialIds(industrialIdArr []int) (items []*IndustrialManagementArticle, err error) {
 	arrLen := len(industrialIdArr)
 	if arrLen == 0 {
@@ -685,7 +699,7 @@ func GetNewArticleDetailByIndustrialIds(industrialIdArr []int) (items []*Industr
 	return
 }
 
-//GetIndustrialManagementArticleNewPublishData 获取产业关联文章的最新发布时间
+// GetIndustrialManagementArticleNewPublishData 获取产业关联文章的最新发布时间
 func GetIndustrialManagementArticleNewPublishData() (items []*IndustrialManagement, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT

+ 35 - 10
models/industry_fllow.go

@@ -24,14 +24,20 @@ type CygxIndustryFllowRep struct {
 	IndustrialManagementId int `description:"产业D"`
 }
 
-//添加
+type IndustryFllowArryReq struct {
+	SourceId int    `description:"资源ID"`
+	Source   string `description:"资源类型 报告 :article 、活动 :activity"`
+	DoType   string `description:"操作方式 关注 :add 、取消关注 :cancel"`
+}
+
+// 添加
 func AddCygxIndustryFllow(item *CygxIndustryFllow) (lastId int64, err error) {
 	o := orm.NewOrm()
 	lastId, err = o.Insert(item)
 	return
 }
 
-//批量添加
+// 批量添加
 func AddCygxIndustryFllowMulti(items []*CygxIndustryFllow) (err error) {
 	o := orm.NewOrm()
 	if len(items) > 0 {
@@ -53,21 +59,32 @@ func RemoveCygxIndustryFllow(userId, industrialManagementId int) (err error) {
 	return
 }
 
-//获取数量
+// RemoveCygxIndustryFllowArry 多个产业同时取消关注
+func RemoveCygxIndustryFllowArry(userId int, condition string, pars []interface{}) (err error) {
+	o := orm.NewOrm()
+	if condition == "" {
+		return
+	}
+	sql := `DELETE FROM cygx_industry_fllow WHERE user_id=?  ` + condition
+	_, err = o.Raw(sql, userId, pars).Exec()
+	return
+}
+
+// 获取数量
 func GetCountCygxIndustryFllow(userId, industrialManagementId int, condition string) (count int, err error) {
 	sql := `SELECT COUNT(1) AS count FROM cygx_industry_fllow WHERE user_id=? AND industrial_management_id=? ` + condition
 	err = orm.NewOrm().Raw(sql, userId, industrialManagementId).QueryRow(&count)
 	return
 }
 
-//获取数量
+// 获取数量
 func GetCountCygxIndustryFllowByUid(userId int) (count int, err error) {
 	sql := `SELECT COUNT(1) AS count FROM cygx_industry_fllow WHERE user_id=? `
 	err = orm.NewOrm().Raw(sql, userId).QueryRow(&count)
 	return
 }
 
-//获取列表信息根据手机号分组
+// 获取列表信息根据手机号分组
 func GetCygxIndustryFllowList(condition string) (items []*CygxIndustryFllow, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_industry_fllow  WHERE 1 =1   ` + condition + `  GROUP BY user_id  `
@@ -75,7 +92,15 @@ func GetCygxIndustryFllowList(condition string) (items []*CygxIndustryFllow, err
 	return
 }
 
-//修改用户关注的相关信息
+// 获取列表信息根据手机号分组
+func GetCygxIndustryFllowListByUserId(condition string) (items []*CygxIndustryFllow, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_industry_fllow  WHERE 1 =1   ` + condition
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// 修改用户关注的相关信息
 func UpdateCygxIndustryFllow(wxUser *WxUserItem) (err error) {
 	o := orm.NewOrm()
 	var sql string
@@ -89,7 +114,7 @@ func UpdateCygxIndustryFllow(wxUser *WxUserItem) (err error) {
 	return
 }
 
-//获取用户关注的产业列表
+// 获取用户关注的产业列表
 func GetUserFllowIndustrialList(userId int) (items []*CygxIndustryFllow, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -112,7 +137,7 @@ type CygxIndustryFllowCountRep struct {
 	Num                    int `description:"数量"`
 }
 
-//获取产业被关注的数量
+// 获取产业被关注的数量
 func GetUserFllowIndustrialCountList() (items []*CygxIndustryFllowCountRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -133,7 +158,7 @@ func GetUserFllowIndustrialCountList() (items []*CygxIndustryFllowCountRep, err
 	return
 }
 
-//GetUserFllowIndustrialListByUserIdAndIndustrial 通过用户ID 跟产业ID获取用户关注的产业列表
+// GetUserFllowIndustrialListByUserIdAndIndustrial 通过用户ID 跟产业ID获取用户关注的产业列表
 func GetUserFllowIndustrialListByUserIdAndIndustrial(userIds, industrials string) (items []*CygxIndustryFllow, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_industry_fllow 
@@ -144,7 +169,7 @@ func GetUserFllowIndustrialListByUserIdAndIndustrial(userIds, industrials string
 	return
 }
 
-//获取某个用户关注某个行业下的产业数量
+// 获取某个用户关注某个行业下的产业数量
 func GetCountCygxIndustryFllowByUidAndChartPermissionId(userId, ChartPermissionId int) (count int, err error) {
 	sql := `SELECT
 			COUNT( 1 ) AS count 

+ 138 - 22
models/report.go

@@ -375,6 +375,7 @@ type ArticleCollectionResp struct {
 	Pv                     int                         `description:"PV"`
 	CollectNum             int                         `description:"收藏人数"`
 	Source                 int                         `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
+	ArticleTypeId          int                         `description:"文章类型ID"`
 	List                   []*IndustrialManagementResp `description:"产业列表"`
 }
 
@@ -388,6 +389,42 @@ type ArticleCollectionLIstResp struct {
 	List []*ArticleCollectionResp
 }
 
+// 研选报告收藏榜单列表
+func GetReportCollectionBillboardListYx(limit int, pars []interface{}, condition string) (items []*ArticleCollectionResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			ac.id,
+			a.category_id,
+			a.article_id,
+			a.title,
+			a.body,
+			a.annotation,
+			a.abstract,
+			a.publish_date,
+			a.article_type_id,
+			d.nick_name,
+			d.department_id,
+			( SELECT count( 1 ) FROM cygx_article_history_record_newpv AS h WHERE h.article_id = a.article_id ) AS pv,
+			( SELECT count( 1 ) FROM cygx_article_collect AS ac  INNER JOIN wx_user as u ON  u.user_id = ac.user_id  WHERE ac.article_id = a.article_id  ) AS collect_num, 
+			( SELECT count( 1 ) FROM cygx_article_collect AS ac  INNER JOIN wx_user as u ON  u.user_id = ac.user_id  WHERE ac.article_id = a.article_id AND DATE_SUB( CURDATE(), INTERVAL 30 DAY ) <= date( ac.create_time )  ) AS collection_num
+		FROM
+			cygx_article AS a
+			INNER JOIN cygx_article_collect AS ac ON ac.article_id = a.article_id 
+			INNER JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = a.article_id
+			INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = mg.industrial_management_id
+			INNER JOIN cygx_article_department AS d ON d.department_id = a.department_id 
+		WHERE
+			1 = 1 
+			AND a.publish_status = 1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` GROUP BY a.article_id ORDER BY collection_num DESC,  a.publish_date DESC`
+	sql += ` LIMIT ?`
+	_, err = o.Raw(sql, pars, limit).QueryRows(&items)
+	return
+}
+
 // 列表
 func GetArticleCollectionList(condition string, userId int) (items []*ArticleCollectionResp, err error) {
 	o := orm.NewOrm()
@@ -417,6 +454,66 @@ func GetArticleCollectionList(condition string, userId int) (items []*ArticleCol
 	return
 } //end
 
+type ArticleResearchListResp struct {
+	Paging *paging.PagingItem
+	List   []*ArticleResearchResp
+}
+
+type ArticleResearchResp struct {
+	ArticleId       int                         `description:"文章id"`
+	Title           string                      `description:"标题"`
+	PublishDate     string                      `description:"发布时间"`
+	DepartmentId    int                         `description:"作者Id"`
+	NickName        string                      `description:"作者昵称"`
+	IsCollect       bool                        `description:"本人是否收藏"`
+	Pv              int                         `description:"PV"`
+	CollectNum      int                         `description:"收藏人数"`
+	Source          int                         `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
+	ArticleTypeId   int                         `description:"文章类型ID"`
+	ArticleTypeName string                      `description:"类型名称"`
+	ButtonStyle     string                      `description:"按钮展示样式"`
+	List            []*IndustrialManagementResp `description:"产业列表"`
+}
+
+// 获取我的日程数量
+func GetArticleResearchCount(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrm()
+	sqlCount := `SELECT COUNT( 1 ) AS count FROM
+			cygx_article AS a
+		WHERE
+			1 = 1  AND a.publish_status = 1` + condition
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+func GetArticleResearchList(condition string, pars []interface{}, startSize, pageSize, userId int) (items []*ArticleCollectionResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			a.article_id,
+			a.title,
+			date_format( a.publish_date, '%Y-%m-%d' ) AS publish_date,
+			a.article_type_id,
+			d.nick_name,
+			d.department_id,
+			( SELECT count( 1 ) FROM cygx_article_history_record_newpv AS h WHERE h.article_id = a.article_id ) AS pv,
+			( SELECT count( 1 ) FROM cygx_article_collect AS ac  INNER JOIN wx_user as u ON  u.user_id = ac.user_id  WHERE ac.article_id = a.article_id  ) AS collect_num, 
+			( SELECT count( 1 ) FROM cygx_article_collect AS ac  INNER JOIN wx_user as u ON  u.user_id = ac.user_id  WHERE ac.article_id = a.article_id AND DATE_SUB( CURDATE(), INTERVAL 30 DAY ) <= date( ac.create_time )  ) AS collect_num_order, 
+			( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id  AND user_id = ? ) AS my_collect_num
+		FROM
+			cygx_article AS a
+			INNER JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = a.article_id
+			INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = mg.industrial_management_id
+			INNER JOIN cygx_article_department AS d ON d.department_id = a.department_id 
+		WHERE
+			1 = 1  AND a.publish_status = 1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` GROUP BY a.article_id ORDER  BY   a.publish_date DESC  LIMIT ?,? `
+	_, err = o.Raw(sql, userId, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
 // 用户收藏榜start
 type IndustrialManagementHotResp struct {
 	IndustrialManagementId int                   `orm:"column(industrial_management_id);pk" description:"产业id"`
@@ -442,7 +539,7 @@ type IndustrialManagementHotListResp struct {
 }
 
 // 产业列表
-func GetThemeHeatList(userId int, condition string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
+func GetThemeHeatList(userId int, condition, conditionOrder string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
 			m.industry_name,
@@ -459,9 +556,7 @@ func GetThemeHeatList(userId int, condition string, startSize, pageSize int) (it
 			LEFT JOIN cygx_industrial_activity_group_management as ag ON ag.industrial_management_id = mg.industrial_management_id
 		WHERE
 			1 = 1
-			AND a.article_type_id > 0
-			AND publish_status = 1 
-			GROUP BY m.industrial_management_id ` + condition + ` LIMIT ?,?`
+			AND publish_status = 1  ` + condition + `  GROUP BY m.industrial_management_id ` + conditionOrder + ` , last_updated_time  DESC LIMIT ?,?`
 	_, err = o.Raw(sql, userId, startSize, pageSize).QueryRows(&items)
 	return
 }
@@ -476,7 +571,7 @@ func GetThemeHeatListCount(condition string) (count int, err error) {
 			LEFT JOIN cygx_industrial_activity_group_management as ag ON ag.industrial_management_id = mg.industrial_management_id
 		WHERE
 			1 = 1
-			AND a.article_type_id > 0 AND a.publish_status = 1  ` + condition
+            AND a.publish_status = 1  ` + condition
 	err = o.Raw(sql).QueryRow(&count)
 	return
 }
@@ -512,12 +607,14 @@ type DepartmentResp struct {
 	NickName     string `description:"作者昵称"`
 	ImgUrl       string `description:"图片链接"`
 	IsFollw      bool   `description:"是否关注"`
+	IsHot        bool   `description:"是否关注"`
 	FllowNum     int    `description:"关注数量"`
 	List         []*IndustrialDepartmentListResp
 }
 
 type DepartmentListResp struct {
-	List []*DepartmentResp
+	Paging *paging.PagingItem `description:"分页数据"`
+	List   []*DepartmentResp
 }
 type IndustrialDepartmentListResp struct {
 	IndustrialManagementId int    `description:"产业Id"`
@@ -526,27 +623,48 @@ type IndustrialDepartmentListResp struct {
 }
 
 // 作者列表
-func GetDepartmentList(userId int) (items []*DepartmentResp, err error) {
+
+func GetDepartmentList(condition, conditionOrder string, userId, startSize, pageSize int) (items []*DepartmentResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
 			d.nick_name,
 			d.department_id,
 			d.img_url,
+			MAX( a.publish_date ) AS publish_date,
 			( SELECT count( 1 ) FROM cygx_article_department_follow AS f  WHERE f.department_id = d.department_id  AND user_id =?  AND f.type= 1  ) AS fllow_num,
-			( SELECT count( 1 ) FROM cygx_article_department_follow  AS f INNER JOIN wx_user AS u ON u.user_id = f.user_id  WHERE f.department_id = d.department_id AND f.type= 1 ) +( SELECT count( 1 ) FROM cygx_article_collect AS ac INNER JOIN wx_user AS u ON u.user_id = ac.user_id  WHERE ac.article_id IN (SELECT article_id FROM cygx_article WHERE department_id = d.department_id ) 	AND DATE_SUB( CURDATE(), INTERVAL 30 DAY ) <= date( ac.create_time )  ) AS sum_num
+			( SELECT count( 1 ) FROM cygx_article_department_follow AS f  WHERE f.department_id = d.department_id  AND  f.type= 1  ) AS sum_num
 		FROM
 		cygx_article_department AS d
 			INNER JOIN cygx_article AS a ON d.department_id = a.department_id
 		WHERE
 			1 = 1
-			AND a.article_type_id > 0 
-			AND publish_status = 1 
+			AND publish_status = 1  ` + condition + `
 		GROUP BY
-				d.department_id
-		ORDER BY
-			sum_num DESC
-			LIMIT 15`
-	_, err = o.Raw(sql, userId).QueryRows(&items)
+				d.department_id ` + conditionOrder + ` , last_updated_time  DESC LIMIT ?,?`
+	_, err = o.Raw(sql, userId, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+// 获取数量
+func GetDepartmentlistCount(condition string) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	count(*) AS count 
+FROM
+	(
+	SELECT
+		COUNT( 1 ) AS count 
+	FROM
+		cygx_article_department AS d
+		INNER JOIN cygx_article AS a ON d.department_id = a.department_id 
+	WHERE
+		1 = 1 
+		AND a.article_type_id > 0 
+		AND publish_status = 1 
+	GROUP BY
+	d.department_id 
+	) c `
+	err = o.Raw(sql).QueryRow(&count)
 	return
 }
 
@@ -565,9 +683,7 @@ func GetIndustrialDepartmentList() (items []*IndustrialDepartmentListResp, err e
 		WHERE
 			1 = 1
 			AND a.article_type_id > 0
-			AND publish_status = 1 
-		GROUP BY
-			a.article_id 
+			AND publish_status = 1
 		ORDER BY
 			a.publish_date DESC`
 	_, err = o.Raw(sql).QueryRows(&items)
@@ -648,7 +764,7 @@ func GetThemeDetail(userId, industrialManagementId int, condition string) (items
 		WHERE
 			1 = 1
 			AND m.industrial_management_id = ? 
-			AND publish_status = 1 ` + condition + `
+			AND publish_status = 1 ` + condition + ` GROUP BY article_id
 		ORDER BY
 			publish_date DESC`
 	_, err = o.Raw(sql, userId, userId, industrialManagementId).QueryRows(&items)
@@ -680,7 +796,7 @@ type DepartmentDetail struct {
 }
 
 // 列表
-func GetDepartmentDetail(userId, departmentId int) (item DepartmentDetail, err error) {
+func GetDepartmentDetail(userId, departmentId int, condition string) (item DepartmentDetail, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
 			d.department_id,
@@ -688,8 +804,8 @@ func GetDepartmentDetail(userId, departmentId int) (item DepartmentDetail, err e
 			d.img_url,
 			( SELECT count( 1 ) FROM cygx_article_department_follow AS af WHERE af.user_id = ? AND af.department_id = d.department_id AND af.type= 1 ) AS my_fllow_num,
 			( SELECT count( 1 ) FROM cygx_article_department_follow AS f INNER JOIN wx_user as u ON  u.user_id = f.user_id   WHERE f.department_id = d.department_id  AND f.type= 1 ) AS fllow_num,
-			( SELECT count( 1 ) FROM cygx_article AS a WHERE a.department_id = d.department_id  ) AS article_num,
-			( SELECT count( 1 ) FROM cygx_article_collect  AS c INNER JOIN wx_user as u ON  u.user_id = c.user_id   WHERE c.article_id IN (SELECT  article_id FROM cygx_article AS a WHERE a.department_id = d.department_id )) AS collect_num
+			( SELECT count( 1 ) FROM cygx_article AS a WHERE a.department_id = d.department_id ` + condition + `  ) AS article_num,
+			( SELECT count( 1 ) FROM cygx_article_collect  AS c INNER JOIN wx_user as u ON  u.user_id = c.user_id   WHERE c.article_id IN (SELECT  article_id FROM cygx_article AS a WHERE a.department_id = d.department_id  ` + condition + ` )) AS collect_num
 		FROM
 			cygx_article_department AS d 
 		WHERE

+ 3 - 0
models/report_mapping.go

@@ -14,6 +14,7 @@ type ReportMapping struct {
 	IsRed               bool   `description:"是否标红"`
 	PermissionType      int    `description:"1主观,2客观"`
 	PolymerizationId    string `description:"分类聚合ID"`
+	CeLueFieldId        string `description:"策略平台领域ID"`
 }
 
 type ReportMappingHome struct {
@@ -105,6 +106,8 @@ type IndustrialToArticleCategoryListRep struct {
 	LayoutTime             string `description:"布局时间"`
 	IndustryName           string `description:"产业名称"`
 	IndustrialManagementId int    `description:"产业D"`
+	IsShowFollowButton     bool   `description:"是否展示关注取关按钮"`
+	IsFollowButton         bool   `description:"是否关注"`
 	IndustryVideo          *MicroVideoSimpleInfo
 	List                   []*IndustrialToArticleCategoryRep
 }

+ 1 - 0
models/tactics.go

@@ -83,6 +83,7 @@ type Tactics2 struct {
 	File            string    `description:"Pdf下载链接"`
 	TypeName        string    `description:"策略平台报告类型"`
 	UpdateDate      string    `description:"策略平台报告更新时间"`
+	CeLueFieldId    int       `description:"策略平台领域ID"`
 }
 
 func GetTacticsList2(endDate string) (list []*Tactics2, err error) {

+ 33 - 6
routers/commentsRouter.go

@@ -108,8 +108,8 @@ func init() {
 
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivityCoAntroller"],
         beego.ControllerComments{
-            Method: "ActivityList",
-            Router: `/list`,
+            Method: "ActivityListNew",
+            Router: `/listNew`,
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -117,8 +117,8 @@ func init() {
 
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivityCoAntroller"],
         beego.ControllerComments{
-            Method: "ActivityListNew",
-            Router: `/listNew`,
+            Method: "ActivityListSearch",
+            Router: `/listSearch`,
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -126,8 +126,8 @@ func init() {
 
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivityCoAntroller"],
         beego.ControllerComments{
-            Method: "ActivityListSearch",
-            Router: `/listSearch`,
+            Method: "ActivityList",
+            Router: `/list_del_test`,
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,
@@ -709,6 +709,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:IndustryController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:IndustryController"],
+        beego.ControllerComments{
+            Method: "Fllow",
+            Router: `/follow`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MicroRoadShowController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MicroRoadShowController"],
         beego.ControllerComments{
             Method: "Collect",
@@ -1024,6 +1033,24 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"],
+        beego.ControllerComments{
+            Method: "ArticleNewList",
+            Router: `/article/newList`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"],
+        beego.ControllerComments{
+            Method: "ArticleType",
+            Router: `/article/typeList`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"],
         beego.ControllerComments{
             Method: "CollectionList",

+ 5 - 0
routers/router.go

@@ -134,6 +134,11 @@ func init() {
 				&controllers.ActivitySpecialCoAntroller{},
 			),
 		),
+		web.NSNamespace("/industry",
+			web.NSInclude(
+				&controllers.IndustryController{},
+			),
+		),
 	)
 	web.AddNamespace(ns)
 }

+ 69 - 0
services/activity.go

@@ -12,6 +12,7 @@ import (
 	"strconv"
 	"strings"
 	"time"
+	"unicode/utf8"
 )
 
 // 修改活动状态
@@ -1828,3 +1829,71 @@ func ActivityVideoUserRmind(user *models.WxUserItem, activityId, fileType int) (
 	}
 	return
 }
+
+// 解析活动填写的报告链接
+func GetActivityReportLinkToArticleList(item *models.ActivityDetail) (items []*models.ActivityArticleResp, err error) {
+	reportLink := item.ReportLink
+	//处理活动的
+	var articleIds []int
+	var articleList []string
+	if strings.Contains(reportLink, ";") {
+		articleList = strings.Split(reportLink, ";")
+	} else {
+		articleList = strings.Split(reportLink, ";")
+	}
+	for _, v := range articleList {
+		linkList := strings.Split(v, "/")
+		if linkList[len(linkList)-1] != "" {
+			linkArticleId, _ := strconv.Atoi(linkList[len(linkList)-1])
+			articleIds = append(articleIds, linkArticleId)
+		}
+	}
+
+	lenarticleIds := len(articleIds)
+	if lenarticleIds == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	pars = make([]interface{}, 0)
+	condition = ` AND a.article_id IN (` + utils.GetOrmInReplace(lenarticleIds) + `)`
+	pars = append(pars, articleIds)
+
+	listArticle, e := models.GetHomeList(condition, pars, 0, len(articleIds))
+	if e != nil {
+		err = errors.New("GetResourceDataList, Err: " + e.Error())
+		return
+	}
+	if len(listArticle) > 0 {
+		for _, v := range listArticle {
+			artItem := new(models.ActivityArticleResp)
+			artItem.ArticleId = v.ArticleId
+			artItem.Title = v.Title
+			items = append(items, artItem)
+		}
+	}
+	return
+}
+
+// GetActivityCityResp 获取活动关联城市,当同一个活动标签对应多个城市的时候,展示最近举办的活动
+func GetActivityCityResp() (mapItem map[string]string, err error) {
+	activityList, err := models.GetActivityLabelListCity()
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	mapActivityCity := make(map[string]string)
+	if len(activityList) > 0 {
+		for _, v := range activityList {
+			if v.ActivityTypeId == utils.C_CLASS_ACTIVITY_TYPE_ID {
+				v.ActivityTypeId = utils.ANALYST_TELL_ACTIVITY_TYPE_ID
+			}
+			//如果城市民称长度大于2,那么就不显示
+			if utf8.RuneCountInString(v.City) != 2 || mapActivityCity[fmt.Sprint(v.Label, "{|}", v.ActivityTypeId)] != "" {
+				continue
+			}
+			mapActivityCity[fmt.Sprint(v.Label, "{|}", v.ActivityTypeId)] = v.City
+		}
+	}
+	mapItem = mapActivityCity
+	return
+}

+ 3 - 0
services/article.go

@@ -800,6 +800,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 		item.FieldName = articleResult.Field.Name
 		item.TypeName = articleResult.Type.Name
 		item.UpdateDate = articleResult.UpdateDate
+		item.CeLueFieldId = articleResult.Field.Id
 		list = append(list, item)
 		itemAuthor.ArticleId = articleResult.ArticleId
 		itemAuthor.Name = articleResult.Author.Name
@@ -985,6 +986,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 			updateParams["Annotation"] = v.Annotation
 			updateParams["TypeName"] = v.TypeName
 			updateParams["ModifyTimeByCl"] = v.UpdateDate
+			updateParams["CeLueFieldId"] = v.CeLueFieldId
 			whereParam := map[string]interface{}{"article_id": v.ArticleId}
 			err = models.UpdateByExpr(models.CygxArticle{}, whereParam, updateParams)
 			if err != nil {
@@ -1027,6 +1029,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 			item.Annotation = v.Annotation
 			item.TypeName = v.TypeName
 			item.ModifyTimeByCl = v.UpdateDate
+			item.CeLueFieldId = v.CeLueFieldId
 			newId, err := models.AddCygxArticles(item)
 			if err != nil {
 				fmt.Println("AddCygxArticle Err:", err.Error())

+ 19 - 1
services/config.go

@@ -1,11 +1,13 @@
 package services
 
 import (
+	"errors"
 	"fmt"
 	"hongze/hongze_cygx/models"
+	"strconv"
 )
 
-//是否展示限免标签
+// 是否展示限免标签
 func GetShowSustainable() (isShowSustainable bool) {
 	total, err := models.GetShowSustainable()
 	if err != nil {
@@ -29,3 +31,19 @@ func GetShowSustainableNew() (isShowSustainable bool, err error) {
 	}
 	return
 }
+
+// GetIndustryUserFollowMap 获取用户关注的产业
+func GetIndustryUserFollowMap(user *models.WxUserItem) (itemMap map[int]bool, err error) {
+	condition := ` AND  user_id = ` + strconv.Itoa(user.UserId)
+	listIndustryFllow, e := models.GetCygxIndustryFllowListByUserId(condition)
+	if e != nil {
+		err = errors.New("GetCygxIndustryFllowList  " + e.Error())
+		return
+	}
+	follwMap := make(map[int]bool)
+	for _, v := range listIndustryFllow {
+		follwMap[v.IndustrialManagementId] = true
+	}
+	itemMap = follwMap
+	return
+}

+ 95 - 11
services/industrial_management.go

@@ -11,7 +11,7 @@ import (
 	"time"
 )
 
-//修改标签状态
+// 修改标签状态
 func UpdateIndustrialManagementLabel(cont context.Context) (err error) {
 	defer func() {
 		if err != nil {
@@ -41,7 +41,7 @@ func UpdateIndustrialManagementLabel(cont context.Context) (err error) {
 	return
 }
 
-//修改活动状态
+// 修改活动状态
 func UpdateIndustrialManagementSubjectNnames() (err error) {
 	defer func() {
 		if err != nil {
@@ -108,7 +108,7 @@ func ReportBillboardUpdate(cont context.Context) (err error) {
 	return
 }
 
-//修改产业关注数量
+// 修改产业关注数量
 func IndustryFllowCountUpdate() (err error) {
 	defer func() {
 		if err != nil {
@@ -129,7 +129,7 @@ func IndustryFllowCountUpdate() (err error) {
 	return err
 }
 
-//修改文章收藏数量
+// 修改文章收藏数量
 func ArticleCollectCountUpdate() (err error) {
 	defer func() {
 		if err != nil {
@@ -150,7 +150,7 @@ func ArticleCollectCountUpdate() (err error) {
 	return err
 }
 
-//根据行业处理所选的全部赛道字段
+// 根据行业处理所选的全部赛道字段
 func DoXzsChooseSend(chartPermissionName string) string {
 	var allIn string
 	if chartPermissionName == utils.YI_YAO_NAME {
@@ -167,7 +167,7 @@ func DoXzsChooseSend(chartPermissionName string) string {
 	return allIn
 }
 
-//行业关注或者取消关注的时候,对于用户全部赛道的影响
+// 行业关注或者取消关注的时候,对于用户全部赛道的影响
 func IndustryFllowWithTrack(industrialManagementId, count, uid int) (err error) {
 	defer func() {
 		if err != nil {
@@ -272,7 +272,7 @@ func GetIndustryNewLabelMap(industryIds []int) (labelMap map[int]bool, err error
 //	GetIndustrialManagementArticleNewPublishData()
 //}
 
-//批量修改获取产业关联文章的最新发布时间
+// 批量修改获取产业关联文章的最新发布时间
 func GetIndustrialManagementArticleNewPublishData() (err error) {
 	defer func() {
 		if err != nil {
@@ -309,7 +309,7 @@ func GetIndustrialManagementArticleNewPublishData() (err error) {
 	return
 }
 
-//HandleIndustryList预处理产业列表字段
+// HandleIndustryList预处理产业列表字段
 func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUserItem) (items []*models.IndustrialManagement, err error) {
 	userId := user.UserId
 	fllowList, err := models.GetUserFllowIndustrialList(userId)
@@ -432,11 +432,11 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 	industrialIdMap := make(map[string]time.Time)
 	for _, v := range recrodList {
 		industrialManagementIdstr = strings.TrimLeft(v.Parameter, "PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=")
-		if createTime, ok := industrialIdMap[industrialManagementIdstr]; ok{
+		if createTime, ok := industrialIdMap[industrialManagementIdstr]; ok {
 			if createTime.Before(v.CreateTime) {
 				industrialIdMap[industrialManagementIdstr] = v.CreateTime
 			}
-		}else {
+		} else {
 			industrialIdMap[industrialManagementIdstr] = v.CreateTime
 		}
 	}
@@ -452,7 +452,7 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 	timeLineRedMap := make(map[int]bool, 0)
 
 	for _, industrialId := range industrialIdArr {
-		if createTime, ok := industrialIdMap[strconv.Itoa(industrialId)]; ok{
+		if createTime, ok := industrialIdMap[strconv.Itoa(industrialId)]; ok {
 			if createTime.Before(morningMeetingTimeMap[industrialId]) {
 				timeLineRedMap[industrialId] = true
 			}
@@ -505,3 +505,87 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 	items = list
 	return
 }
+
+// 通过文章ID获取文章所关联的产业
+func GetArticleIndustrialByArticleId(articleIds []int) (itemMap map[int][]*models.IndustrialManagementResp, err error) {
+	lenarticleIds := len(articleIds)
+	if lenarticleIds == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND mg.article_id IN (` + utils.GetOrmInReplace(lenarticleIds) + `)`
+	pars = append(pars, articleIds)
+	industrialList, err := models.GetIndustrialListByarticleId(pars, condition)
+	if err != nil {
+		return
+	}
+	industrialMap := make(map[int][]*models.IndustrialManagementResp)
+	if len(industrialList) > 0 {
+		for _, v := range industrialList {
+			item := new(models.IndustrialManagementResp)
+			item.IndustrialManagementId = v.IndustrialManagementId
+			item.IndustryName = v.IndustryName
+			item.ChartPermissionId = v.ChartPermissionId
+			industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
+		}
+	}
+	itemMap = industrialMap
+	return
+}
+
+func GetArticleTypeMap() (nameMapResp map[int]string, buttonStyleMapResp map[int]string, err error) {
+	condition := " AND is_show_yanx  = 1 "
+	list, e := models.GetCygxArticleTypeListCondition(condition)
+	if e != nil {
+		err = errors.New("报告最早发布时间有误,GetindustryVideo " + e.Error())
+		return
+	}
+	nameMap := make(map[int]string)
+	buttonStyleMap := make(map[int]string)
+	if len(list) > 0 {
+		for _, v := range list {
+			nameMap[v.ArticleTypeId] = v.ArticleTypeName
+			buttonStyleMap[v.ArticleTypeId] = v.ButtonStyle
+		}
+	}
+	nameMapResp = nameMap
+	buttonStyleMapResp = buttonStyleMap
+	return
+}
+
+// IndustrialManagementHotMapGropuPermission获取近一个月报告阅读数量最多的产业信息 根据行业分组
+func IndustrialManagementHotMapGropuPermission() (mapResp map[int]bool, err error) {
+	var topCond string
+	var topPars []interface{}
+	toplist, err := models.GetTopOneMonthArtReadNumIndustryAll(topCond, topPars)
+	if err != nil {
+		return
+	}
+	mapPermission := make(map[int][]*models.IndustrialManagement)
+	mapPermissionMax := make(map[int]int)
+
+	for _, v := range toplist {
+		item := new(models.IndustrialManagement)
+		item.ChartPermissionId = v.ChartPermissionId
+		item.IndustrialManagementId = v.IndustrialManagementId
+		item.ArticleReadNum = v.ArticleReadNum
+		mapPermission[v.ChartPermissionId] = append(mapPermission[v.ChartPermissionId], item)
+	}
+	for k, v := range mapPermission {
+		for _, item := range v {
+			//mapPermissionMax[k] = item.ArticleReadNum
+			if item.ArticleReadNum > mapPermissionMax[k] {
+				mapPermissionMax[k] = item.ArticleReadNum
+			}
+		}
+	}
+
+	mapResp = make(map[int]bool, 0)
+	for _, v := range toplist {
+		if v.ArticleReadNum == mapPermissionMax[v.ChartPermissionId] {
+			mapResp[v.IndustrialManagementId] = true
+		}
+	}
+	return
+}

+ 2 - 2
services/task.go

@@ -99,8 +99,8 @@ func Task() {
 		sendWxMsgActivitySpecialTwoDays := task.NewTask("sendWxMsgActivitySpecialTwoDays", "0 0 8 * * *", SendWxMsgActivitySpecialTwoDays)
 		task.AddTask("sendWxMsgActivitySpecialTwoDays", sendWxMsgActivitySpecialTwoDays) //活动开始前两天08:00,提醒报名客户 \提醒报名客户的对口销售
 
-		sendWxMsgActivitySpecialCancel := task.NewTask("sendWxMsgActivitySpecialCancel", "0 0 8 * * *", SendWxMsgActivitySpecialCancel)
-		task.AddTask("sendWxMsgActivitySpecialCancel", sendWxMsgActivitySpecialCancel) // 线下活动前4天08:00报名人数不足7人,线上活动前3天08:00报名人数不足10人,活动自动取消发布,并推送模板消息至报名客户及对口销售
+		//sendWxMsgActivitySpecialCancel := task.NewTask("sendWxMsgActivitySpecialCancel", "0 0 8 * * *", SendWxMsgActivitySpecialCancel)
+		//task.AddTask("sendWxMsgActivitySpecialCancel", sendWxMsgActivitySpecialCancel) // 线下活动前4天08:00报名人数不足7人,线上活动前3天08:00报名人数不足10人,活动自动取消发布,并推送模板消息至报名客户及对口销售
 
 	}
 	if utils.RunMode != "release" {

+ 15 - 15
services/wx_template_msg.go

@@ -51,7 +51,7 @@ func SendWxMsgWithFrequency(first, activityName, reserveResults, activityTime, a
 	return
 }
 
-//发送报告提问消息提醒
+// 发送报告提问消息提醒
 func SendWxMsgWithAsk(name, askTime, askMsg, title string, openIdList []*models.OpenIdList, articleId int) (err error) {
 	var msg string
 	defer func() {
@@ -127,7 +127,7 @@ func SendWxMsgWithAsk(name, askTime, askMsg, title string, openIdList []*models.
 	return
 }
 
-//到期提醒模板消息
+// 到期提醒模板消息
 func SendWxMsgWithCompanyRemind(first, keyword1, keyword2, remark string, openIdList []*models.OpenIdList) (err error) {
 	var msg string
 	defer func() {
@@ -165,7 +165,7 @@ func SendWxMsgWithCompanyRemind(first, keyword1, keyword2, remark string, openId
 	return
 }
 
-//发送报告提问消息提醒
+// 发送报告提问消息提醒
 func SendWxMsgWithArticleClassToAdmin(keyWord1, keyWord2, keyWord3, keyWord4 string, openIdList []*models.OpenIdList, articleId int) (err error) {
 	var msg string
 	defer func() {
@@ -207,7 +207,7 @@ func SendWxMsgWithArticleClassToAdmin(keyWord1, keyWord2, keyWord3, keyWord4 str
 	return
 }
 
-//发送用户阅读报告消息提醒
+// 发送用户阅读报告消息提醒
 func SendWxMsgWithArticleUserRemind(keyWord1, keyWord2 string, openIdList []*models.OpenIdList, articleId int) (err error) {
 	var msg string
 	defer func() {
@@ -245,7 +245,7 @@ func SendWxMsgWithArticleUserRemind(keyWord1, keyWord2 string, openIdList []*mod
 	return
 }
 
-//发送用户操作活动消息提醒
+// 发送用户操作活动消息提醒
 func SendWxMsgWithActivityUserRemind(keyWord1, keyWord2 string, openIdList []*models.OpenIdList, activityId int) (err error) {
 	var msg string
 	defer func() {
@@ -280,7 +280,7 @@ func SendWxMsgWithActivityUserRemind(keyWord1, keyWord2 string, openIdList []*mo
 	return
 }
 
-//发送用户操作专项调研活动消息提醒
+// 发送用户操作专项调研活动消息提醒
 func SendWxMsgWithSpecialActivityUserRemind(keyWord1, keyWord2 string, openIdList []*models.OpenIdList, activityId int) (err error) {
 	var msg string
 	defer func() {
@@ -315,7 +315,7 @@ func SendWxMsgWithSpecialActivityUserRemind(keyWord1, keyWord2 string, openIdLis
 	return
 }
 
-//活动带问提醒
+// 活动带问提醒
 func SendActivityAskApplyTemplateMsg(applyName, applyTime, askContent, activityName string, activityId int, itemOpenid *models.OpenIdList) (err error) {
 	var msg string
 	defer func() {
@@ -381,7 +381,7 @@ func SendActivityAskApplyTemplateMsg(applyName, applyTime, askContent, activityN
 	return
 }
 
-//活动带问提醒
+// 活动带问提醒
 func SendActivityAskApplyTemplateMsgV2(keyword1, keyword2, keyword3, keyword4, remark string, itemOpenid *models.OpenIdList, itemAct *models.ActivityDetail) (err error) {
 	var msg string
 	defer func() {
@@ -450,7 +450,7 @@ func SendActivityAskApplyTemplateMsgV2(keyword1, keyword2, keyword3, keyword4, r
 	return
 }
 
-//专项产业调研模板消息推送
+// 专项产业调研模板消息推送
 func SendSpecialTemplateMsg(applyName, applyTime, mobile, activityName, resource string, itemOpenid *models.OpenIdList) (err error) {
 	var msg string
 	defer func() {
@@ -586,7 +586,7 @@ func SendTemplateMsg(sendUrl string, data []byte, resource string, sendType int,
 	return
 }
 
-//发送报告更新的消息给预约的用户
+// 发送报告更新的消息给预约的用户
 func SendWxMsgWithArticleUpdate(first, keyWord1, keyWord2, keyWord3, keyWord4 string, item *models.OpenIdList, articleId int) (err error) {
 	var msg string
 	defer func() {
@@ -612,7 +612,7 @@ func SendWxMsgWithArticleUpdate(first, keyWord1, keyWord2, keyWord3, keyWord4 st
 	sendMap := make(map[string]interface{})
 	sendData := make(map[string]interface{})
 	sendMap["template_id"] = templateId
-	sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId, "pagepath": "pageMy/reportDetail/reportDetail?id=" + strconv.Itoa(articleId)}
+	sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId, "pagepath": "pageMy/reportDetail/reportDetail?id=" + strconv.Itoa(articleId) + "&IsSendWx=1"}
 	sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"}
 	sendData["keyword1"] = map[string]interface{}{"value": keyWord1, "color": "#173177"}
 	sendData["keyword2"] = map[string]interface{}{"value": keyWord2, "color": "#173177"}
@@ -624,7 +624,7 @@ func SendWxMsgWithArticleUpdate(first, keyWord1, keyWord2, keyWord3, keyWord4 st
 	return
 }
 
-//周日下午4点半,推送全部活动
+// 周日下午4点半,推送全部活动
 func SendActivityOnenIdWxTemplateMsg(first, keyWord1, keyWord2, keyWord3, keyWord4 string, openIdList []*models.OpenIdList) (err error) {
 	var msg string
 	defer func() {
@@ -663,8 +663,8 @@ func SendActivityOnenIdWxTemplateMsg(first, keyWord1, keyWord2, keyWord3, keyWor
 	return
 }
 
-//发送用户留言提醒
-//func SendCommentWxTemplateMsg(title, companyName, userName, sellerName, createTime, content string, openIdList []*models.OpenIdList, articleId int) (err error) {
+// 发送用户留言提醒
+// func SendCommentWxTemplateMsg(title, companyName, userName, sellerName, createTime, content string, openIdList []*models.OpenIdList, articleId int) (err error) {
 func SendCommentWxTemplateMsg(req models.AddCygxArticleCommentReq, user *models.WxUserItem, articleInfo *models.ArticleDetail) (err error) {
 	var msg string
 	defer func() {
@@ -762,7 +762,7 @@ func SendCommentWxTemplateMsg(req models.AddCygxArticleCommentReq, user *models.
 	return
 }
 
-//微路演新增留言提问消息提醒
+// 微路演新增留言提问消息提醒
 func SendWxMsgWithMicroRoadshowAsk(req models.AddVideoCommnetReq, user *models.WxUserItem, resourceId int) (err error) {
 	var msg string
 	defer func() {

+ 100 - 0
services/yan_xuan.go

@@ -0,0 +1,100 @@
+package services
+
+import (
+	"errors"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"strconv"
+	"strings"
+)
+
+// 获取研选类型的文章分类Id
+func GetYanXuanArticleTypeIds() (articleTypeIds string, err error) {
+	var condition string
+	condition = " AND is_show_yanx  = 1 "
+	listType, e := models.GetCygxArticleTypeListCondition(condition)
+	if e != nil {
+		err = errors.New("GetCygxArticleTypeListCondition, Err: " + e.Error())
+		return
+	}
+	for _, v := range listType {
+		articleTypeIds += strconv.Itoa(v.ArticleTypeId) + ","
+	}
+	articleTypeIds = strings.TrimRight(articleTypeIds, ",")
+	if articleTypeIds == "" {
+		err = errors.New("研选分类ID不能为空")
+		return
+	}
+	return
+}
+
+// 处理研选关联的新标签
+func GetYanXuanIndustrialManagementIdNewMap(articleTypeIds string) (respMap map[int]bool, err error) {
+	var condition string
+	if articleTypeIds == "" {
+		return
+	}
+	condition = ` AND a.article_type_id IN (` + articleTypeIds + `)  `
+	list, e := models.GetIndustrialManagementNewList(condition)
+	if e != nil {
+		err = errors.New("GetIndustrialManagementNewList, Err: " + e.Error())
+		return
+	}
+	newMap := make(map[int]bool)
+	for _, v := range list {
+		newMap[v.IndustrialManagementId] = true
+	}
+	respMap = newMap
+	return
+}
+
+// 处理研选关联的hot标签
+func GetYanXuanIndustrialManagementIdHotMap(articleTypeIds string) (respMap map[int]bool, err error) {
+	var condition string
+	var conditionOrder string
+	if articleTypeIds == "" {
+		return
+	}
+	condition = ` AND a.article_type_id IN (` + articleTypeIds + `)  `
+	conditionOrder = ` ORDER BY sum_num DESC `
+	listHot, e := models.GetThemeHeatList(0, condition, conditionOrder, 0, 3)
+	if e != nil {
+		err = errors.New("GetIndustrialManagementNewList, Err: " + e.Error())
+		return
+	}
+	hotMap := make(map[int]bool)
+	for _, v := range listHot {
+		hotMap[v.IndustrialManagementId] = true
+	}
+	respMap = hotMap
+	return
+}
+
+// GetArticleSubjectName 获取文章关联的多个标的名称
+func GetArticleSubjectName(articleIds []int) (respMap, subjectMap map[int]string, err error) {
+	lenarticleIds := len(articleIds)
+	if lenarticleIds == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND ag.article_id IN (` + utils.GetOrmInReplace(len(articleIds)) + `)`
+	pars = append(pars, articleIds)
+	list, e := models.GetSubjectArticlGroupList(condition, pars)
+	if e != nil {
+		err = errors.New("GetIndustrialManagementNewList, Err: " + e.Error())
+		return
+	}
+	artMap := make(map[int]string)
+	subMap := make(map[int]string)
+	for _, v := range list {
+		artMap[v.ArticleId] += v.SubjectName + "/"
+		subMap[v.IndustrialSubjectId] = v.SubjectName
+	}
+	for _, v := range list {
+		artMap[v.ArticleId] = strings.TrimRight(artMap[v.ArticleId], "/")
+	}
+	respMap = artMap
+	subjectMap = subMap
+	return
+}

+ 2 - 1
utils/constants.go

@@ -107,7 +107,8 @@ const (
 )
 
 const (
-	YAN_XUAN__EXPLAIN = "买方研选内容实行阶段,限时免费。也欢迎您向我们提宝贵建议。"
+	YAN_XUAN_EXPLAIN = "买方研选内容实行阶段,限时免费。也欢迎您向我们提宝贵建议。"
+	YAN_XUAN_TAB_KEY = "yanxuan_header_tab"
 )
 
 const (