Browse Source

no message

xingzai 1 year ago
parent
commit
45235b50eb

+ 0 - 738
controllers/activity.go

@@ -1063,131 +1063,6 @@ func (this *ActivityCoAntroller) SignupCancel() {
 	br.Data = resp
 }
 
-// @Title  用户搜索详情
-// @Description 获取用户搜索详情接口
-// @Param   IsShowJurisdiction   query   int  true       "是否仅展示有权限的,默认为0,1是,2否 "
-// @Param   IsHideResearch   query   int  true       "是否隐藏研选行业 "
-// @Success Ret=200 {object} models.ActivityUserSearchContentList
-// @router /getUserSearchContent [get]
-func (this *ActivityCoAntroller) GetUserSearchContent() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	isHideResearch, _ := this.GetBool("IsHideResearch", false)
-	uid := user.UserId
-	detailSeearch := new(models.CygxActivityUserSearchContent)
-	detailSeearch.IsShowJurisdiction = 0
-	detailSeearch.ChartPermissionids = ""
-	detailSeearch.ActiveState = ""
-	resp := new(models.ActivityUserSearchContentList)
-	detail, _ := models.GetUserSearchContentByUid(uid)
-	if detail == nil {
-		detail = detailSeearch
-	}
-	isShowJurisdiction, _ := this.GetInt("IsShowJurisdiction")
-	listActivityType, errActivityType := models.GetActivityTypeList("")
-	if errActivityType != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取数据失败,Err:" + errActivityType.Error()
-		return
-	}
-	var listChartPermissionid []*models.ActivityChartPermission
-	var errChart error
-	if isShowJurisdiction == 1 {
-		listChartPermissionidAll, errChartAll := models.GetUserCompanyPermission(user.CompanyId)
-		listChartPermissionid = listChartPermissionidAll
-		errChart = errChartAll
-	} else if isShowJurisdiction == 2 {
-		listChartPermissionidAll, errChartAll := models.GetChartPermissionActivity()
-		listChartPermissionid = listChartPermissionidAll
-		errChart = errChartAll
-	} else {
-		if detail.IsShowJurisdiction == 1 {
-			listChartPermissionidAll, errChartAll := models.GetUserCompanyPermission(user.CompanyId)
-			listChartPermissionid = listChartPermissionidAll
-			errChart = errChartAll
-		} else {
-			listChartPermissionidAll, errChartAll := models.GetChartPermissionActivity()
-			listChartPermissionid = listChartPermissionidAll
-			errChart = errChartAll
-		}
-	}
-
-	if errChart != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取品种信息失败,Err:" + errChart.Error()
-		return
-	}
-	if detail.IsShowJurisdiction == 1 {
-		resp.IsShowJurisdiction = true
-	}
-	if isShowJurisdiction == 1 || detail.IsShowJurisdiction == 1 {
-		resp.IsShowJurisdiction = true
-		for k, _ := range listChartPermissionid {
-			listChartPermissionid[k].IsChoose = true
-		}
-	}
-	if isShowJurisdiction == 2 {
-		resp.IsShowJurisdiction = false
-	}
-	activeStateList := []models.ActivityStaus{models.ActivityStaus{Id: 1, StatusName: "未开始", IsChoose: true}, models.ActivityStaus{Id: 2, StatusName: "进行中"}, models.ActivityStaus{Id: 3, StatusName: "已结束"}}
-	list2, err := models.GetChartPermissionActivity()
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
-		return
-	}
-
-	if activeStateList[1].IsChoose == activeStateList[2].IsChoose == false {
-		activeStateList[0].IsChoose = true
-	}
-	var userType int
-	userType, _, err = services.GetUserType(user.CompanyId)
-	if err != nil {
-		br.Msg = "获取信息失败!"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	var listChartPermissionidNew2 []*models.ActivityChartPermission
-	for _, v := range list2 {
-		if userType == 1 || isHideResearch {
-			//if v.PermissionName != "研选" {
-			if !strings.Contains(v.PermissionName, "研选") {
-				listChartPermissionidNew2 = append(listChartPermissionidNew2, v)
-			}
-		} else {
-			listChartPermissionidNew2 = append(listChartPermissionidNew2, v)
-		}
-	}
-	resp.ListChartPermission2 = listChartPermissionidNew2
-	var listChartPermissionidNew []*models.ActivityChartPermission
-	for _, v := range listChartPermissionid {
-		if userType == 1 || isHideResearch {
-			if !strings.Contains(v.PermissionName, "研选") {
-				listChartPermissionidNew = append(listChartPermissionidNew, v)
-			}
-		} else {
-			listChartPermissionidNew = append(listChartPermissionidNew, v)
-		}
-	}
-	resp.ListActivityType = listActivityType
-	resp.ListChartPermission = listChartPermissionidNew
-	resp.ListActivityStaus = activeStateList
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
 // @Title 添加会议提醒
 // @Description 添加会议提醒接口
 // @Param	request	body models.ActivityIdRep true "type json string"
@@ -1423,31 +1298,6 @@ func (this *ActivityCoAntroller) MeetingReminderCancel() {
 	br.Data = resp
 }
 
-// @Title 敏捷搜索关键词的列表
-// @Description 获取敏捷搜索关键词的列表接口
-// @Success 200 {object} models.ActivityFastsearchKeywordsListResp
-// @router /fastSearchKeWord [get]
-func (this *ActivityABaseController) FastSearch() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-
-	resp := new(models.ActivityFastsearchKeywordsListResp)
-	list, err := models.GetActivityFastsearchKeywordsList()
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取数据失败,Err:" + err.Error()
-		return
-	}
-	resp.List = list
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
 // @Title 活动带问
 // @Description 新增活动带问接口
 // @Param	request	body models.AddCygxActivityHelpAsk true "type json string"
@@ -1609,594 +1459,6 @@ func (this *ActivityCoAntroller) AskAdd() {
 	br.Msg = "提交成功"
 }
 
-// @Title 更多主题列表(4.3版本)
-// @Description 获取活动更多主题列表接口(4.3版本)
-// @Success 200 {object} models.GetCygxActivityLabelListRep
-// @router /labelMoreList [get]
-func (this *ActivityCoAntroller) LabelMoreList() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,SysUser Is Empty"
-		return
-	}
-	userType, permissionStr, err := services.GetUserType(user.CompanyId)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	var startSize, pageSize int
-	pageSize = 24
-	var condition string
-	var sortTime string
-	//var conditionStatus string
-	var pars []interface{}
-	//活动可见限制
-	var sqlExport string
-	resp := new(models.GetCygxActivityLabelListRep)
-	slicePer := strings.Split(permissionStr, ",")
-	var permissionSqlStr string
-	for _, v := range slicePer {
-		if userType == 1 {
-			//if v != "研选" {
-			if !strings.Contains(v, "研选") {
-				permissionSqlStr += "'" + v + "',"
-			}
-		} else {
-			permissionSqlStr += "'" + v + "',"
-		}
-	}
-	permissionSqlStr = strings.TrimRight(permissionSqlStr, ",")
-	permissionSqlStr = strings.Replace(permissionSqlStr, "(主观)", "", -1)
-	permissionSqlStr = strings.Replace(permissionSqlStr, "(客观)", "", -1)
-	permissionSqlStr = ` AND art.chart_permission_name  IN (` + permissionSqlStr + `)`
-	sqlExport = ` AND (art.customer_type_ids LIKE '%` + strconv.Itoa(userType) + `%' `
-	if userType == 2 {
-		sqlExport += ` OR  art.customer_type_ids LIKE '%3%' `
-	}
-	if (userType == 2 || userType == 3) && strings.Contains(permissionStr, "专家") {
-		sqlExport += ` OR  art.customer_type_ids LIKE '%4%' `
-	}
-	sqlExport += `) `
-
-	//进行中的活动
-	condition = ` AND art.publish_status = 1  AND art.label != ''  AND art.active_state = 2 `
-	var conditionOr string
-	if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
-		conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%4%'	 ` + condition + `) `
-	}
-	if (userType == 5) && strings.Contains(permissionStr, "专家") {
-		conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%5%'	 ` + condition + `) `
-	}
-	if userType == 1 {
-		conditionOr += ` OR ( art.is_limit_people = 0 ` + condition + permissionSqlStr + `) `
-	} else {
-		conditionOr += ` OR ( art.is_limit_people = 0 ` + condition + `) `
-	}
-	//判断客户规模是否属于可见范围的活动
-	companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
-		return
-	}
-
-	if companyProduct != nil {
-		if companyProduct.Scale != "" {
-			conditionOr += ` OR (  art.scale LIKE '%` + companyProduct.Scale + `%'	 ` + condition + `) `
-		}
-	}
-	condition += `AND art.is_limit_people = 1 ` + permissionSqlStr + sqlExport + conditionOr
-
-	//进行中的活动
-	sortTime = ` mintimesort ASC `
-	list, errList := models.GetActivityLabelListAll(condition, sortTime, pars, startSize, pageSize)
-	if errList != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + errList.Error()
-		return
-	}
-
-	//已结束的活动
-	conditionOr = ""
-	condition = ` AND art.publish_status = 1  AND art.label != ''  AND art.active_state = 3 `
-	if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
-		conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%4%'	 ` + condition + `) `
-	}
-	if (userType == 5) && strings.Contains(permissionStr, "专家") {
-		conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%5%'	 ` + condition + `) `
-	}
-	if userType == 1 {
-		conditionOr += ` OR ( art.is_limit_people = 0 ` + condition + permissionSqlStr + `) `
-	} else {
-		conditionOr += ` OR ( art.is_limit_people = 0 ` + condition + `) `
-	}
-	condition += `AND art.is_limit_people = 1 ` + permissionSqlStr + sqlExport + conditionOr
-	startSize = 0
-	pageSize = 24 - len(list)
-
-	//已结束的活动
-	sortTime = ` timesort DESC `
-	listEnd, err := models.GetActivityLabelListAll(condition, sortTime, pars, startSize, pageSize)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	for _, v := range listEnd {
-		list = append(list, v)
-	}
-	//标签字段关联的产业与标签处理
-	for k, v := range list {
-		list[k].KeyWord = services.LabelStr(v.KeyWord)
-	}
-	//添加更多主题访问记录
-	item := new(models.CygxPageHistoryRecord)
-	item.UserId = user.UserId
-	item.CreateTime = time.Now()
-	item.Mobile = user.Mobile
-	item.Email = user.Email
-	item.CompanyId = user.CompanyId
-	item.CompanyName = user.CompanyName
-	item.PageType = "LabelMore"
-	go models.AddCygxPageHistoryRecord(item)
-	resp.List = list
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
-// @Title 活动列表(4.3版本)
-// @Description 获取活动列表接口(4.3版本)
-// @Param   PageSize   query   int  true       "每页数据条数"
-// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
-// @Param   Label   query   string  false       "搜索主题 多个用 , 隔开"
-// @Param   ChartPermissionIds   query   string  false     "行业id 多个用 , 隔开"
-// @Param   WhichDay   query   string  false       "哪一天 1今天、2明天,3本周,4上周,5本月,6上月 多个用 , 隔开"
-// @Param   ActiveState   query   string  false       "活动进行状态 未开始:1、进行中2、已结束3"
-// @Param   ActivityTypeId   query   string  false     "活动类型id 多个用 , 隔开"
-// @Param   Source   query   int  false     "来源 0手机 ,1Pc 默认0"
-// @Param   IsPower   query   int  false       "是否选择有权限行业 ,1是 0 否 默认0"
-// @Param   PlayBack   query   int  false       "是否仅展示回放 1:是、0:否 默认0"
-// @Param   KeyWord   query   string  false       "搜索关键词 多个用 , 隔开"
-// @Param   ActivityId   query   int  false       "活动列表传过来的活动ID"
-// @Param   Filter			query	int		false	"筛选条件 0:全部 1:视频 2:音频"
-// @Param   TypeName   query   string  false       "电话会类型 ,1专家电话会 2分析师电话会"
-// @Param   IsExternalLabel   query   int  false       "是否仅展示外部资源 1:是、0:否 默认0"
-// @Param   IsResearchPoints   query   string  false       "是否仅展示研选扣点 1:展示研选扣点、2:展示外部资源 ,1,2两者都展示" //兼容前端
-// @Param   IsResearch   query   bool  true       "是否为研选"
-// @Success 200 {object} models.GetCygxActivityListRep
-// @router /listNew [get]
-func (this *ActivityCoAntroller) ActivityListNew() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,SysUser Is Empty"
-		return
-	}
-
-	uid := user.UserId
-	pageSize, _ := this.GetInt("PageSize")
-	currentIndex, _ := this.GetInt("CurrentIndex")
-	//source, _ := this.GetInt("Source")
-	label := this.GetString("Label")
-	chartPermissionIds := this.GetString("ChartPermissionIds")
-	whichDay := this.GetString("WhichDay")
-	//whichTime := this.GetString("WhichTime")
-	activeState := this.GetString("ActiveState")
-	activityTypeId := this.GetString("ActivityTypeId")
-	keyWord := this.GetString("KeyWord")
-	playBack, _ := this.GetInt("PlayBack")
-	filter, _ := this.GetInt("Filter")
-	isPower, _ := this.GetInt("IsPower")
-	activityId, _ := this.GetInt("ActivityId") // 仅用于判断【新】标签
-	//isExternalLabel, _ := this.GetInt("IsExternalLabel")   //
-	isResearchPoints := this.GetString("IsResearchPoints") //
-	isResearch, _ := this.GetBool("IsResearch", true)      // 是否为研选 查研观向11.0 (研选活动独立显示)
-	if label == "undefined" {
-		label = ""
-	}
-	if chartPermissionIds == "undefined" {
-		chartPermissionIds = ""
-	}
-	// 查研观向7.4-始终查询宏观的活动
-	if chartPermissionIds != "" {
-		chartPermissionIds += ",1"
-	}
-
-	if whichDay == "undefined" {
-		whichDay = ""
-	}
-	if activeState == "undefined" {
-		activeState = ""
-	}
-	if activityTypeId == "undefined" {
-		activityTypeId = ""
-	}
-
-	if activityTypeId == "5" {
-		activityTypeId = "5,8" //专家线下沙龙可以查看买方线下交流
-	}
-	var startSize int
-	if pageSize <= 0 {
-		pageSize = utils.PageSize20
-	}
-	if currentIndex <= 0 {
-		currentIndex = 1
-	}
-	startSize = utils.StartIndex(currentIndex, pageSize)
-	//userType, permissionStr, err := services.GetUserType(user.CompanyId)
-	var condition string
-	var conditioninit string //初始化搜索条件
-	var pars []interface{}
-	var activityList []*models.ActivityDetail
-	mapDingActivityId := make(map[int]int)
-
-	//主题
-	if label != "" {
-		conditioninit += ` AND art.label  LIKE "%` + label + `%" `
-	}
-	//是否是研选
-	if isResearch {
-		chartPermissionIds = strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN)
-	} else {
-		conditioninit += ` AND ( art.chart_permission_id  !=  ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `  OR  ( art.is_show_hz = 1 AND art.chart_permission_id  =  ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `)  )`
-
-		conditioninit += ` AND IF (	 art.active_state = 3, art.chart_permission_id != ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `, 1 = 1 ) ` //V 11.0 研选活动结束后就不在已结束页面展示了
-	}
-
-	//行业名称 易董过来的会,按照 副行业来筛选
-	if len(chartPermissionIds) > 0 {
-		//conditioninit += ` AND art.chart_permission_id  IN (` + chartPermissionIds + `)`
-		conditioninit += `  AND IF ( art.yidong_activity_id != '' , art.chart_permission_id_deputy  IN (` + chartPermissionIds + `) ,1=1 ) `
-		conditioninit += `  AND IF ( art.yidong_activity_id = '' , art.chart_permission_id  IN (` + chartPermissionIds + `) ,1=1 ) `
-	}
-	//哪一天
-	if whichDay != "" {
-		var startDate string
-		var endDate string
-		if whichDay == "1" {
-			startDate = time.Now().Format(utils.FormatDate)
-			endDate = startDate
-		} else if whichDay == "2" {
-			startDate = time.Now().AddDate(0, 0, +1).Format(utils.FormatDate)
-			endDate = startDate
-		} else if whichDay == "3" {
-			startDate = utils.GetNowWeekMonday().Format(utils.FormatDate)
-			endDate = utils.GetNowWeekSunday().Format(utils.FormatDate)
-		} else if whichDay == "4" {
-			startDate = utils.GetLastWeekMonday().Format(utils.FormatDate)
-			endDate = utils.GetLastWeekSunday().Format(utils.FormatDate)
-		} else if whichDay == "5" {
-			startDate = utils.GetNowMonthFirstDay().Format(utils.FormatDate)
-			endDate = utils.GetNowMonthLastDay().Format(utils.FormatDate)
-		} else if whichDay == "6" {
-			startDate = utils.GetLastMonthFirstDay().Format(utils.FormatDate)
-			endDate = utils.GetLastMonthLastDay().Format(utils.FormatDate)
-		} else if whichDay == "1,2" {
-			startDate = time.Now().Format(utils.FormatDate)
-			endDate = time.Now().AddDate(0, 0, +1).Format(utils.FormatDate)
-		} else if whichDay == "3,4" {
-			startDate = utils.GetLastWeekMonday().Format(utils.FormatDate)
-			endDate = utils.GetNowWeekSunday().Format(utils.FormatDate)
-		} else if whichDay == "5,6" {
-			startDate = utils.GetLastMonthFirstDay().Format(utils.FormatDate)
-			endDate = utils.GetNowMonthLastDay().Format(utils.FormatDate)
-		} else {
-			startDate = time.Now().Format(utils.FormatDate)
-			endDate = time.Now().AddDate(0, 0, +1).Format(utils.FormatDate)
-		}
-		conditioninit += ` AND art.activity_time >= ` + "'" + startDate + " 00:00:00'"
-		conditioninit += ` AND art.activity_time <= ` + "'" + endDate + " 23:59:59'"
-	}
-
-	//活动状态搜索
-	if activeState != "" {
-		// 默认查看未开始跟进行中
-		if activeState == "1" {
-			conditioninit += ` AND art.active_state  IN (1,2)`
-		} else {
-			conditioninit += ` AND art.active_state  IN (` + activeState + `)`
-		}
-	} else {
-		conditioninit += ` AND art.active_state  IN (1,2)`
-	}
-
-	// 如果是分析师电话会,那么可以连同C类一起查看
-	if activityTypeId != "" {
-		if activityTypeId == strconv.Itoa(utils.ANALYST_TELL_ACTIVITY_TYPE_ID) {
-			conditioninit += `  AND art.activity_type_id IN (` + activityTypeId + "," + strconv.Itoa(utils.C_CLASS_ACTIVITY_TYPE_ID) + `)`
-		} else {
-			conditioninit += `  AND art.activity_type_id IN (` + activityTypeId + `)`
-		}
-	}
-
-	//关键词搜索
-	if keyWord != "" {
-		conditioninit += ` AND (art.label   REGEXP '` + keyWord + `' OR art.activity_name  REGEXP '` + keyWord + `' ) `
-	}
-
-	//回放
-	if playBack == 1 {
-		//获取所有带回放的活动ID
-		playBackActivityIds, err := services.GetActivityPlayBackActivityIds()
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取失败,Err:" + err.Error()
-			return
-		}
-		conditioninit += ` AND art.activity_id IN ( ` + playBackActivityIds + `) `
-	}
-
-	//音频视频  1:视频 2:音频
-	if filter > 0 {
-		videoOrVoiceActivityIds, err := services.GetActivityVideoOrVoiceActivityIds(filter)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取失败,Err:" + err.Error()
-			return
-		}
-		conditioninit += ` AND art.activity_id IN ( ` + videoOrVoiceActivityIds + `) `
-	}
-	//外部资源,研选扣点的并集搜索
-	if isResearchPoints == "1,2" || isResearchPoints == "2,1" {
-		conditioninit += ` AND ( art.is_external_label = 1  OR art.is_research_points = 1 )`
-	} else {
-		// 是否为研选扣点
-		if isResearchPoints == "1" {
-			conditioninit += ` AND art.is_research_points = 1 `
-		}
-		//是否为外部资源
-		if isResearchPoints == "2" {
-			conditioninit += ` AND art.is_external_label = 1 `
-		}
-	}
-
-	//活动可见限制
-	//conditionActivityAll, err := services.GetActivityonditionList(user, activityTypeId, chartPermissionIds, whichDay, activeState, label, 0, source, keyWord, playBack, 3)
-	conditionActivity, err := services.ActivityConditioninitSql(user, conditioninit, isPower)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
-		return
-	}
-	condition += `  AND art.publish_status = 1 ` + conditionActivity
-	//var conditionCount string
-	//conditionCount = condition + conditionActivityAll
-	total, err := models.GetActivityCount(condition, playBack, pars, filter)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	//搜索关键词初始化
-	//conditionActivityKey, err := services.GetActivityonditionList(user, activityTypeId, chartPermissionIds, whichDay, activeState, label, 0, source, keyWord, playBack, 1)
-	//if err != nil && err.Error() != utils.ErrNoRow() {
-	//	br.Msg = "获取失败"
-	//	br.ErrMsg = "获取失败,Err:" + err.Error()
-	//	return
-	//}
-	var conditionOrder string
-	if activeState == "2" || activeState == "3" {
-		conditionOrder = ` ORDER BY art.activity_time DESC  `
-	} else if activeState == "2,3" {
-		conditionOrder = ` ORDER BY art.active_state ASC, art.activity_time DESC  `
-	} else {
-		conditionOrder = ` ORDER BY art.activity_time DESC ,  art.active_state ASC   `
-	}
-	if label != "" && activeState == "1" {
-		conditionOrder = ` ORDER BY art.activity_time ASC  `
-	}
-	//未开始进行中默认按照时间正序
-	if activeState == "1" || activeState == "1,2" || activeState == "" {
-		conditionOrder = ` ORDER BY  art.top_time DESC , art.activity_time ASC  `
-	}
-	//conditionActivityKey += condition + conditionOrder
-	condition += conditionOrder
-	//fmt.Println(conditionOrder)
-
-	list, errList := models.GetActivityListNew(condition, pars, uid, startSize, pageSize, playBack, filter, "")
-	if errList != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + errList.Error()
-		return
-	}
-
-	var isShow bool
-	isShow = services.GetShowSustainable()
-	detail, err := models.GetConfigByCode("city_img_url")
-	if err != nil {
-		br.Msg = "获取数据失败"
-		br.ErrMsg = "城市配置信息失败,Err:" + err.Error()
-		return
-	}
-	detailChart, err := models.GetConfigByCode("chart_img_url")
-	if err != nil {
-		br.Msg = "获取数据失败"
-		br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
-		return
-	}
-
-	addressList := strings.Split(detail.ConfigValue, "{|}")
-	mapAddress := make(map[string]string)
-	chartList := strings.Split(detailChart.ConfigValue, "{|}")
-	mapChart := make(map[string]string)
-	var cityName string
-	var chartName string
-	var imgUrl string
-	var imgUrlChart string
-	var mapActivityId []int
-	for _, v := range addressList {
-		vslice := strings.Split(v, "_")
-		cityName = vslice[0]
-		imgUrl = vslice[len(vslice)-1]
-		mapAddress[cityName] = imgUrl
-	}
-	for _, v := range chartList {
-		vslice := strings.Split(v, "_")
-		chartName = vslice[0]
-		imgUrlChart = vslice[len(vslice)-1]
-		mapChart[chartName] = imgUrlChart
-	}
-
-	for k, v := range list {
-		if strings.Contains(v.ActivityName, "【") {
-			list[k].IsBrackets = 1
-		}
-		if v.SignupNum > v.LimitPeopleNum {
-			list[k].SignupNum = v.LimitPeopleNum
-		}
-		if isShow && strings.Contains(v.ChartPermissionName, "研选") {
-			list[k].IsShowSustainable = true
-		}
-		if strings.Contains(v.ChartPermissionName, "研选") && v.ActivityTypeId == 1 {
-			//list[k].ActivityTypeName = "买方研选电话会"
-			//list[k].ImgUrlText = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211221/bIdfv8t86xrFRpDOeGGHXOmKEuKl.png"
-			list[k].ImgUrlText = utils.YAN_XUAN_IMG
-		}
-		if v.ActivityType == 0 {
-			if mapAddress[v.City] != "" {
-				list[k].ImgUrl = mapAddress[v.City]
-			} else {
-				list[k].ImgUrl = mapAddress["其它"]
-			}
-		} else {
-			if mapChart[v.ChartPermissionName] != "" {
-				list[k].ImgUrl = mapChart[v.ChartPermissionName]
-			}
-		}
-		expertTxt, _ := services.GetReportContentTextSub(v.Expert)
-		list[k].Expert = expertTxt
-		if v.IsHideAppointment == 0 {
-			list[k].IsShowAppointment = services.IsShowAppointment(v.ActivityTypeId, v.ChartPermissionName)
-		}
-		if v.ActivityTypeId == utils.C_CLASS_ACTIVITY_TYPE_ID {
-			list[k].IsCClassMeeting = true
-		}
-		mapActivityId = append(mapActivityId, v.ActivityId)
-	}
-	page := paging.GetPaging(currentIndex, pageSize, total)
-	resp := new(models.GetCygxActivityListRep)
-	resp.Label = label
-	if activityTypeId != "" {
-		activityTypeIdint, err := strconv.Atoi(activityTypeId)
-		if err == nil {
-			detail, errDetail := models.GetActivityTypeDetailById(activityTypeIdint)
-			if errDetail != nil {
-				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取信息失败,Err:" + errDetail.Error()
-				return
-			}
-			resp.ImgUrl = detail.OnlineIco
-			resp.Label = detail.ActivityTypeName
-		}
-	}
-	//处理音频回放
-	mapActivityVoice, err := services.GetActivityVoiceResp(mapActivityId)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "GetActivityVoiceResp,Err:" + err.Error()
-		return
-	}
-
-	//处理视频回放
-	mapActivityVideo, err := services.GetActivityVideoResp(mapActivityId)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "GetActivityVideoResp,Err:" + err.Error()
-		return
-	}
-	//处理不同的报名方式按钮回显
-	mapActivitySignup, err := services.GetActivitySignupResp(mapActivityId, user)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
-		return
-	}
-	for _, v := range list {
-		if mapDingActivityId[v.ActivityId] == 0 {
-			activityList = append(activityList, v)
-		}
-		v.SignupType = mapActivitySignup[v.ActivityId]
-	}
-	for k, v := range activityList {
-		if mapActivityVoice[v.ActivityId] != nil {
-			list[k].FileType = 1
-			list[k].AudioLink = true
-			list[k].VoiceList = mapActivityVoice[v.ActivityId]
-		}
-		if mapActivityVideo[v.ActivityId] != nil {
-			list[k].FileType = 2
-			list[k].AudioLink = true
-			list[k].VideoDetail = mapActivityVideo[v.ActivityId]
-		}
-		//resp.List = append(resp.List, services.ActivityButtonShow(v))
-	}
-	resp.List = services.ActivityArrButtonShow(activityList)
-	// 查研观向7.4-判断标签是否为产业, 为产业时是否跳转资源包
-	if label != "" {
-		industry, e := models.GetIndustryByName(label)
-		if e != nil && e.Error() != utils.ErrNoRow() {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取标签产业失败, Err:" + e.Error()
-			return
-		}
-		if industry != nil {
-			sourceIndustry, e := models.GetSourceIndustryByName(label)
-			if e != nil && e.Error() != utils.ErrNoRow() {
-				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取标签产业资源包失败, Err:" + e.Error()
-				return
-			}
-			if sourceIndustry != nil {
-				resp.IndustrialManagementId = sourceIndustry.IndustrialManagementId
-				resp.IsJump = true
-				// 研选产业不跳资源包
-				if sourceIndustry.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
-					resp.IsJump = false
-				}
-			}
-		}
-		// 新标签
-		if activityId > 0 {
-			activityIds := []int{activityId}
-			activityNewMap, _, e := services.GetActivityNewLabelMap(activityIds)
-			if e != nil {
-				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取活动新标签失败, Err: " + e.Error()
-				return
-			}
-			resp.IndustryNewLabel = activityNewMap[activityId]
-		}
-	}
-
-	//添加活动搜索记录
-	//if keyWord != "" {
-	//	go services.AddActivitykeyWordSearch(keyWord, user)
-	//}
-
-	if activityTypeId == "3" || activityTypeId == "5" {
-		resp.IsShowResearchPoints = true
-	}
-	resp.Paging = page
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
 // @Title 校验活动带问是否有权限
 // @Description 校验活动带问是否有权限接口
 // @Param	request	body models.ActivityIdRep true "type json string"

+ 0 - 177
controllers/collection.go

@@ -1,177 +0,0 @@
-package controllers
-
-import (
-	"encoding/json"
-	"hongze/hongze_mfyx/models"
-	"hongze/hongze_mfyx/services"
-	"hongze/hongze_mfyx/utils"
-	"time"
-)
-
-// Collection
-type CollectionController struct {
-	BaseAuthController
-}
-
-// @Title 精选看板、路演banner列表
-// @Description 精选看板、路演banner列表接口
-// @Success Ret=200 {object} cygx.CollectionBannerListResp
-// @router /banner/list [get]
-func (this *CollectionController) BannerList() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,SysUser Is Empty"
-		br.Ret = 408
-		return
-	}
-
-	resp := new(models.CollectionBannerListResp)
-	var listA []*models.CollectionBannerResp
-	listB := new(models.CollectionBannerResp)
-	listA = []*models.CollectionBannerResp{
-		&models.CollectionBannerResp{Title: "", IndexImg: "https://hzstatic.hzinsights.com/cygx/banner/xcx/lyhf.png", Path: "/reportPages/trainVideoPages/trainVideoPages"},
-	}
-	listB.Title = ""
-	listB.IndexImg = "https://hzstatic.hzinsights.com/cygx/banner/xcx/jxkb.png"
-	listB.IsShowSustainable = true
-	resp.ListA = listA
-	resp.ListB = listB
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
-// @Title 精选看板跳转详情地址
-// @Description 精选看板跳转详情地址接口
-// @Success Ret=200 {object} cygx.CollectionBannerListResp
-// @router /detail [get]
-func (this *CollectionController) Detail() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,SysUser Is Empty"
-		br.Ret = 408
-		return
-	}
-	resp := new(models.CollectionDetailResp)
-	if user.Mobile != "" {
-
-		resp.HttpUrl = utils.COLLECTIONS_INFO_HTTP_URL
-	} else {
-		resp.HttpUrl = utils.COLLECTIONS_INFO_HTTP_URL
-	}
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
-// @Title 提交精选看板申请接口
-// @Description 提交精选看板申请接口
-// @Param	request	body cygx.CygxBannerIdReq true "type json string"
-// @Success 200 Ret=200 提交成功
-// @router /apply/add [post]
-func (this *CollectionController) ApplyAdd() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	var req models.ApplyCollectionReq
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
-	if err != nil {
-		br.Msg = "参数解析异常!"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
-		return
-	}
-	content := req.Content
-	if content == "" {
-		br.Msg = "内容不能为空"
-		br.ErrMsg = "内容不能为空"
-		return
-	}
-	item := new(models.CygxApplyCollection)
-	item.UserId = user.UserId
-	item.CreateTime = time.Now()
-	item.ModifyTime = time.Now()
-	item.Mobile = user.Mobile
-	item.Email = user.Email
-	item.CompanyId = user.CompanyId
-	item.CompanyName = user.CompanyName
-	item.Content = content
-	item.RegisterPlatform = utils.REGISTER_PLATFORM
-	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		return
-	}
-	item.RealName = user.RealName
-	if sellerItem != nil {
-		item.SellerName = sellerItem.RealName
-	}
-	newId, err := models.AddCygxApplyCollection(item)
-	services.SendCygxApplyCollectionTemplateMsg(user, content, int(newId))
-	if err != nil {
-		br.Msg = "申请失败"
-		br.ErrMsg = "申请失败,Err:" + err.Error()
-		return
-	}
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "记录成功"
-}
-
-// @Title  获取申请详情
-// @Description 获取申请详情接口
-// @Param   ApplyCollectionId   query   int  true       "ID"
-// @Success Ret=200 {object} cygx.CygxApplyCollectionDetailResp
-// @router /apply/detail [get]
-func (this *CollectionController) ApplyDetail() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	resp := new(models.CygxApplyCollectionDetailResp)
-	applyCollectionId, _ := this.GetInt("ApplyCollectionId")
-	if applyCollectionId < 1 {
-		br.Msg = "请输入详情ID"
-		return
-	}
-	detail, err := models.GetCygxApplyCollectionDetail(applyCollectionId)
-	if err != nil {
-		br.Msg = "详情不存在"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	resp.Detail = detail
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}

+ 0 - 120
controllers/config.go

@@ -4,7 +4,6 @@ import (
 	"encoding/json"
 	"hongze/hongze_mfyx/models"
 	"hongze/hongze_mfyx/services"
-	"strings"
 	"time"
 )
 
@@ -210,122 +209,3 @@ func (this *ConfigController) KeyWordLog() {
 	br.Success = true
 	br.Msg = "新增成功"
 }
-
-// @Title 关于我们浏览记录
-// @Description 关于我们浏览记录接口
-// @Success 200
-// @router /aboutUs/addHistory [post]
-func (this *ConfigController) AboutUsAdd() {
-	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
-	}
-	go services.AddCygxAboutUsVideoHistory(user)
-
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "操作成功!"
-}
-
-// @Title 买方研选产品介绍(无需token)
-// @Description 买方研选产品介绍接口(无需token)
-// @Success 200 {object} models.ConfigImgListResp
-// @router /research/introduce [get]
-func (this *BaseConfigController) ResearchIntroduce() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-
-	conf, err := models.GetConfigByCode("research_introduce_img_url")
-	if err != nil {
-		br.Msg = "获取数据失败"
-		br.ErrMsg = "买方研选产品介绍信息失败,Err:" + err.Error()
-		return
-	}
-	if conf.ConfigValue == "" {
-		br.Msg = "获取失败"
-		br.ErrMsg = "买方研选产品介绍信息失败"
-		return
-	}
-	list := new(*models.ConfigImgListResp)
-	if err = json.Unmarshal([]byte(conf.ConfigValue), &list); err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "买方研选产品介绍信配置值解析失败, Err: " + err.Error()
-		return
-	}
-	br.Msg = "获取成功!"
-	br.Ret = 200
-	br.Success = true
-	br.Data = list
-}
-
-// @Title 买方研选报价单(无需token)
-// @Description 买方研选报价单(无需token)
-// @Success 200 {object} models.ConfigImgListResp
-// @router /research/quotation [get]
-func (this *BaseConfigController) ResearchQuotation() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	conf, err := models.GetConfigByCode("research_quotation_img_url")
-	if err != nil {
-		br.Msg = "获取数据失败"
-		br.ErrMsg = "买方研选产品介绍信息失败,Err:" + err.Error()
-		return
-	}
-	if conf.ConfigValue == "" {
-		br.Msg = "获取失败"
-		br.ErrMsg = "买方研选产品介绍信息失败"
-		return
-	}
-	list := new(*models.ConfigImgListResp)
-	if err = json.Unmarshal([]byte(conf.ConfigValue), &list); err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "买方研选产品介绍信配置值解析失败, Err: " + err.Error()
-		return
-	}
-	br.Msg = "获取成功!"
-	br.Ret = 200
-	br.Success = true
-	br.Data = list
-}
-
-// @Title 买方研选升级新资源海报(无需token)
-// @Description 买方研选升级新资源海报(无需token)
-// @Success 200 {object} models.ConfigImgListResp
-// @router /research/hb [get]
-func (this *BaseConfigController) ResearchHb() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	detail, err := models.GetConfigByCode("research_hb_img_url")
-	if err != nil {
-		br.Msg = "获取数据失败"
-		br.ErrMsg = "买方研选升级新资源海报信息失败,Err:" + err.Error()
-		return
-	}
-	resp := new(models.ConfigImgHbResp)
-	list := strings.Split(detail.ConfigValue, "{|}")
-	if len(list) == 0 {
-		list = make([]string, 0)
-	}
-	resp.HbImg = list[0]
-	resp.ButtonImg = list[len(list)-1]
-	br.Msg = "获取成功!"
-	br.Ret = 200
-	br.Success = true
-	br.Data = resp
-}

+ 27 - 35
controllers/home.go

@@ -1,7 +1,6 @@
 package controllers
 
 import (
-	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_mfyx/models"
 	"hongze/hongze_mfyx/services"
@@ -52,57 +51,50 @@ func (this *HomeController) NewList() {
 	startSize = paging.StartIndex(currentIndex, pageSize)
 
 	var condition string
-	var conditionInit string
 	var pars []interface{}
+	var yanxuanActivityIds []int
+	var yanxuanArticleIds []int
+	//var yanxuanspecialIds []int
+
 	//var total int
 	resp := new(models.HomeResourceDataListResp)
-	totalRai, err := models.GetCountCompanyProductCompanyId(user.CompanyId, utils.COMPANY_PRODUCT_RAI_ID)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "获取失败"
-		br.ErrMsg = "GetCountCompanyProductCompanyId,Err:" + err.Error()
-		return
-	}
+	condition += " AND source IN ('article','activity','yanxuanspecial')   " // 只有研选的文章、研选的活动、研选的专栏这三种
 
-	yanxuanActivityIds := services.GetYanxuanActivityIds() // 获取所有的研选活动ID
-	yanxuanArticleIds := services.GetYanxuanArticleIds()   // 获取所有的研选文章ID
-	fmt.Println(len(yanxuanActivityIds))
-	fmt.Println(len(yanxuanArticleIds))
-
-	condition += `  AND IF ( source = 'article' , source_id   IN (` + utils.GetOrmInReplace(len(yanxuanArticleIds)) + `) ,1=1 ) `
-	pars = append(pars, yanxuanArticleIds)
-
-	condition += `  AND IF ( source = 'activity' , source_id   IN (` + utils.GetOrmInReplace(len(yanxuanActivityIds)) + `) ,1=1 ) `
-	pars = append(pars, yanxuanArticleIds)
-
-	if labelKeyword != "" {
-		conditionTagIdsInit, err := services.GetConditionInitByTagIds(labelKeyword, 0)
-		if err != nil {
+	if labelKeyword == "" {
+		//查询近一个月的数据
+		condition += " AND publish_date  >   '" + time.Now().AddDate(0, 0, -60).Format(utils.FormatDateTime) + "'"
+		yanxuanActivityIds = services.GetYanxuanActivityIds() // 获取所有的研选活动ID
+		yanxuanArticleIds = services.GetYanxuanArticleIds()   //获取所有研选文章ID
+	} else {
+		var errIds error
+		yanxuanActivityIds, yanxuanArticleIds, errIds = services.GetConditionInitByTagIds(labelKeyword)
+		if errIds != nil {
 			br.Msg = "获取失败"
-			br.ErrMsg = "获取活动权限数据失败,GetConditionInitByTagIds Err:" + err.Error()
+			br.ErrMsg = "获取活动权限数据失败,GetConditionInitByTagIds Err:" + errIds.Error()
 			return
 		}
-		conditionInit += conditionTagIdsInit
+		//如果不是 "全部报告" 、 "专栏" 的关键词查询,就不做研选专栏的查询
+		if labelKeyword != utils.LABEL_L2_1 && labelKeyword != utils.LABEL_L2_2 {
+			condition += `  AND IF ( source = 'yanxuanspecial' , source_id   IN (0) ,1=1 ) `
+		}
 	}
 
-	if labelKeyword == "" {
-		//查询近一个月的数据
-		conditionInit += " AND publish_date  >   '" + time.Now().AddDate(0, 0, -60).Format(utils.FormatDateTime) + "'"
-	}
+	yanxuanArticleIds = append(yanxuanArticleIds, 0)
+	yanxuanActivityIds = append(yanxuanActivityIds, 0)
+	//yanxuanspecialIds = append(yanxuanspecialIds, 0)
+	condition += `  AND IF ( source = 'article' , source_id   IN (` + utils.GetOrmInReplace(len(yanxuanArticleIds)) + `) ,1=1 ) `
+	pars = append(pars, yanxuanArticleIds)
+
+	condition += `  AND IF ( source = 'activity' , source_id   IN (` + utils.GetOrmInReplace(len(yanxuanActivityIds)) + `) ,1=1 ) `
+	pars = append(pars, yanxuanActivityIds)
 
-	if user.CompanyId <= 1 || totalRai == 0 {
-		conditionInit += " AND source IN ('article','yanxuanspecial')   "
-	} else {
-		conditionInit += " AND source IN ('article','activity','yanxuanspecial')   "
-	}
 	total, err := models.GetResourceDataCount(condition, pars)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
-
 	page := paging.GetPaging(currentIndex, pageSize, total)
-	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
 	list, err := services.GetResourceDataList(condition, pars, startSize, pageSize, user)
 	if err != nil {
 		br.Msg = "获取失败"

+ 176 - 0
controllers/industry.go

@@ -0,0 +1,176 @@
+package controllers
+
+import (
+	"encoding/json"
+	"hongze/hongze_mfyx/models"
+	"hongze/hongze_mfyx/services"
+	"hongze/hongze_mfyx/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" {
+		articleDetail, err := models.GetArticleDetailById(sourceId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取信息失败,Err:" + err.Error()
+			return
+		}
+		//判读是否属于策略的文章类型
+		reportMappingMap, _ := services.GetReportMappingMap()
+		if reportMappingMap[articleDetail.CategoryId] {
+			chooseCategoryMap, _ := services.GetChooseCategoryMap(user)
+			//判断用户是否关注策略对应分类
+			if !chooseCategoryMap[articleDetail.CategoryId] {
+				item := new(models.CygxXzsChooseCategory)
+				item.CategoryId = articleDetail.CategoryId
+				item.UserId = uid
+				item.Email = user.Email
+				item.Mobile = user.Mobile
+				item.RealName = user.RealName
+				item.CompanyId = user.CompanyId
+				item.CompanyName = user.CompanyName
+				item.CreateTime = time.Now()
+				item.ModifyTime = time.Now()
+				_, err = models.AddCygxCategoryFllow(item)
+				if err != nil {
+					br.Msg = "操作失败"
+					br.ErrMsg = "操作失败,Err:" + err.Error()
+					return
+				}
+				resp.Status = 1
+			} else {
+				err = models.RemoveCygxCategoryFllow(user.Mobile, articleDetail.CategoryId)
+				if err != nil {
+					br.Msg = "操作失败"
+					br.ErrMsg = "取消关注失败,Err:" + err.Error()
+					return
+				}
+				resp.Status = 2
+			}
+			br.Msg = "操作成功"
+			br.Ret = 200
+			br.Success = true
+			br.Data = resp
+			return
+		} else {
+			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
+}

+ 4 - 3
controllers/tag.go

@@ -2,6 +2,7 @@ package controllers
 
 import (
 	"hongze/hongze_mfyx/models"
+	"hongze/hongze_mfyx/utils"
 )
 
 type TagController struct {
@@ -25,9 +26,9 @@ func (this *TagController) ListLabel() {
 		br.Ret = 408
 		return
 	}
-	list1 := []string{"全部活动", "买方交流", "专家调研", "上市公司小范围"}
-	list2 := []string{"全部报告", "专栏", "纪要", "买方沙龙"}
-	list3 := []string{"主题a", "主题b", "主题c"}
+	list1 := []string{utils.LABEL_L1_1, utils.LABEL_L1_2, utils.LABEL_L1_3, utils.LABEL_L1_4}
+	list2 := []string{utils.LABEL_L2_1, utils.LABEL_L2_2, utils.LABEL_L2_3, utils.LABEL_L2_4}
+	list3 := []string{utils.LABEL_L3_1, utils.LABEL_L3_2, utils.LABEL_L3_3}
 	resp := new(models.CygxTagListLabelResp)
 	resp.List1 = list1
 	resp.List2 = list2

+ 1 - 0
models/activity.go

@@ -238,6 +238,7 @@ type ActivityDetail struct {
 	ImgUrlBgYx                string                     `description:"研选背景图片"`
 	ChartPermissionNameDeputy string                     `description:"副行业名称"`
 	TopTime                   int                        `description:"置顶时间"`
+	LabelKeyword              string                     `description:"标签关键词"`
 }
 type ListArticleActivity struct {
 	Title   string `description:"文章标题"`

+ 0 - 22
models/activity_fastsearch_keywords.go

@@ -1,22 +0,0 @@
-package models
-
-import (
-	"github.com/beego/beego/v2/client/orm"
-)
-
-type ActivityFastsearchKeywords struct {
-	Id      int    `description:"活动类型id"`
-	KeyWord string `description:"关键词"`
-}
-
-type ActivityFastsearchKeywordsListResp struct {
-	List []*ActivityFastsearchKeywords
-}
-
-//列表
-func GetActivityFastsearchKeywordsList() (items []*ActivityFastsearchKeywords, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_activity_fastsearch_keywords ORDER BY sort DESC`
-	_, err = o.Raw(sql).QueryRows(&items)
-	return
-}

+ 0 - 41
models/activity_mirror_word.go

@@ -1,41 +0,0 @@
-package models
-
-import (
-	"github.com/beego/beego/v2/client/orm"
-)
-
-type CygxActivityMirrorWord struct {
-	Id            int    `description:"id"`
-	KeyWord       string `description:"关键词"`
-	MirrorKeyWord string `description:"关键词"`
-}
-
-type ActivityMirrorWordListResp struct {
-	List []*CygxActivityMirrorWord
-}
-
-//列表
-func GetActivityMirrorWordList() (items []*ActivityFastsearchKeywords, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_activity_mirror_word ORDER BY sort DESC`
-	_, err = o.Raw(sql).QueryRows(&items)
-	return
-}
-
-//获取镜像词数量
-func GetActivityMirrorWordCount(keyWord string) (count int, err error) {
-	o := orm.NewOrm()
-	sqlCount := ` SELECT COUNT( 1 ) AS count  FROM cygx_activity_mirror_word WHERE key_word IN (` + keyWord + `) `
-	err = o.Raw(sqlCount).QueryRow(&count)
-	return
-}
-
-func GetMirrorWord(keyWord string) (mirrorword string, err error) {
-	sql := ` SELECT GROUP_CONCAT( DISTINCT m.mirror_key_word SEPARATOR ',' ) AS mirrorword 
-				FROM
-				cygx_activity_mirror_word AS m 
-				WHERE m.key_word IN (` + keyWord + `)`
-	o := orm.NewOrm()
-	err = o.Raw(sql).QueryRow(&mirrorword)
-	return
-}

+ 0 - 18
models/activity_offline_meeting_detail.go

@@ -65,27 +65,9 @@ func UpdateCygxActivityOfflineMeetingDetailSigninTime(activityId, userId int) (e
 	return
 }
 
-// 预约外呼列表
-func GetOfflineMeetingListByUser(meetingUids string, activityId int) (items []*CygxActivityOfflineMeetingDetail, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT s.* FROM cygx_activity_offline_meeting_detail  as s  WHERE activity_id = ? AND user_id IN  (` + meetingUids + `)`
-	_, err = o.Raw(sql, activityId).QueryRows(&items)
-	return
-}
-
 // 报名
 type CygxActivityOfflineMeetingDetailResp struct {
 	ActivityId   int    `description:"活动ID "`
 	ActivityName string `description:"活动名称"`
 	List         []*CygxActivitySignupResp
 }
-
-// 预约外呼列表
-func GetOfflineMeetingListWithUser(condition string, pars []interface{}) (items []*CygxActivitySignupList, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT s.* 
-			FROM cygx_activity_offline_meeting_detail  as s 
-			  WHERE 1 =1 ` + condition
-	_, err = o.Raw(sql, pars).QueryRows(&items)
-	return
-}

+ 0 - 18
models/activity_points_set.go

@@ -31,24 +31,6 @@ type CygxActivityPointsSet struct {
 	ModifyTime         time.Time `gorm:"column:modify_time;NOT NULL" json:"modify_time"` // 更新时间
 }
 
-type CygxActivityPointsSetRsq struct {
-	ActivityId       int    `gorm:"column:activity_id;NOT NULL" json:"ActivityId"`                        // 活动ID
-	PointsObject     int    `gorm:"column:points_object;default:1;NOT NULL" json:"PointsObject"`          // 扣点对象,1:参会人、2:办会人、3:办会人和参会人
-	CompanyId        int    `gorm:"column:company_id;default:0;NOT NULL" json:"CompanyId"`                // 公司ID
-	CompanyName      string `gorm:"column:company_name;NOT NULL" json:"CompanyName"`                      // 公司名称
-	UserPointsNum    string `gorm:"column:user_points_num;default:0;NOT NULL" json:"UserPointsNum"`       // 参会人扣点数量
-	PointsType       int    `gorm:"column:points_type;default:0;NOT NULL" json:"PointsType"`              // 扣点形式,1:报名即扣点,2:到会即扣点
-	CompanyPointsNum string `gorm:"column:company_points_num;default:0;NOT NULL" json:"CompanyPointsNum"` // 办会人扣点数量
-}
-
-type CygxActivityPointsSetConfigListResp struct {
-	List []*CygxActivityPointsSetConfigResp
-}
-
-type CygxActivityPointsSetConfigResp struct {
-	PointsNum string `gorm:"column:user_points_num;default:0;NOT NULL" json:"PointsNum"` // 扣点数量
-}
-
 // 通过活动ID获取详情
 func GetCygxActivityPointsSetDetail(activityId int) (item *CygxActivityPointsSet, err error) {
 	o := orm.NewOrm()

+ 0 - 40
models/activity_restrict_signup.go

@@ -1,40 +0,0 @@
-package models
-
-import (
-	"github.com/beego/beego/v2/client/orm"
-	"hongze/hongze_mfyx/utils"
-)
-
-// 批量添加
-func AddCygxActivityRestrictSignupList(items []*CygxActivityRestrictSignup) (lastId int64, err error) {
-	lenitems := len(items)
-	if lenitems == 0 {
-		return
-	}
-	o := orm.NewOrm()
-	_, err = o.InsertMulti(1, items)
-	return
-}
-
-// 删除
-func DeleteCygxActivityRestrictSignupByUserIds(userIdDelArr []int) (err error) {
-	if len(userIdDelArr) == 0 {
-		return
-	}
-	o := orm.NewOrm()
-	sql := ` DELETE FROM cygx_activity_restrict_signup  WHERE  1= 1  AND user_id IN (` + utils.GetOrmInReplace(len(userIdDelArr)) + `)`
-	_, err = o.Raw(sql, userIdDelArr).Exec()
-	return
-}
-
-// 列表
-func GetCygxActivityRestrictSignupList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityRestrictSignup, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_activity_restrict_signup as art WHERE 1= 1 `
-	if condition != "" {
-		sql += condition
-	}
-	sql += ` LIMIT ?,?  `
-	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-	return
-}

+ 0 - 158
models/activity_special_signup.go

@@ -1,158 +0,0 @@
-package models
-
-import (
-	"github.com/beego/beego/v2/client/orm"
-	"time"
-)
-
-type CygxActivitySpecialSignup struct {
-	Id          int       `orm:"column(id);pk"`
-	ActivityId  int       `description:"活动ID"`
-	UserId      int       `description:"用户ID"`
-	CreateTime  time.Time `description:"创建时间"`
-	Mobile      string    `description:"手机号"`
-	Email       string    `description:"邮箱"`
-	CompanyId   int       `description:"公司id"`
-	CompanyName string    `description:"公司名称"`
-	RealName    string    `description:"用户实际名称"`
-	SellerName  string    `description:"所属销售"`
-}
-
-type SignupSpecialStatus struct {
-	ActivityId    int    `description:"活动ID"`
-	HasPermission int    `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请"`
-	PopupMsg      string `description:"权限弹窗信息"`
-	PopupMsg2     string `description:"权限弹窗信息"`
-	Status        int    `description:"返回类型,1:添加,2:取消"`
-	SellerMobile  string `description:"销售电话"`
-	SellerName    string `description:"销售姓名"`
-	SignupStatus  int    `description:"返回状态:1:成功 、2 :人数已满 、3:调研次数已用完、 4:超时"`
-}
-
-// 添加
-func AddCygxActivitySpecialSignup(item *CygxActivitySpecialSignup) (err error) {
-	o := orm.NewOrm()
-	_, err = o.Insert(item)
-	return
-}
-
-// 获取某一用户的报名的数量
-func GetUserCygxActivitySpecialSignup(uid, activityId int) (count int, err error) {
-	sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_special_signup  WHERE  user_id=?  AND   activity_id =? `
-	o := orm.NewOrm()
-	err = o.Raw(sqlCount, uid, activityId).QueryRow(&count)
-	return
-}
-
-// 删除
-func DeleteCygxActivitySpecialSignup(uid, activityId int) (err error) {
-	o := orm.NewOrm()
-	sql := `DELETE  FROM cygx_activity_special_signup   WHERE   user_id=?   AND  activity_id=?    `
-	_, err = o.Raw(sql, uid, activityId).Exec()
-	return
-}
-
-// 列表
-func GetActivityListSpecialAll(activityId int) (items []*CygxActivitySpecialSignup, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT art.*  FROM cygx_activity_special_signup as art WHERE 1= 1 AND  activity_id = ?  GROUP BY company_id`
-	_, err = o.Raw(sql, activityId).QueryRows(&items)
-	return
-}
-
-// 列表
-func GetActivityListSpecialByActivityId(activityId int) (items []*CygxActivitySpecialSignup, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT art.*  FROM cygx_activity_special_signup as art WHERE 1= 1 AND  activity_id = ? `
-	_, err = o.Raw(sql, activityId).QueryRows(&items)
-	return
-}
-
-type CygxActivitySpecialSignupResp struct {
-	Id          int       `orm:"column(id);pk"`
-	ActivityId  int       `description:"活动ID"`
-	UserId      int       `description:"用户ID"`
-	CreateTime  time.Time `description:"创建时间"`
-	Mobile      string    `description:"手机号"`
-	Email       string    `description:"邮箱"`
-	CompanyId   int       `description:"公司id"`
-	CompanyName string    `description:"公司名称"`
-	RealName    string    `description:"用户实际名称"`
-	SellerName  string    `description:"所属销售"`
-	Count       string    `description:"所属销售"`
-}
-
-// 列表
-func GetActivityListSpecialGroupByMobile(condition string, pars []interface{}) (items []*CygxActivitySpecialSignupResp, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT s.*,	COUNT( 1 ) AS count   FROM cygx_activity_special_signup as s INNER JOIN cygx_activity_special AS a ON a.activity_id = s.activity_id
-			` + condition + `  GROUP BY s.mobile`
-	_, err = o.Raw(sql, pars).QueryRows(&items)
-	return
-}
-
-// 列表
-func GetActivityListSpecialGroupByCompanyId(condition string, pars []interface{}) (items []*CygxActivitySpecialSignupResp, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT *,	COUNT( 1 ) AS count   FROM cygx_activity_special_signup   as s INNER JOIN cygx_activity_special AS a ON a.activity_id = s.activity_id
-			 ` + condition + `  GROUP BY s.company_id`
-	_, err = o.Raw(sql, pars).QueryRows(&items)
-	return
-}
-
-// UpdateActivitySpecialSignupNumMulti 批量修改专项调研感兴趣的人数排名
-func UpdateActivitySpecialSignupNumMulti(items []*CygxActivitySpecialSignupResp) (err error) {
-	o := orm.NewOrm()
-	p, err := o.Raw("UPDATE cygx_activity_special_signup SET user_num = ? WHERE mobile = ?").Prepare()
-	if err != nil {
-		return
-	}
-	defer func() {
-		_ = p.Close() // 别忘记关闭 statement
-	}()
-	for _, v := range items {
-		_, err = p.Exec(v.Count, v.Mobile)
-		if err != nil {
-			return
-		}
-	}
-	return
-}
-
-// UpdateActivitySpecialSignupCompanyIdMulti 批量修改专项调研感兴趣的用户的对应公司ID
-func UpdateActivitySpecialSignupCompanyIdMulti(items []*WxUser) (err error) {
-	o := orm.NewOrm()
-	p, err := o.Raw("UPDATE cygx_activity_special_signup SET company_id = ? WHERE mobile = ?").Prepare()
-	if err != nil {
-		return
-	}
-	defer func() {
-		_ = p.Close() // 别忘记关闭 statement
-	}()
-	for _, v := range items {
-		_, err = p.Exec(v.CompanyId, v.Mobile)
-		if err != nil {
-			return
-		}
-	}
-	return
-}
-
-// UpdateActivitySpecialSignupCompanyNumMulti 批量修改专项调研感兴趣的公司对应的数量
-func UpdateActivitySpecialSignupCompanyNumMulti(items []*CygxActivitySpecialSignupResp) (err error) {
-	o := orm.NewOrm()
-	p, err := o.Raw("UPDATE cygx_activity_special_signup SET company_num = ? WHERE company_id = ?").Prepare()
-	if err != nil {
-		return
-	}
-	defer func() {
-		_ = p.Close() // 别忘记关闭 statement
-	}()
-	for _, v := range items {
-		_, err = p.Exec(v.Count, v.CompanyId)
-		if err != nil {
-			return
-		}
-	}
-	return
-}

+ 1 - 0
models/article.go

@@ -120,6 +120,7 @@ type HomeArticle struct {
 	Cover               string               `description:"封面图片"`
 	BodyHighlight       []string             `description:"搜索高亮展示结果"`
 	ArticleTypeId       int                  `description:"文章类型ID"`
+	LabelKeyword        string               `description:"标签关键词"`
 	List                []*IndustrialManagementIdInt
 }
 

+ 1 - 0
models/cygx_yanxuan_special.go

@@ -105,6 +105,7 @@ type CygxYanxuanSpecialCenterResp struct {
 	Uv              string   `description:"Uv"`
 	PublishDate     string   // 提审过审或驳回时间      string `description:"核心观点"`
 	BodyHighlight   []string `description:"搜索高亮展示结果"`
+	LabelKeyword    string   `description:"标签关键词"`
 }
 
 type Doc struct {

+ 0 - 1
models/db.go

@@ -103,7 +103,6 @@ func init() {
 		new(CygxShanghaiErrLog),
 		new(CygxUserFreeeButton),
 		new(UserInvitee),
-		new(CygxActivitySpecialSignup),
 		new(CygxActivitySpecialMeetingDetail),
 		new(CygxUserFollowSpecial),
 		new(CygxArticleHistoryRecordAll),

+ 0 - 54
models/wx_user.go

@@ -523,48 +523,6 @@ type CygxUserInteractionNumDetail struct {
 	TryStage            int    `description:"试用客户子标签:0全部、1未分类、2 推进、3 跟踪、4 预备"`
 }
 
-// 获取用户的互动量
-func GetCygxCompanyUserUserInteraction(userIds string) (items []*CygxUserInteractionNumDetail, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-			u.user_id,
-			u.company_id,
-			( SELECT COUNT( 1 ) FROM cygx_article_history_record_all AS h  INNER JOIN cygx_article  as art  ON  art.article_id = h.article_id  WHERE h.mobile = u.mobile AND h.is_del = 0   AND h.mobile <>'' ) AS history_num,
-			( SELECT COUNT( 1 ) FROM cygx_article_collect AS h WHERE h.user_id = u.user_id  ) AS count_num,
-			( SELECT COUNT( 1 ) FROM cygx_chart_collect AS h WHERE h.user_id = u.user_id  ) AS chart_count_num,
-			( SELECT COUNT( 1 ) FROM cygx_industry_fllow AS h WHERE h.user_id = u.user_id  ) AS industry_fllow_num,
-			( SELECT COUNT( 1 ) FROM cygx_article_department_follow AS h WHERE h.user_id = u.user_id   ) AS department_follow_num,
-			( SELECT COUNT( 1 ) FROM cygx_search_key_word_log AS h WHERE h.user_id = u.user_id  ) AS key_word_num,
-			( SELECT COUNT( 1 ) FROM cygx_activity_signup_detail AS h INNER JOIN cygx_activity as a ON a.activity_id = h.activity_id  INNER JOIN cygx_activity_type as t ON t.activity_type_id = a.activity_type_id   WHERE h.mobile = u.mobile  
-					 AND t.activity_type = 1  AND h.do_fail_type = 0 ) AS on_line_num,
-			( SELECT COUNT( 1 ) FROM cygx_activity_signup_detail AS h INNER JOIN cygx_activity as a ON a.activity_id = h.activity_id  INNER JOIN cygx_activity_type as t ON t.activity_type_id = a.activity_type_id   WHERE h.mobile = u.mobile  
-					  AND t.activity_type = 0 AND h.do_fail_type = 0 ) AS office_num,
-			( SELECT COUNT( 1 ) FROM cygx_activity_special_trip AS h INNER JOIN cygx_activity_special AS a ON a.activity_id = h.activity_id WHERE h.mobile = u.mobile  AND h.is_cancel = 0 ) AS trip_num,
-						( SELECT COUNT( 1 ) FROM cygx_micro_roadshow_video_history AS h  INNER JOIN cygx_micro_roadshow_video as v ON v.video_id = h.video_id WHERE  h.mobile = u.mobile  ) AS roadshow_video_num,
-						( SELECT COUNT( 1 ) FROM cygx_activity_video_history AS h  INNER JOIN cygx_activity_video as v ON v.video_id = h.video_id WHERE  h.mobile = u.mobile  ) AS activity_video_num,
-						( SELECT COUNT( 1 ) FROM cygx_activity_voice_history AS h  INNER JOIN cygx_activity_voice as v ON v.activity_voice_id = h.activity_voice_id WHERE  h.mobile = u.mobile  ) AS activity_voice_num,
-			(
-			SELECT
-				GROUP_CONCAT( DISTINCT man.industry_name SEPARATOR ',' ) 
-			FROM
-				cygx_industrial_management AS man 
-			WHERE
-				man.industrial_management_id IN ( SELECT industrial_management_id FROM cygx_industry_fllow AS f WHERE f.user_id = u.user_id  AND f.type = 1 ) 
-			) AS labels,
-			( SELECT COUNT( 1 ) FROM cygx_tag_history AS h WHERE h.user_id = u.user_id  ) AS tag_num,
-			(
-			SELECT
-				GROUP_CONCAT( DISTINCT man.label SEPARATOR ',' ) 
-			FROM
-				cygx_activity AS man 
-			WHERE
-				man.activity_id IN ( SELECT activity_id FROM cygx_activity_signup AS f WHERE f.user_id = u.user_id  AND label != '') 
-			) AS activity_label
-		FROM ` + utils.GetWeeklyDatabase() + `.wx_user AS u  WHERE  u.user_id IN( ` + userIds + `)  	GROUP BY u.user_id  `
-	_, err = o.Raw(sql).QueryRows(&items)
-	return
-}
-
 // GetWxUserListByUserIds 根据用户ID集合获取用户
 func GetWxUserListByUserIds(userIds string) (list []*WxUserItem, err error) {
 	o := orm.NewOrmUsingDB("weekly_report")
@@ -620,15 +578,3 @@ func GetWxUserOutboundMobiles(mobiles []string) (item []*WxUserOutboundMobile, e
 	_, err = o.Raw(sql, mobiles, mobiles).QueryRows(&item)
 	return
 }
-
-// 获取所有注册的权益用户
-func GetUserRegisterListinit() (items []*WxUser, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-				* 
-			FROM
-				cygx_user_label
-			GROUP BY user_id `
-	_, err = o.Raw(sql).QueryRows(&items)
-	return
-}

+ 0 - 108
routers/commentsRouter.go

@@ -7,15 +7,6 @@ import (
 
 func init() {
 
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityABaseController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityABaseController"],
-        beego.ControllerComments{
-            Method: "FastSearch",
-            Router: `/fastSearchKeWord`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
     beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityCoAntroller"],
         beego.ControllerComments{
             Method: "List",
@@ -79,33 +70,6 @@ func init() {
             Filters: nil,
             Params: nil})
 
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityCoAntroller"],
-        beego.ControllerComments{
-            Method: "GetUserSearchContent",
-            Router: `/getUserSearchContent`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityCoAntroller"],
-        beego.ControllerComments{
-            Method: "LabelMoreList",
-            Router: `/labelMoreList`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityCoAntroller"],
-        beego.ControllerComments{
-            Method: "ActivityListNew",
-            Router: `/listNew`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
     beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ActivityCoAntroller"],
         beego.ControllerComments{
             Method: "MeetingReminderAdd",
@@ -268,78 +232,6 @@ func init() {
             Filters: nil,
             Params: nil})
 
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseConfigController"],
-        beego.ControllerComments{
-            Method: "ResearchHb",
-            Router: `/research/hb`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseConfigController"],
-        beego.ControllerComments{
-            Method: "ResearchIntroduce",
-            Router: `/research/introduce`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseConfigController"],
-        beego.ControllerComments{
-            Method: "ResearchQuotation",
-            Router: `/research/quotation`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:CollectionController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:CollectionController"],
-        beego.ControllerComments{
-            Method: "ApplyAdd",
-            Router: `/apply/add`,
-            AllowHTTPMethods: []string{"post"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:CollectionController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:CollectionController"],
-        beego.ControllerComments{
-            Method: "ApplyDetail",
-            Router: `/apply/detail`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:CollectionController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:CollectionController"],
-        beego.ControllerComments{
-            Method: "BannerList",
-            Router: `/banner/list`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:CollectionController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:CollectionController"],
-        beego.ControllerComments{
-            Method: "Detail",
-            Router: `/detail`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ConfigController"],
-        beego.ControllerComments{
-            Method: "AboutUsAdd",
-            Router: `/aboutUs/addHistory`,
-            AllowHTTPMethods: []string{"post"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
     beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ConfigController"],
         beego.ControllerComments{
             Method: "DescriptionOfResearch",

+ 5 - 5
routers/router.go

@@ -71,6 +71,11 @@ func init() {
 				&controllers.ActivityNoLoginController{},
 			),
 		),
+		web.NSNamespace("/industry",
+			web.NSInclude(
+				&controllers.IndustryController{},
+			),
+		),
 		web.NSNamespace("/research",
 			web.NSInclude(
 				&controllers.ResearchController{},
@@ -91,11 +96,6 @@ func init() {
 				&controllers.TagController{},
 			),
 		),
-		web.NSNamespace("/collection",
-			web.NSInclude(
-				&controllers.CollectionController{},
-			),
-		),
 		web.NSNamespace("/yanxuan_special",
 			web.NSInclude(
 				&controllers.YanxuanSpecialController{},

+ 13 - 1
services/activity.go

@@ -1016,6 +1016,17 @@ func ActivityArrButtonShow(items []*models.ActivityDetail) (activityDetails []*m
 			activityDetail.IsResearch = false
 			activityDetail.IsResearchSpecial = false
 		}
+
+		if activityDetail.ActivityTypeName == "买方线下交流" {
+			activityDetail.LabelKeyword = utils.LABEL_L1_2
+		}
+		if activityDetail.ActivityTypeName == "专家电话会" || activityDetail.ActivityTypeName == "专家线下沙龙" {
+			activityDetail.LabelKeyword = utils.LABEL_L1_3
+		}
+		if activityDetail.ActivityTypeName == "公司调研电话会" {
+			activityDetail.LabelKeyword = utils.LABEL_L1_4
+		}
+
 		activityDetails = append(activityDetails, activityDetail)
 	}
 	return
@@ -1284,12 +1295,13 @@ func GetYanxuanActivityIds() (activityIds []int) {
 	var err error
 	defer func() {
 		if err != nil {
+			fmt.Println(err)
 			go utils.SendAlarmMsg("获取研选活动ID GetYanxuanActivityIds,失败:"+err.Error(), 2)
 		}
 	}()
 	var condition string
 	var pars []interface{}
-	condition = `  chart_permission_id  = ? AND yidong_activity_id = ''  `
+	condition = `   AND  chart_permission_id  = ? AND yidong_activity_id = ''  `
 	pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
 	list, e := models.GetCygxActivityIdList(condition, pars)
 	if e != nil {

+ 7 - 2
services/article.go

@@ -265,6 +265,11 @@ func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeA
 		//是不是研选报告
 		if v.ArticleTypeId > 0 {
 			list[k].IsResearch = true
+			if v.ArticleTypeId == 12 {
+				list[k].LabelKeyword = "研选沙龙"
+			} else {
+				list[k].LabelKeyword = "纪要"
+			}
 		}
 
 	}
@@ -550,13 +555,13 @@ func GetYanxuanArticleIds() (articleIds []int) {
 	var err error
 	defer func() {
 		if err != nil {
+			fmt.Println(err)
 			go utils.SendAlarmMsg("获取研选文章ID GetYanxuanArticleIds,失败:"+err.Error(), 2)
 		}
 	}()
 	var condition string
 	var pars []interface{}
-	condition = `  article_type_id > 0   `
-	pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
+	condition = ` AND  article_type_id > 0   `
 	list, e := models.GetCygxCygxArticleIdList(condition, pars)
 	if e != nil {
 		err = errors.New("GetCygxCygxArticleIdList, Err: " + e.Error())

+ 0 - 28
services/config.go

@@ -7,7 +7,6 @@ import (
 	"hongze/hongze_mfyx/utils"
 	"strconv"
 	"strings"
-	"time"
 )
 
 // 是否展示限免标签
@@ -83,33 +82,6 @@ func init1231() {
 	}
 }
 
-// 添加关于我们浏览记录
-func AddCygxAboutUsVideoHistory(user *models.WxUserItem) (err error) {
-	defer func() {
-		if err != nil {
-			go utils.SendAlarmMsg("产品内测用户浏览信息记录失败"+err.Error(), 2)
-		}
-	}()
-	historyRecord := new(models.CygxAboutUsVideoHistory)
-	historyRecord.UserId = user.UserId
-	historyRecord.CreateTime = time.Now()
-	historyRecord.Mobile = user.Mobile
-	historyRecord.Email = user.Email
-	historyRecord.CompanyId = user.CompanyId
-	historyRecord.CompanyName = user.CompanyName
-	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		return
-	}
-	historyRecord.RealName = user.RealName
-	historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM
-	if sellerItem != nil {
-		historyRecord.SellerName = sellerItem.RealName
-	}
-	_, err = models.AddCygxAboutUsVideoHistory(historyRecord)
-	return
-}
-
 // CheckYxSpecialIsApprovalPersonnel 校验手机号是否属于研选专栏的审核人员
 func CheckYxSpecialIsApprovalPersonnel(mobile string) (isApprovalPersonnel bool) {
 	var err error

+ 1 - 0
services/resource_data.go

@@ -422,6 +422,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			// Source  PublishDate 字段兼容前端样式
 			v.Source = utils.CYGX_OBJ_YANXUANSPECIAL
 			v.PublishDate = v.PublishTime
+			v.LabelKeyword = "专栏"
 			mapItems[fmt.Sprint(utils.CYGX_OBJ_YANXUANSPECIAL, v.Id)].YanxuanSpecial = v
 		}
 	}

+ 64 - 189
services/tag.go

@@ -5,7 +5,6 @@ import (
 	"hongze/hongze_mfyx/models"
 	"hongze/hongze_mfyx/utils"
 	"strconv"
-	"strings"
 	"time"
 )
 
@@ -46,217 +45,93 @@ func AddCygxTagHistory(user *models.WxUserItem, tagId int) (err error) {
 //	fmt.Println(conditionInit)
 //}
 
-func GetConditionInitByTagIds(tagIds string, chartPermissionId int) (conditionInit string, err error) {
-	if tagIds == "" {
-		return
-	}
+//const (
+//	LABEL_L1_1 string = "全部活动"    // 全部活动
+//	LABEL_L1_2 string = "买方交流"    // 买方交流
+//	LABEL_L1_3 string = "专家调研"    // 专家调研
+//	LABEL_L1_4 string = "上市公司小范围" // 上市公司小范围
+//	LABEL_L2_1 string = "全部报告"    // 全部报告
+//	LABEL_L2_2 string = "专栏"      // 专栏
+//	LABEL_L2_3 string = "纪要"      // 纪要
+//	LABEL_L2_4 string = "买方沙龙"    // 买方沙龙
+//	LABEL_L3_1 string = "主题a"     // 主题a
+//	LABEL_L3_2 string = "主题b"     // 主题b
+//	LABEL_L3_3 string = "主题c"     // 主题c
+//)
+
+func GetConditionInitByTagIds(labelKeyword string) (yanxuanActivityIdsResp, yanxuanArticleIdsResp []int, err error) {
+	var yanxuanActivityIds []int
+	var yanxuanArticleIds []int
 	var condition string
 	var pars []interface{}
-	var searchTag, industries, subjectNames []string
-	tagslice := strings.Split(tagIds, ",")
-	condition = ` AND tag_id IN (` + utils.GetOrmInReplace(len(tagslice)) + `)`
-	pars = append(pars, tagslice)
-	listTag, e := models.GetCygxTagListCondition(condition, pars, 0, 0)
-	if e != nil {
-		err = errors.New("GetCygxTagListCondition, Err: " + e.Error())
-		return
-	}
-
-	var tagType int // 定义特殊标签的类型,判断传过来的参数是否有固定标签的搜索
-	for _, tagInfo := range listTag {
-		//ActivityTypes 与 ArticleTypes 进行合并
-		if tagInfo.ActivityTypes != "" {
-			sliceObj := strings.Split(tagInfo.ActivityTypes, ",")
-			for _, v := range sliceObj {
-				searchTag = append(searchTag, v)
-			}
-		}
-		if tagInfo.ArticleTypes != "" {
-			sliceObj := strings.Split(tagInfo.ArticleTypes, ",")
-			for _, v := range sliceObj {
-				searchTag = append(searchTag, v)
-			}
-		}
-		if tagInfo.Industries != "" {
-			sliceObj := strings.Split(tagInfo.Industries, ",")
-			for _, v := range sliceObj {
-				industries = append(industries, v)
-			}
-			//industries = append(industries, tagInfo.Industries)
-		}
-		if tagInfo.SubjectNames != "" {
-			sliceObj := strings.Split(tagInfo.SubjectNames, ",")
-			for _, v := range sliceObj {
-				subjectNames = append(subjectNames, v)
-			}
-			//subjectNames = append(subjectNames, tagInfo.SubjectNames)
-		}
-
-		if tagType == 0 && tagInfo.TagType > 0 {
-			tagType = tagInfo.TagType
-		}
-	}
-
-	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, "','") + "' )  )"
-		}
-
-		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)
-			}
-
-			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)
-				if e != nil {
-					err = errors.New("GetCygxResourceDataIndustrialGroupSubjectList, Err: " + e.Error())
-					return
-				}
-				for _, v := range listResourceDatasubject {
-					resourceDataIds = append(resourceDataIds, v.ResourceDataId)
-				}
-			}
+	switch labelKeyword {
+	case utils.LABEL_L1_1: // 全部活动
+		yanxuanActivityIds = GetYanxuanActivityIds() // 获取所有的研选活动ID
+	case "买方交流": // 买方交流 ->买方线下交流
+		condition = `   AND  chart_permission_id  = ? AND yidong_activity_id = ''  AND activity_type_id = 8  `
+		pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
+		list, e := models.GetCygxActivityIdList(condition, pars)
+		if e != nil {
+			err = errors.New("GetCygxActivityIdList, Err: " + e.Error())
+			return
 		}
-
-		//拼接 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, ",") + ") "
+		for _, v := range list {
+			yanxuanActivityIds = append(yanxuanActivityIds, v.ActivityId)
 		}
-	case 1: // 热门活动
-		conf, e := models.GetConfigByCode(utils.CYGX_TAG_HOT_ACTIVITY_ID)
+	case "专家调研": // 专家调研->专家电话会+专家线下沙龙
+		condition = `   AND  chart_permission_id  = ? AND yidong_activity_id = ''  AND activity_type_id IN  (1,5) `
+		pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
+		list, e := models.GetCygxActivityIdList(condition, pars)
 		if e != nil {
-			err = errors.New("GetConfigByCode, Err: " + e.Error())
+			err = errors.New("GetCygxActivityIdList, Err: " + e.Error())
 			return
 		}
-		//主键ID赋值为0,进行空查询
-		if conf.ConfigValue == "" {
-			conditionInit += " AND id = 0  "
-			return
+		for _, v := range list {
+			yanxuanActivityIds = append(yanxuanActivityIds, v.ActivityId)
 		}
-		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)
+
+	case "上市公司小范围": // 上市公司小范围->公司调研电话会
+		condition = `   AND  chart_permission_id  = ? AND yidong_activity_id = ''  AND activity_type_id = 3 `
+		pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
+		list, e := models.GetCygxActivityIdList(condition, pars)
 		if e != nil {
-			err = errors.New("GetActivityListByCondition, Err: " + e.Error())
+			err = errors.New("GetCygxActivityIdList, Err: " + e.Error())
 			return
 		}
-		if len(listActivity) == 0 {
-			conditionInit += " AND id = 0  "
-			return
+		for _, v := range list {
+			yanxuanActivityIds = append(yanxuanActivityIds, v.ActivityId)
 		}
+	case "全部报告": // 全部报告
+		yanxuanArticleIds = GetYanxuanArticleIds() //获取所有研选文章ID
 
-		//拼接查询热门活动的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 "专栏": //专栏
+
+	case "纪要": //纪要
 
-	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)
+		condition = ` AND  article_type_id > 0  AND  article_type_id != 12  `
+		list, e := models.GetCygxCygxArticleIdList(condition, pars)
 		if e != nil {
-			err = errors.New("GetArticleList, Err: " + e.Error())
+			err = errors.New("GetCygxCygxArticleIdList, Err: " + e.Error())
 			return
 		}
-		//文章一定会有值,这里就不做为空判断了 。。。
-		var articleIds []string
-		for _, v := range articleList {
-			articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
+		for _, v := range list {
+			yanxuanArticleIds = append(yanxuanArticleIds, v.ArticleId)
 		}
 
-		//海外举办的活动查询
-		condition = " AND  area_type = 2  AND publish_status = 1   "
-		listActivity, e := models.GetActivityListByCondition(condition, pars)
+		yanxuanArticleIds = GetYanxuanArticleIds() //获取所有研选文章ID
+	case "买方沙龙": // 买方沙龙
+		condition = `  AND  article_type_id = 12  `
+		list, e := models.GetCygxCygxArticleIdList(condition, pars)
 		if e != nil {
-			err = errors.New("GetActivityListByCondition, Err: " + e.Error())
+			err = errors.New("GetCygxCygxArticleIdList, 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 + " ' )"
+		for _, v := range list {
+			yanxuanArticleIds = append(yanxuanArticleIds, v.ArticleId)
 		}
-
-	case 3: // 路演回放
-		conditionInit = "  AND source  IN('activityvoice','activityvideo')  AND  search_tag = '路演回放' "
-
-	case 4: // 语音问答
-		conditionInit = "   AND source = '" + utils.CYGX_OBJ_ASKSERIEVIDEO + "'"
+		yanxuanArticleIds = GetYanxuanArticleIds() //获取所有研选文章ID
 	}
-
+	yanxuanActivityIdsResp = yanxuanActivityIds
+	yanxuanArticleIdsResp = yanxuanArticleIds
 	return
 }

+ 19 - 0
utils/constants.go

@@ -271,3 +271,22 @@ func GetWeeklyDatabase() (databaseName string) {
 const (
 	DISCLAIMERS string = "<div style=\"padding:20px\"><p>本报告仅供弘则弥道(上海)投资咨询有限公司正式签约的机构客户使用,不会因接收人/接收机构收到本报告而将其视为客户。本报告根据国际和行业通行的准则,以合法渠道获得这些信息,尽可能保证可靠、准确和完整,但并不保证报告所述信息的准确性和完整性,也不保证本报告所包含的信息或建议在本报告发出后不会发生任何变更。本报告中所提供的信息仅供参考。报告中的内容不对投资者做出的最终操作建议做任何的担保,也没有任何形式的分享投资收益或者分担投资损失的书面或口头承诺。不作为客户在投资、法律、会计或税务等方面的最终操作建议,也不作为道义的、责任的和法律的依据或者凭证,无论是否已经明示或者暗示。在任何情况下,本公司不对客户/接收人/接收机构因使用报告中内容所引致的一切损失负责任,客户/接收人/接收机构需自行承担全部风险。</p></div>"
 )
+
+//list1 := []string{"全部活动", "买方交流", "专家调研", "上市公司小范围"}
+//list2 := []string{"全部报告", "专栏", "纪要", "买方沙龙"}
+//list3 := []string{"主题a", "主题b", "主题c"}
+
+// 首页自定义标签
+const (
+	LABEL_L1_1 string = "全部活动"    // 全部活动
+	LABEL_L1_2 string = "买方交流"    // 买方交流
+	LABEL_L1_3 string = "专家调研"    // 专家调研
+	LABEL_L1_4 string = "上市公司小范围" // 上市公司小范围
+	LABEL_L2_1 string = "全部报告"    // 全部报告
+	LABEL_L2_2 string = "专栏"      // 专栏
+	LABEL_L2_3 string = "纪要"      // 纪要
+	LABEL_L2_4 string = "买方沙龙"    // 买方沙龙
+	LABEL_L3_1 string = "主题a"     // 主题a
+	LABEL_L3_2 string = "主题b"     // 主题b
+	LABEL_L3_3 string = "主题c"     // 主题c
+)