Browse Source

no message

xingzai 1 year ago
parent
commit
b86f760832
5 changed files with 169 additions and 332 deletions
  1. 0 240
      controllers/home.go
  2. 4 0
      controllers/tag.go
  3. 14 17
      models/cygx_tag.go
  4. 146 71
      services/tag.go
  5. 5 4
      utils/constants.go

+ 0 - 240
controllers/home.go

@@ -627,210 +627,6 @@ func (this *HomeController) NewList() {
 		return
 	}
 
-	//var articleTypes, activityTypes, industries, subjectNames string
-	//articleTypeCondSlice := make([]string, 0)
-	//activityTypesCondSlice := make([]string, 0)
-	//industriesCondSlice := make([]string, 0)
-	//subjectNamesSlice := make([]string, 0)
-	//articleTypeSlice := make([]string, 0)
-	//if tagIds != "" {
-	//	tags := strings.Split(tagIds, ",")
-	//	for _, tagIdStr := range tags {
-	//		tagId, err := strconv.Atoi(tagIdStr)
-	//		if err != nil {
-	//			br.Msg = "转换失败"
-	//			br.ErrMsg = "tagid转换失败,Err:" + err.Error()
-	//			return
-	//		}
-	//		tagInfo, err := models.GetCygxTagByTagId(tagId)
-	//		if err != nil && err.Error() != utils.ErrNoRow() {
-	//			br.Msg = "获取失败"
-	//			br.ErrMsg = "GetCygxTagByTagId,Err:" + err.Error()
-	//			return
-	//		}
-	//		// 只有AB或CD的情况
-	//		if (tagInfo.ActivityTypes == "" && tagInfo.ArticleTypes == "") || (tagInfo.Industries == "" && tagInfo.SubjectNames == "") {
-	//			if tagInfo.ActivityTypes != "" {
-	//				activityTypes += tagInfo.ActivityTypes + ","
-	//			}
-	//			if tagInfo.ArticleTypes != "" {
-	//				articleTypes += tagInfo.ArticleTypes + ","
-	//			}
-	//			if tagInfo.Industries != "" {
-	//				industries += tagInfo.Industries + ","
-	//			}
-	//			if tagInfo.SubjectNames != "" {
-	//				subjectNames += tagInfo.SubjectNames + ","
-	//			}
-	//		} else {
-	//			// ABCD都有的情况
-	//			// 每一个tag都单独处理
-	//			var articleType, activityType, industry, subjectName string
-	//
-	//			if tagInfo.ActivityTypes != "" {
-	//				activityType = tagInfo.ActivityTypes
-	//			}
-	//			if tagInfo.ArticleTypes != "" {
-	//				articleType = tagInfo.ArticleTypes
-	//			}
-	//			if tagInfo.Industries != "" {
-	//				industry = tagInfo.Industries
-	//			}
-	//			if tagInfo.SubjectNames != "" {
-	//				subjectName = tagInfo.SubjectNames
-	//			}
-	//			articleTypeCond := ``
-	//			var articleTypeStr string
-	//			if articleType != "" {
-	//				articleTypeSlice := strings.Split(articleType, ",")
-	//				newArticleTypeSlice := make([]string, 0)
-	//				for _, s := range articleTypeSlice {
-	//					newArticleTypeSlice = append(newArticleTypeSlice, "'"+s+"'")
-	//				}
-	//				articleTypeStr = strings.Join(newArticleTypeSlice, ",")
-	//				articleTypeStr = strings.TrimRight(articleTypeStr, ",")
-	//				articleTypeCond += ` AND (art.sub_category_name In (` + articleTypeStr + `) OR (art.article_type_name In (` + articleTypeStr + `) AND art.article_type_name <> '路演精华' AND art.article_type_id <> 0 ) ) `
-	//			}
-	//			activityTypesCond := ``
-	//			if activityType != "" {
-	//				activityTypeSlice := strings.Split(activityType, ",")
-	//				newActivityTypeSlice := make([]string, 0)
-	//				for _, s := range activityTypeSlice {
-	//					newActivityTypeSlice = append(newActivityTypeSlice, "'"+s+"'")
-	//				}
-	//				activityTypeStr := strings.Join(newActivityTypeSlice, ",")
-	//				activityTypeStr = strings.TrimRight(activityTypeStr, ",")
-	//				activityTypesCond += ` AND act.activity_type_name In (` + activityTypeStr + `) `
-	//			}
-	//			industriesCond := ``
-	//			var industryStr string
-	//			if industry != "" {
-	//				industrieSlice := strings.Split(industry, ",")
-	//				newIndustrieSlice := make([]string, 0)
-	//				for _, s := range industrieSlice {
-	//					newIndustrieSlice = append(newIndustrieSlice, "'"+s+"'")
-	//				}
-	//				industryStr = strings.Join(newIndustrieSlice, ",")
-	//				industryStr = strings.TrimRight(industryStr, ",")
-	//				industriesCond += ` AND im.industry_name In (` + industryStr + `) `
-	//			}
-	//			subjectNamesCond := ``
-	//			var subjectNameStr string
-	//			if subjectName != "" {
-	//				subjectNameSlice := strings.Split(subjectName, ",")
-	//				newSubjectNameSlice := make([]string, 0)
-	//				for _, s := range subjectNameSlice {
-	//					newSubjectNameSlice = append(newSubjectNameSlice, "'"+s+"'")
-	//				}
-	//				subjectNameStr = strings.Join(newSubjectNameSlice, ",")
-	//				subjectNameStr = strings.TrimRight(subjectNameStr, ",")
-	//				subjectNamesCond += ` AND cis.subject_name In (` + subjectNameStr + `) `
-	//			}
-	//			articleTypeCondSlice = append(articleTypeCondSlice, articleTypeCond)
-	//			activityTypesCondSlice = append(activityTypesCondSlice, activityTypesCond)
-	//			industriesCondSlice = append(industriesCondSlice, industryStr)
-	//			subjectNamesSlice = append(subjectNamesSlice, subjectNameStr)
-	//			articleTypeSlice = append(articleTypeSlice, articleType)
-	//		}
-	//
-	//	}
-	//}
-	//
-	//// 先拿abdc都有的tag取合集的ids。。。
-	//soloTagArticleIds, soloTagActivityIds, soloMmIds, err := models.GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityTypesCondSlice, industriesCondSlice, subjectNamesSlice, articleTypeSlice)
-	//if err != nil && err.Error() != utils.ErrNoRow() {
-	//	br.Msg = "获取失败"
-	//	br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
-	//	return
-	//}
-	//
-	//articleTypes = strings.TrimRight(articleTypes, ",")
-	//activityTypes = strings.TrimRight(activityTypes, ",")
-	//industries = strings.TrimRight(industries, ",")
-	//subjectNames = strings.TrimRight(subjectNames, ",")
-	//
-	//articleTypesCond := ``
-	//var articleTypeStr string
-	//if articleTypes != "" {
-	//	articleTypeSlice := strings.Split(articleTypes, ",")
-	//	newArticleTypeSlice := make([]string, 0)
-	//	for _, s := range articleTypeSlice {
-	//		newArticleTypeSlice = append(newArticleTypeSlice, "'"+s+"'")
-	//	}
-	//	articleTypeStr = strings.Join(newArticleTypeSlice, ",")
-	//	articleTypeStr = strings.TrimRight(articleTypeStr, ",")
-	//	articleTypesCond += ` AND (art.sub_category_name In (` + articleTypeStr + `) OR (art.article_type_name In (` + articleTypeStr + `) AND art.article_type_name <> '路演精华' AND art.article_type_id <> 0 ) ) `
-	//}
-	//activityTypesCond := ``
-	//if activityTypes != "" {
-	//	activityTypeSlice := strings.Split(activityTypes, ",")
-	//	newActivityTypeSlice := make([]string, 0)
-	//	for _, s := range activityTypeSlice {
-	//		newActivityTypeSlice = append(newActivityTypeSlice, "'"+s+"'")
-	//	}
-	//	activityTypeStr := strings.Join(newActivityTypeSlice, ",")
-	//	activityTypeStr = strings.TrimRight(activityTypeStr, ",")
-	//	activityTypesCond += ` AND act.activity_type_name In (` + activityTypeStr + `) `
-	//}
-	//industriesCond := ``
-	//var industryStr string
-	//if industries != "" {
-	//	industrieSlice := strings.Split(industries, ",")
-	//	newIndustrieSlice := make([]string, 0)
-	//	for _, s := range industrieSlice {
-	//		newIndustrieSlice = append(newIndustrieSlice, "'"+s+"'")
-	//	}
-	//	industryStr = strings.Join(newIndustrieSlice, ",")
-	//	industryStr = strings.TrimRight(industryStr, ",")
-	//	industriesCond += ` AND im.industry_name In (` + industryStr + `) `
-	//}
-	//subjectNamesCond := ``
-	//var subjectNameStr string
-	//if subjectNames != "" {
-	//	subjectNameSlice := strings.Split(subjectNames, ",")
-	//	newSubjectNameSlice := make([]string, 0)
-	//	for _, s := range subjectNameSlice {
-	//		newSubjectNameSlice = append(newSubjectNameSlice, "'"+s+"'")
-	//	}
-	//	subjectNameStr = strings.Join(newSubjectNameSlice, ",")
-	//	subjectNameStr = strings.TrimRight(subjectNameStr, ",")
-	//	subjectNamesCond += ` AND cis.subject_name In (` + subjectNameStr + `) `
-	//}
-	//
-	//var tagArticleIds, tagActivityIds, mmIds string
-	//if articleTypesCond != "" || activityTypesCond != "" || industryStr != "" || subjectNameStr != "" {
-	//	tagArticleIds, tagActivityIds, mmIds, err = models.GetCygxCygxArticleListByCondition(articleTypesCond, activityTypesCond, industryStr, subjectNameStr, articleTypeStr)
-	//	if err != nil && err.Error() != utils.ErrNoRow() {
-	//		br.Msg = "获取失败"
-	//		br.ErrMsg = "获取单个标签ids失败,Err:" + err.Error()
-	//		return
-	//	}
-	//}
-	//
-	//if soloTagArticleIds != "" {
-	//	if tagArticleIds != "" {
-	//		tagArticleIds += "," + soloTagArticleIds
-	//	} else {
-	//		tagArticleIds = soloTagArticleIds
-	//	}
-	//}
-	//if soloTagActivityIds != "" {
-	//	if tagActivityIds != "" {
-	//		tagActivityIds += "," + soloTagActivityIds
-	//	} else {
-	//		tagActivityIds = soloTagActivityIds
-	//	}
-	//}
-	//if soloMmIds != "" {
-	//	if mmIds != "" {
-	//		mmIds += "," + soloMmIds
-	//	} else {
-	//		mmIds = soloMmIds
-	//	}
-	//}
-
-	//fmt.Println("condition:",condition)
-
 	if tagIds != "" {
 		conditionTagIdsInit, err := services.GetConditionInitByTagIds(tagIds)
 		if err != nil {
@@ -911,38 +707,6 @@ func (this *HomeController) NewList() {
 		}
 		lenActivityspecialIds := len(activityspecialIds)
 
-		//if tagIds != "" {
-		//	if tagArticleIds != "" {
-		//		condition = ` AND ((source = 'article' AND source_id IN (` + tagArticleIds + `) ) `
-		//		if mmIds != "" {
-		//			condition += ` OR ( source = 'meetingreviewchapt' AND source_id IN (` + mmIds + `) )   `
-		//		}
-		//		if tagActivityIds != "" && lenActivityIds > 0 {
-		//			condition += ` OR (source = 'activity' AND source_id IN (` + tagActivityIds + `) AND source_id IN (` + utils.GetOrmInReplace(lenActivityIds) + `) )) `
-		//			pars = append(pars, activityIds)
-		//		} else {
-		//			// 无可见活动
-		//			condition += ` OR (source = 'activity' AND source_id IN (0))) `
-		//		}
-		//	} else if tagActivityIds != "" {
-		//		condition = ` AND ((source = 'article' AND source_id IN (0))  `
-		//		if mmIds != "" {
-		//			condition += ` OR ( source = 'meetingreviewchapt' AND source_id IN (` + mmIds + `) )   `
-		//		}
-		//		if tagActivityIds != "" && lenActivityIds > 0 {
-		//			condition += ` OR (source = 'activity' AND source_id IN (` + tagActivityIds + `) AND source_id IN (` + utils.GetOrmInReplace(lenActivityIds) + `))) `
-		//			pars = append(pars, activityIds)
-		//		} else {
-		//			// 无可见活动
-		//			condition += ` OR (source = 'activity' AND source_id IN (0))) `
-		//		}
-		//	} else if mmIds != "" {
-		//		condition = ` AND ( source = 'meetingreviewchapt' AND source_id IN (` + mmIds + `) )   `
-		//	} else {
-		//		condition += ` AND ((source = 'article' AND source_id IN (0)) OR (source = 'activity' AND source_id IN (0))) `
-		//	}
-		//}
-
 		if lenActivityIds > 0 {
 			condition += ` OR ( source = 'activity' AND source_id IN (` + utils.GetOrmInReplace(lenActivityIds) + `) ` + conditionInit + ` )    `
 			pars = append(pars, activityIds)
@@ -953,16 +717,12 @@ func (this *HomeController) NewList() {
 			pars = append(pars, activityspecialIds)
 		}
 	}
-	//fmt.Println("condition:",condition)
 	total, err := models.GetResourceDataCount(condition, pars)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
-	//if user.Mobile == "" && user.Email == "" {
-	//	total = pageSize
-	//}
 
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`

+ 4 - 0
controllers/tag.go

@@ -60,6 +60,10 @@ func (this *TagController) TagCustomizeList() {
 		if v.SubjectNames != "" {
 			v.CheckList = append(v.CheckList, "D")
 		}
+		//固定标签默认都属于,前端互斥使用
+		if v.TagType > 0 {
+			v.CheckList = []string{"A", "B", "C", "D"}
+		}
 	}
 	if err != nil {
 		br.Msg = "获取标签失败"

+ 14 - 17
models/cygx_tag.go

@@ -27,23 +27,20 @@ func (m *CygxTag) Update(cols []string) (err error) {
 }
 
 type CygxTagList struct {
-	TagId         int64  `orm:"column(tag_id);pk"`
-	TagName       string `orm:"column(tag_name);NOT NULL"`       // 标签名
-	ArticleTypes  string `orm:"column(article_types);NOT NULL"`  // 报告系列
-	ActivityTypes string `orm:"column(activity_types);NOT NULL"` // 活动类型
-	Industries    string `orm:"column(industries);NOT NULL"`     // 产业
-	SubjectNames  string `orm:"column(subject_names);NOT NULL"`  // 标的
-	Sort          int    `orm:"column(sort);"`                   // 优先级
-	ModifyTime    string `orm:"column(modify_time)"`             // 修改时间
-	CreateTime    string `orm:"column(create_time)"`             // 创建时间
-	OnlineTime    string `orm:"column(online_time)"`             // 上线时间
-	OfflineTime   string `orm:"column(offline_time)"`            // 下线时间
-	Status        int    `orm:"column(status);NOT NULL"`         // 状态:0-禁用 1-启用
-	//Atag          bool     // A标签是否有值
-	//Btag          bool     // A标签是否有值
-	//Ctag          bool     // A标签是否有值
-	//Dtag          bool     // A标签是否有值
-	CheckList []string // ABCD勾选了哪几列
+	TagId         int64    `orm:"column(tag_id);pk"`
+	TagName       string   `orm:"column(tag_name);NOT NULL"`       // 标签名
+	ArticleTypes  string   `orm:"column(article_types);NOT NULL"`  // 报告系列
+	ActivityTypes string   `orm:"column(activity_types);NOT NULL"` // 活动类型
+	Industries    string   `orm:"column(industries);NOT NULL"`     // 产业
+	SubjectNames  string   `orm:"column(subject_names);NOT NULL"`  // 标的
+	Sort          int      `orm:"column(sort);"`                   // 优先级
+	ModifyTime    string   `orm:"column(modify_time)"`             // 修改时间
+	CreateTime    string   `orm:"column(create_time)"`             // 创建时间
+	OnlineTime    string   `orm:"column(online_time)"`             // 上线时间
+	OfflineTime   string   `orm:"column(offline_time)"`            // 下线时间
+	Status        int      `orm:"column(status);NOT NULL"`         // 状态:0-禁用 1-启用
+	CheckList     []string // ABCD勾选了哪几列
+	TagType       int      `description:"1:热门活动、2:海外研究、3:路演回放、4:语音问答"`
 }
 
 type CygxTagListResp struct {

+ 146 - 71
services/tag.go

@@ -58,10 +58,11 @@ func GetConditionInitByTagIds(tagIds string) (conditionInit string, err error) {
 	pars = append(pars, tagslice)
 	listTag, e := models.GetCygxTagListCondition(condition, pars, 0, 0)
 	if e != nil {
-		err = errors.New("GetActivityListByCondition, Err: " + e.Error())
+		err = errors.New("GetCygxTagListCondition, Err: " + e.Error())
 		return
 	}
 
+	var tagType int // 定义特殊标签的类型,判断传过来的参数是否有固定标签的搜索
 	for _, tagInfo := range listTag {
 		//ActivityTypes 与 ArticleTypes 进行合并
 		if tagInfo.ActivityTypes != "" {
@@ -90,93 +91,167 @@ func GetConditionInitByTagIds(tagIds string) (conditionInit string, err error) {
 			}
 			//subjectNames = append(subjectNames, tagInfo.SubjectNames)
 		}
-	}
 
-	//拼接search_tag 搜索内容
-	if len(searchTag) > 0 {
-		//search_tag_two 兼容报告类型一对多的这种,时间不够,产品也有可能变先这么做
-		conditionInit += " AND ( search_tag IN  ('" + strings.Join(searchTag, "','") + "')  OR search_tag_two IN( '" + strings.Join(searchTag, "','") + "' )  )"
-	}
-	var resourceDataIds []int //cygx_resource_data 主键ID
-	//如果产业有组合,那么就去捞产业相关的内容
-	if len(industries) > 0 {
-		// 获取近一个月产业报告阅读次数最多的产业
-		var conditionIndustry string
-		var parsIndustry []interface{}
-		conditionIndustry += " AND industry_name IN  ('" + strings.Join(industries, "','") + "')"
-		listIndustry, e := models.GetTopOneMonthArtReadNumIndustryAll(conditionIndustry, parsIndustry)
-		if e != nil {
-			err = errors.New("GetTopOneMonthArtReadNumIndustryAll, Err: " + e.Error())
-			return
-		}
-		var industrialManagementIds []int // 产业ID合集
-		for _, v := range listIndustry {
-			industrialManagementIds = append(industrialManagementIds, v.IndustrialManagementId)
+		if tagType == 0 && tagInfo.TagType > 0 {
+			tagType = tagInfo.TagType
 		}
+	}
 
-		var conditionIndustryResource string
-		var parsIndustryResource []interface{}
-		lenArrindustrial := len(industrialManagementIds)
-		conditionIndustryResource = ` AND industrial_management_id IN (` + utils.GetOrmInReplace(lenArrindustrial) + `)`
-		parsIndustryResource = append(parsIndustryResource, industrialManagementIds)
+	switch tagType {
+	case 0: // 无固定标签
+		//拼接search_tag 搜索内容
+		if len(searchTag) > 0 {
+			//search_tag_two 兼容报告类型一对多的这种,时间不够,产品也有可能变先这么做
+			conditionInit += " AND ( search_tag IN  ('" + strings.Join(searchTag, "','") + "')  OR search_tag_two IN( '" + strings.Join(searchTag, "','") + "' )  )"
+		}
 
-		if lenArrindustrial > 0 {
-			listResourceDataIndustrial, e := models.GetCygxResourceDataIndustrialGroupManagementList(conditionIndustryResource, parsIndustryResource, 0, 0)
-			//return
+		var resourceDataIds []int //cygx_resource_data 主键ID
+		//如果产业有组合,那么就去捞产业相关的内容
+		if len(industries) > 0 {
+			var conditionIndustry string
+			var parsIndustry []interface{}
+			conditionIndustry += " AND industry_name IN  ('" + strings.Join(industries, "','") + "')"
+			listIndustry, e := models.GetTopOneMonthArtReadNumIndustryAll(conditionIndustry, parsIndustry)
 			if e != nil {
-				err = errors.New("GetCygxResourceDataIndustrialGroupManagementList, Err: " + e.Error())
+				err = errors.New("GetTopOneMonthArtReadNumIndustryAll, Err: " + e.Error())
 				return
 			}
-			for _, v := range listResourceDataIndustrial {
-				resourceDataIds = append(resourceDataIds, v.ResourceDataId)
+			var industrialManagementIds []int // 产业ID合集
+			for _, v := range listIndustry {
+				industrialManagementIds = append(industrialManagementIds, v.IndustrialManagementId)
+			}
+
+			var conditionIndustryResource string
+			var parsIndustryResource []interface{}
+			lenArrindustrial := len(industrialManagementIds)
+			conditionIndustryResource = ` AND industrial_management_id IN (` + utils.GetOrmInReplace(lenArrindustrial) + `)`
+			parsIndustryResource = append(parsIndustryResource, industrialManagementIds)
+
+			if lenArrindustrial > 0 {
+				listResourceDataIndustrial, e := models.GetCygxResourceDataIndustrialGroupManagementList(conditionIndustryResource, parsIndustryResource, 0, 0)
+				//return
+				if e != nil {
+					err = errors.New("GetCygxResourceDataIndustrialGroupManagementList, Err: " + e.Error())
+					return
+				}
+				for _, v := range listResourceDataIndustrial {
+					resourceDataIds = append(resourceDataIds, v.ResourceDataId)
+				}
 			}
 		}
-	}
-	//return
-	//如果标的有组合,那么就去捞标的相关的内容
-	if len(subjectNames) > 0 {
-		// 获取近一个月产业报告阅读次数最多的产业
-		var conditionsubject string
-		var parssubject []interface{}
-		conditionsubject += " AND subject_name IN  ('" + strings.Join(subjectNames, "','") + "')"
-		listsubject, e := models.GetCygxIndustrialSubjectListCondition(conditionsubject, parssubject)
-		if e != nil {
-			err = errors.New("GetTopOneMonthArtReadNumIndustry, Err: " + e.Error())
-			return
-		}
-		var industrialsubjectIds []int // 标的ID集合
-		for _, v := range listsubject {
-			industrialsubjectIds = append(industrialsubjectIds, v.IndustrialSubjectId)
-		}
-		var conditionsubjectResource string
-		var parssubjectResource []interface{}
-		lenArrsubject := len(industrialsubjectIds)
-		conditionsubjectResource = ` AND industrial_subject_id IN (` + utils.GetOrmInReplace(lenArrsubject) + `)`
-		parssubjectResource = append(parssubjectResource, industrialsubjectIds)
-		if lenArrsubject > 0 {
-			listResourceDatasubject, e := models.GetCygxResourceDataIndustrialGroupSubjectList(conditionsubjectResource, parssubjectResource, 0, 0)
+		//return
+		//如果标的有组合,那么就去捞标的相关的内容
+		if len(subjectNames) > 0 {
+			var conditionsubject string
+			var parssubject []interface{}
+			conditionsubject += " AND subject_name IN  ('" + strings.Join(subjectNames, "','") + "')"
+			listsubject, e := models.GetCygxIndustrialSubjectListCondition(conditionsubject, parssubject)
 			if e != nil {
-				err = errors.New("GetCygxResourceDataIndustrialGroupSubjectList, Err: " + e.Error())
+				err = errors.New("GetTopOneMonthArtReadNumIndustry, Err: " + e.Error())
 				return
 			}
-			for _, v := range listResourceDatasubject {
-				resourceDataIds = append(resourceDataIds, v.ResourceDataId)
+			var industrialsubjectIds []int // 标的ID集合
+			for _, v := range listsubject {
+				industrialsubjectIds = append(industrialsubjectIds, v.IndustrialSubjectId)
+			}
+			var conditionsubjectResource string
+			var parssubjectResource []interface{}
+			lenArrsubject := len(industrialsubjectIds)
+			conditionsubjectResource = ` AND industrial_subject_id IN (` + utils.GetOrmInReplace(lenArrsubject) + `)`
+			parssubjectResource = append(parssubjectResource, industrialsubjectIds)
+			if lenArrsubject > 0 {
+				listResourceDatasubject, e := models.GetCygxResourceDataIndustrialGroupSubjectList(conditionsubjectResource, parssubjectResource, 0, 0)
+				if e != nil {
+					err = errors.New("GetCygxResourceDataIndustrialGroupSubjectList, Err: " + e.Error())
+					return
+				}
+				for _, v := range listResourceDatasubject {
+					resourceDataIds = append(resourceDataIds, v.ResourceDataId)
+				}
 			}
 		}
-	}
 
-	//拼接 cygx_resource_data 表主键查询ID
-	if len(resourceDataIds) > 0 {
-		var resourceDataIdStrs []string
-		resourceDataIdMap := make(map[int]bool)
-		for _, v := range resourceDataIds {
-			if resourceDataIdMap[v] {
-				continue
+		//拼接 cygx_resource_data 表主键查询ID
+		if len(resourceDataIds) > 0 {
+			var resourceDataIdStrs []string
+			resourceDataIdMap := make(map[int]bool)
+			for _, v := range resourceDataIds {
+				if resourceDataIdMap[v] {
+					continue
+				}
+				resourceDataIdStrs = append(resourceDataIdStrs, strconv.Itoa(v))
+				resourceDataIdMap[v] = true
+			}
+			conditionInit += " AND id IN  (" + strings.Join(resourceDataIdStrs, ",") + ") "
+		}
+	case 1: // 热门活动
+		conf, e := models.GetConfigByCode(utils.CYGX_TAG_HOT_ACTIVITY_ID)
+		if e != nil {
+			err = errors.New("GetConfigByCode, Err: " + e.Error())
+			return
+		}
+		//主键ID赋值为0,进行空查询
+		if conf.ConfigValue == "" {
+			conditionInit += " AND id = 0  "
+			return
+		}
+		pars = make([]interface{}, 0)
+		condition = " AND activity_id IN ( " + conf.ConfigValue + ")  AND publish_status = 1   AND active_state  IN (1,2) "
+		listActivity, e := models.GetActivityListByCondition(condition, pars)
+		if e != nil {
+			err = errors.New("GetActivityListByCondition, Err: " + e.Error())
+			return
+		}
+		if len(listActivity) == 0 {
+			conditionInit += " AND id = 0  "
+			return
+		}
+
+		//拼接查询热门活动的SQL、
+		var activityIds []string
+		for _, v := range listActivity {
+			activityIds = append(activityIds, strconv.Itoa(v.ActivityId))
+		}
+		conditionInit = " AND source_id IN ( " + strings.Join(activityIds, ",") + ")  AND source = '" + utils.CYGX_OBJ_ACTIVITY + "'"
+
+	case 2: //海外研究 查询海外研究的文章,以及海外的活动
+		condition = " AND category_id IN ( SELECT category_id_celue FROM cygx_report_mapping_group WHERE id_cygx IN ( 35,39 ) ) AND publish_status = 1"
+		pars = make([]interface{}, 0)
+		articleList, e := models.GetArticleList(condition, pars)
+		if e != nil {
+			err = errors.New("GetArticleList, Err: " + e.Error())
+			return
+		}
+		//文章一定会有值,这里就不做为空判断了 。。。
+		var articleIds []string
+		for _, v := range articleList {
+			articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
+		}
+
+		//海外举办的活动查询
+		condition = " AND  area_type = 2  AND publish_status = 1   "
+		listActivity, e := models.GetActivityListByCondition(condition, pars)
+		if e != nil {
+			err = errors.New("GetActivityListByCondition, Err: " + e.Error())
+			return
+		}
+		//判断是否有海外活动,如果有就拼接,报告与活动的查询SQL
+		if len(listActivity) == 0 {
+			conditionInit = " AND source_id IN ( " + strings.Join(articleIds, ",") + ")  AND source = '" + utils.CYGX_OBJ_ARTICLE + "'"
+		} else {
+			var activityIds []string
+			for _, v := range listActivity {
+				activityIds = append(activityIds, strconv.Itoa(v.ActivityId))
 			}
-			resourceDataIdStrs = append(resourceDataIdStrs, strconv.Itoa(v))
-			resourceDataIdMap[v] = true
+			conditionInit = " AND  ( source_id IN ( " + strings.Join(articleIds, ",") + ")  AND source = '" + utils.CYGX_OBJ_ARTICLE + "') OR   (source_id IN ( " + strings.Join(activityIds, ",") + ")  AND source = '" + utils.CYGX_OBJ_ACTIVITY + " ' )"
 		}
-		conditionInit += " AND id IN  (" + strings.Join(resourceDataIdStrs, ",") + ") "
+
+	case 3: // 路演回放
+		conditionInit = "  AND source  IN('activityvoice','activityvideo')  AND  search_tag = '路演回放' "
+
+	case 4: // 语音问答
+		conditionInit = "   AND source = '" + utils.CYGX_OBJ_ASKSERIEVIDEO + "'"
 	}
+
 	return
 }

+ 5 - 4
utils/constants.go

@@ -216,10 +216,11 @@ const (
 )
 
 const (
-	TPL_MSG_WANG_YANG           = "tpl_msg_wang_yang"           //汪洋手机号地址参数
-	TPL_MSG_WANG_FANG_WANG_YANG = "tpl_msg_wang_fang_wang_yang" //权限模板消息接收人,王芳,汪洋
-	TPL_MSG                     = "tpl_msg"                     //王芳手机号地址参数
-	TPL_MSG_NEI_RONG_ZU         = "tpl_msg_nei_rong_zu"         //内容组四人
+	TPL_MSG_WANG_YANG                  = "tpl_msg_wang_yang"           //汪洋手机号地址参数
+	TPL_MSG_WANG_FANG_WANG_YANG        = "tpl_msg_wang_fang_wang_yang" //权限模板消息接收人,王芳,汪洋
+	TPL_MSG                            = "tpl_msg"                     //王芳手机号地址参数
+	TPL_MSG_NEI_RONG_ZU                = "tpl_msg_nei_rong_zu"         //内容组四人
+	CYGX_TAG_HOT_ACTIVITY_ID    string = "cygx_tag_hot_activity_id"    //标签管理自定义的热门活动ID
 )
 
 const (