Преглед изворни кода

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into cygx_12.8

xingzai пре 1 година
родитељ
комит
8d9887ee00

+ 68 - 35
controllers/activity.go

@@ -609,7 +609,7 @@ func (this *ActivityCoAntroller) SignupAdd() {
 	signupStatus := ""
 	var req models.ActivitySingnupRep
 	resp := new(models.SignupStatus)
-	var total int
+	//var total int
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
 	if err != nil {
 		br.Msg = "参数解析异常!"
@@ -637,6 +637,12 @@ func (this *ActivityCoAntroller) SignupAdd() {
 		br.ErrMsg = "操作失败,Err:" + errInfo.Error()
 		return
 	}
+	detailActivityType, err := models.GetActivityTypeDetailById(activityInfo.ActivityTypeId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取信息失败,GetActivityTypeDetailById Err:" + err.Error()
+		return
+	}
 	// 如果是 易董办会 且没有勾选 可提供外呼 默认为自主入会
 	if activityInfo.IsYidongConduct && activityInfo.IsCanOutboundCall == 0 {
 		signupType = 4
@@ -762,15 +768,15 @@ func (this *ActivityCoAntroller) SignupAdd() {
 				resp.SignupStatus = "Success"
 				resp.HasPermission = hasPermission
 				resp.ActivityId = activityId
-				total, err = models.GetUserMeetingReminderCount(user.UserId)
-				if err != nil {
-					br.Msg = "获取信息失败"
-					br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
-					return
-				}
-				if total == 0 {
-					resp.GoFollow = true
-				}
+				//total, err = models.GetUserMeetingReminderCount(user.UserId)
+				//if err != nil {
+				//	br.Msg = "获取信息失败"
+				//	br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
+				//	return
+				//}
+				//if total == 0 {
+				//	resp.GoFollow = true
+				//}
 				br.Ret = 200
 				br.Success = true
 				br.Msg = "操作成功"
@@ -869,13 +875,16 @@ func (this *ActivityCoAntroller) SignupAdd() {
 			//1:预约外呼 、2:设置会议提醒 、 3:预约纪要 、4:活动报名
 			if signupType == 1 {
 				go services.ActivityUserRemind(user, activityInfo, 1)
-				resp.PopupMsg = "<b>预约成功,已加入您的活动日程</b><br/><br/>想要及时获取活动信息变更通知,请关注【查研观向小助手】公众号"
+				//resp.PopupMsg = "<b>预约成功,已加入您的活动日程</b><br/><br/>想要及时获取活动信息变更通知,请关注【查研观向小助手】公众号"
+				resp.PopupMsg = "<b>预约成功,已加入您的活动日程</b><br/><br/>是否将活动日程加入您的系统日历,\n\n活动开始前获取手机日历提醒?"
 			} else if signupType == 4 {
 				go services.ActivityUserRemind(user, activityInfo, 4)
-				resp.PopupMsg = "<b>报名成功,请复制腾讯会议号打开腾讯会议app参会</b><br/>想要及时获取活动信息变更通知,请关注【查研观向小助手】公众号"
+				//resp.PopupMsg = "<b>报名成功,请复制腾讯会议号打开腾讯会议app参会</b><br/>想要及时获取活动信息变更通知,请关注【查研观向小助手】公众号"
+				resp.PopupMsg = "<b>报名成功,请复制腾讯会议号打开腾讯会议app参会</b><br/>是否将活动日程加入您的系统日历,\n\n活动开始前获取手机日历提醒?"
 			} else {
 				go services.ActivityUserRemind(user, activityInfo, 4)
-				resp.PopupMsg = "<b>报名成功,已加入您的活动日程</b><br/>想要及时获取活动信息变更通知,请关注【查研观向小助手】公众号"
+				//resp.PopupMsg = "<b>报名成功,已加入您的活动日程</b><br/>想要及时获取活动信息变更通知,请关注【查研观向小助手】公众号"
+				resp.PopupMsg = "<b>报名成功,已加入您的活动日程</b><br/>是否将活动日程加入您的系统日历,\n\n活动开始前获取手机日历提醒?"
 			}
 			go services.YanXuanActivityPointsBillSignupAdd(activityId, uid) // 用户报名添加到处理研选扣点
 		}
@@ -937,16 +946,21 @@ func (this *ActivityCoAntroller) SignupAdd() {
 	//resp.HasPermission = hasPermission
 	//if signupStatus == "Success" {
 	resp.ActivityId = activityId
+	resp.ActivityTypeName = activityInfo.ActivityName
+	resp.ActivityTime = activityInfo.ActivityTime
+	resp.ActivityType = detailActivityType.ActivityType
+	//}
+
+	//去关注12.6小程序添加日历 去关注公众号强制取消关注
+	//total, err = models.GetUserSignupCount(user.UserId)
+	//if err != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
+	//	return
+	//}
+	//if total <= 1 {
+	//	resp.GoFollow = true
 	//}
-	total, err = models.GetUserSignupCount(user.UserId)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
-		return
-	}
-	if total <= 1 {
-		resp.GoFollow = true
-	}
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "操作成功"
@@ -1300,21 +1314,31 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 
 	resp.SignupStatus = signupStatus
 	resp.ActivityId = activityId
-	var total int
-	total, err = models.GetUserActivityMeetingReminderCount(user.UserId)
+	//var total int
+	//total, err = models.GetUserActivityMeetingReminderCount(user.UserId)
+	//if err != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
+	//	return
+	//}
+	//if total <= 1 {
+	//	resp.GoFollow = true
+	//}
+	detailActivityType, err := models.GetActivityTypeDetailById(activityInfo.ActivityTypeId)
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
+		br.ErrMsg = "获取信息失败,GetActivityTypeDetailById Err:" + err.Error()
 		return
 	}
-	if total <= 1 {
-		resp.GoFollow = true
-	}
+	resp.ActivityTypeName = activityInfo.ActivityName
+	resp.ActivityTime = activityInfo.ActivityTime
+	resp.ActivityType = detailActivityType.ActivityType
 	br.Ret = 200
 	br.Success = true
 	if hasPermission == 1 {
 		br.Msg = "设置成功,会前15分钟会为您推送微信消息提醒"
-		resp.PopupMsg = "设置成功,会前15分钟会为您推送微信消息提醒<br/><br/>请关注【查研观向小助手】公众号,以获取微信消息提醒"
+		resp.PopupMsg = "设置成功,会前15分钟会为您推送微信消息提醒<br/><br/>是否将活动日程加入您的系统日历,\n\n活动开始前获取手机日历提醒?"
+		//resp.PopupMsg = "设置成功,会前15分钟会为您推送微信消息提醒<br/><br/>请关注【查研观向小助手】公众号,以获取微信消息提醒"
 	}
 	br.Data = resp
 }
@@ -3576,16 +3600,25 @@ func (this *ActivityCoAntroller) ActivityAppointmentAdd() {
 	}
 
 	resp.ActivityId = activityId
-	var total int
-	total, err = models.GetUserCygxActivityAppointmentCountByUid(user.UserId)
+	//var total int
+	//total, err = models.GetUserCygxActivityAppointmentCountByUid(user.UserId)
+	//if err != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
+	//	return
+	//}
+	//if total <= 1 {
+	//	resp.GoFollow = true
+	//}
+	detailActivityType, err := models.GetActivityTypeDetailById(activityInfo.ActivityTypeId)
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
+		br.ErrMsg = "获取信息失败,GetActivityTypeDetailById Err:" + err.Error()
 		return
 	}
-	if total <= 1 {
-		resp.GoFollow = true
-	}
+	resp.ActivityTypeName = activityInfo.ActivityName
+	resp.ActivityTime = activityInfo.ActivityTime
+	resp.ActivityType = detailActivityType.ActivityType
 	br.Ret = 200
 	br.Success = true
 	if hasPermission == 1 {

+ 1 - 241
controllers/home.go

@@ -627,212 +627,8 @@ 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)
+		conditionTagIdsInit, err := services.GetConditionInitByTagIds(tagIds, chartPermissionId)
 		if err != nil {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取活动权限数据失败,GetConditionInitByTagIds Err:" + err.Error()
@@ -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 = "获取标签失败"

+ 3 - 0
models/activity_signup.go

@@ -42,6 +42,9 @@ type SignupStatus struct {
 	GoBindEmail       bool   `description:"是否去绑定邮箱"`
 	IsResearch        bool   `description:"是否属于研选"`
 	IsResearchSpecial bool   `description:"是否属于特殊的研选"`
+	ActivityTypeName  string `description:"活动类型名称"`
+	ActivityTime      string `description:"活动时间"`
+	ActivityType      int    `description:"活动线上线下类型 1线上,0 线下"`
 }
 
 // 我的日程

+ 4 - 3
models/activity_type.go

@@ -9,9 +9,10 @@ type ActivityType struct {
 	ActivityTypeName string `description:"活动类型名称"`
 	//TemplateP        string `description:"活动模板,带P标签"`
 	//Template         string `description:"活动模板"`
-	ShowType  string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
-	IsChoose  bool   `description:"是否选择"`
-	OnlineIco string `description:"线上线下Ico图标"`
+	ShowType     string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
+	IsChoose     bool   `description:"是否选择"`
+	OnlineIco    string `description:"线上线下Ico图标"`
+	ActivityType int    `description:"活动线上线下类型 1线上,0 线下"`
 }
 
 type ActivityTypeListResp struct {

+ 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 {

+ 2 - 1
models/micro_roadshow.go

@@ -47,7 +47,8 @@ type MicroRoadShowPageList struct {
 	SourceId            int    `description:"资源ID"`
 	Title               string `description:"标题"`
 	ResourceUrl         string `description:"链接"`
-	Type                int    `description:"类型: 1-活动音频; 2-活动视频; 3-产业视频; 4-系列问答"`
+	Type                int    `description:"类型: 1-活动音频; 2-活动视频; 3-产业视频; 4-问答系列"`
+	LabelType           int    `description:"标签类型: 1-路演回放; 2-调研反馈; 3-产业视频; 4-问答系列"`
 	PublishTime         string `description:"发布时间"`
 	BackgroundImg       string `description:"背景图"`
 	ShareImg            string `description:"分享封面图"`

+ 26 - 2
services/activity.go

@@ -2248,8 +2248,9 @@ func ActivityButtonShow(item *models.ActivityDetail) (activityDetail *models.Act
 	//IsShowMeetingReminder   bool                       `description:"是否展示会议提醒"`
 	//IsShowHelpSsk           bool                       `description:"是否展示帮我带问"`
 	//IsShowSignup            bool                       `description:"是否展示我要报名"`
-
-	activityPointsByUserAllMap := GetActivityPointsByUserAllMap() // 获取对用户进行研选扣点的活动
+	activityTypeIdMap := GetActivityTypeIdMap()
+	activityDetail.ActivityType = activityTypeIdMap[activityDetail.ActivityTypeId] // 线上还是线下
+	activityPointsByUserAllMap := GetActivityPointsByUserAllMap()                  // 获取对用户进行研选扣点的活动
 	activityDetail.IsResearchPoints = activityPointsByUserAllMap[activityDetail.ActivityId]
 	if activityDetail.SiginupDeadline == utils.FormatDateTimeInit { //报名截止时间处理
 		activityDetail.SiginupDeadline = ""
@@ -2363,7 +2364,9 @@ func ActivityButtonShow(item *models.ActivityDetail) (activityDetail *models.Act
 
 func ActivityArrButtonShow(items []*models.ActivityDetail) (activityDetails []*models.ActivityDetail) {
 	activityPointsByUserAllMap := GetActivityPointsByUserAllMap() // 获取对用户进行研选扣点的活动
+	activityTypeIdMap := GetActivityTypeIdMap()
 	for _, activityDetail := range items {
+		activityDetail.ActivityType = activityTypeIdMap[activityDetail.ActivityTypeId] // 线上还是线下
 		if activityDetail.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
 			activityDetail.IsResearch = true
 		}
@@ -2774,3 +2777,24 @@ func UpdateIsSendYidongSignUp(activityId int) (err error) {
 	err = models.UPdateSendedYiDongSignUp(activityId)
 	return
 }
+
+// 获取活动线上还是线下的类型
+func GetActivityTypeIdMap() (mapResp map[int]int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("获取活动线上还是线下的类型,失败,GetActivityTypeIdMap:Err "+err.Error(), 2)
+		}
+	}()
+	list, e := models.GetActivityTypeList("")
+	if e != nil {
+		err = errors.New("GetActivityTypeList, Err: " + e.Error())
+		return
+	}
+	mapResp = make(map[int]int, 0)
+	for _, v := range list {
+		mapResp[v.ActivityTypeId] = v.ActivityType
+	}
+	return
+}

+ 2 - 0
services/es_comprehensive.go

@@ -1186,10 +1186,12 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 			e = errors.New("GetActivitySignupResp, Err: " + e.Error())
 			return
 		}
+		activityTypeIdMap := GetActivityTypeIdMap()
 
 		var activityListRersp []*models.ActivityDetail
 		for _, v := range activityList {
 			v.SignupType = mapActivitySignup[v.ActivityId]
+			v.ActivityType = activityTypeIdMap[v.ActivityTypeId] // 线上还是线下
 			activityListRersp = append(activityListRersp, ActivityButtonShow(v))
 		}
 		for _, v := range activityListRersp {

+ 57 - 0
services/micro_roadshow.go

@@ -394,6 +394,20 @@ func GetMicroRoadShowPageListV12(pageSize, currentIndex, sourceId, tableType int
 		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
 		return
 	}
+	var activiiTyIds []int
+	for _, v := range videoList {
+		v.LabelType = v.Type
+		if v.Type == 1 || v.Type == 2 {
+			v.LabelType = 2 // 先将路演回放设置为调研反馈类型,再做处理
+			activiiTyIds = append(activiiTyIds, v.SourceId)
+		}
+	}
+	mapactiviiTyIds := GetActivityLYHFMapByActivityIds(activiiTyIds)
+	for _, v := range videoList {
+		if v.Type == 1 && mapactiviiTyIds[v.SourceId] {
+			v.LabelType = 1 // 处理路演回放
+		}
+	}
 	respList = videoList
 	return
 }
@@ -816,6 +830,21 @@ func GetMicroRoadShowMycollectV12(pageSize, currentIndex int, audioIds, activity
 		}
 	}
 
+	var activiiTyIds []int
+	for _, v := range videoList {
+		v.LabelType = v.Type
+		if v.Type == 1 || v.Type == 2 {
+			v.LabelType = 2 // 先将路演回放设置为调研反馈类型,再做处理
+			activiiTyIds = append(activiiTyIds, v.SourceId)
+		}
+	}
+	mapactiviiTyIds := GetActivityLYHFMapByActivityIds(activiiTyIds)
+	for _, v := range videoList {
+		if v.Type == 1 && mapactiviiTyIds[v.SourceId] {
+			v.LabelType = 1 // 处理路演回放
+		}
+	}
+
 	respList = videoList
 	return
 }
@@ -1101,3 +1130,31 @@ func AddAllCygxVoiceAndVideoHistory(user *models.WxUserItem, sourceId, sourceTyp
 	}
 	return
 }
+
+// 获取满足路演回放的活动类型
+func GetActivityLYHFMapByActivityIds(activityIds []int) (mapResp map[int]bool) {
+	var err error
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("获取满足路演回放的活动类型 GetActivityLYHFMapByActivityIds,失败,活动ID:"+fmt.Sprint(activityIds)+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	lenArr := len(activityIds)
+	if lenArr == 0 {
+		return
+	}
+	condition = ` AND activity_id IN (` + utils.GetOrmInReplace(lenArr) + `)  `
+	pars = append(pars, activityIds)
+	list, e := models.GetCygxActivityList(condition, pars, 0, lenArr)
+	if e != nil {
+		err = errors.New("GetIndustrialManagementNewList, Err: " + e.Error())
+		return
+	}
+	mapResp = make(map[int]bool, 0)
+	for _, v := range list {
+		mapResp[v.ActivityId] = true
+	}
+	return
+}

+ 152 - 72
services/tag.go

@@ -46,7 +46,7 @@ func AddCygxTagHistory(user *models.WxUserItem, tagId int) (err error) {
 //	fmt.Println(conditionInit)
 //}
 
-func GetConditionInitByTagIds(tagIds string) (conditionInit string, err error) {
+func GetConditionInitByTagIds(tagIds string, chartPermissionId int) (conditionInit string, err error) {
 	if tagIds == "" {
 		return
 	}
@@ -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,172 @@ 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
 			}
-			resourceDataIdStrs = append(resourceDataIdStrs, strconv.Itoa(v))
-			resourceDataIdMap[v] = true
+			conditionInit += " AND id IN  (" + strings.Join(resourceDataIdStrs, ",") + ") "
 		}
-		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))
+			}
+			var conditionchartInit string
+			//行业筛选
+			if chartPermissionId > 0 {
+				conditionchartInit += " AND chart_permission_id  =  " + strconv.Itoa(chartPermissionId)
+			}
+			conditionInit = " AND  ( source_id IN ( " + strings.Join(articleIds, ",") + ") " + conditionchartInit + "  AND source = '" + utils.CYGX_OBJ_ARTICLE + "') OR   (source_id IN ( " + strings.Join(activityIds, ",") + ") " + conditionchartInit + "   AND source = '" + utils.CYGX_OBJ_ACTIVITY + " ' )"
+		}
+
+	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 (