Bladeren bron

Merge branch 'master' of http://8.136.199.33:3000/cxzhang/hongze_clpt into cygx_10.5.3

xingzai 1 jaar geleden
bovenliggende
commit
e6225cb4c3

+ 17 - 8
controllers/activity.go

@@ -358,7 +358,7 @@ func (this *ActivityController) ActivityListNew() {
 				list[k].VideoDetail = mapActivityVideo[v.ActivityId]
 			}
 		}
-		activityList = append(activityList, services.ActivityButtonShow(list[k], user))
+		activityList = append(activityList, services.ActivityButtonShow(list[k], user, permissionArr))
 	}
 
 	//处理不同的报名方式按钮回显
@@ -477,15 +477,17 @@ func (this *ActivityController) Detail() {
 	}
 	activityInfo.SignupNum = signupCount
 
-	havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
 		return
 	}
+	resp.IsResearchSpecial = isResearchSpecial
 	if havePower {
 		resp.HasPermission = 1
-		detailResp := services.ActivityButtonShow(activityInfo, user)
+		//permissionArr := make([]string, 0)
+		detailResp := services.ActivityButtonShow(activityInfo, user, make([]string, 0))
 		detailResp, err = services.ActivityDetaailShow(detailResp)
 		if err != nil {
 			br.Msg = "获取信息失败"
@@ -676,12 +678,13 @@ func (this *ActivityController) SignupAdd() {
 		signupType = 4
 	}
 
-	havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
 		return
 	}
+	resp.IsResearchSpecial = isResearchSpecial
 	if havePower {
 		item := new(models.CygxActivitySignup)
 		item.RegisterPlatform = utils.REGISTER_PLATFORM
@@ -1063,12 +1066,13 @@ func (this *ActivityController) MeetingReminderAdd() {
 		return
 	}
 
-	havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
 		return
 	}
+	resp.IsResearchSpecial = isResearchSpecial
 	if havePower {
 		item := new(models.CygxActivityMeetingReminder)
 		item.RegisterPlatform = utils.REGISTER_PLATFORM
@@ -1258,12 +1262,13 @@ func (this *ActivityController) ActivityAppointmentAdd() {
 		return
 	}
 
-	havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
 		return
 	}
+	resp.IsResearchSpecial = isResearchSpecial
 	if havePower {
 		item := new(models.CygxActivityAppointment)
 		item.RegisterPlatform = utils.REGISTER_PLATFORM
@@ -1464,12 +1469,13 @@ func (this *ActivityController) AskAdd() {
 	}
 	resp := new(models.SignupStatus)
 
-	havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
 		return
 	}
+	resp.IsResearchSpecial = isResearchSpecial
 	if havePower {
 		companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
 		if err != nil {
@@ -1718,6 +1724,9 @@ func (this *ActivityController) ActivityListSearch() {
 		// 判断是否属于研选类型的活动
 		if strings.Contains(v.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
 			item.IsResearch = true
+			if (v.ActivityTypeId == 3 || v.ActivityTypeId == 5) && v.YidongActivityId == "" && strings.Contains(v.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) && utils.InArrayByStr(permissionArr, utils.CHART_PERMISSION_NAME_MF_YANXUAN) {
+				item.IsResearchSpecial = true
+			}
 		}
 		if v.VoiceList != nil || v.VideoDetail != nil {
 			item.AudioLink = true
@@ -2008,7 +2017,7 @@ func (this *ActivityController) ScheduleList() {
 		}
 		v.SignupType = mapActivitySignup[v.ActivityId]
 		//处理列表的标签是否展示逻辑
-		resp.List = append(resp.List, services.ActivityButtonShow(v, user))
+		resp.List = append(resp.List, services.ActivityButtonShow(v, user, make([]string, 0)))
 	}
 	resp.Paging = page
 	br.Ret = 200

+ 124 - 0
controllers/article.go

@@ -669,3 +669,127 @@ func (this *ArticleController) ArticleHotList() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 上传文章阅读时间
+// @Description 上传文章阅读时间接口
+// @Param  request	body models.AddStopTimeRep true "type json string"
+// @Success 200 {object} models.ArticleDetailResp
+// @router /addStopTime [post]
+func (this *ArticleController) AddStopTime() {
+	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.AddStopTimeRep
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	uid := user.UserId
+	articleId := req.ArticleId
+	stopTime := req.StopTime
+	outType := req.OutType
+	//source := req.Source
+	if articleId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误"
+		return
+	}
+	if stopTime == 0 {
+		stopTime = 1
+	}
+	if outType != 2 {
+		outType = 1
+	}
+	//source = "WEB"
+	detail := new(models.ArticleDetail)
+	hasPermission := 0
+	hasFree := 0
+
+	//判断是否已经申请过
+	applyCount, err := models.GetApplyRecordCount(uid)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
+		return
+	}
+	//`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
+	if user.CompanyId > 1 {
+		companyPermission, err := models.GetCompanyPermission(user.CompanyId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		detail, err = models.GetArticleDetailById(articleId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取文章信息失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		if companyPermission == "" {
+			if applyCount > 0 {
+				hasPermission = 5
+			} else {
+				hasPermission = 2
+			}
+			hasFree = 2
+			goto Loop
+		} else {
+			hasFree = 1
+			var articlePermissionPermissionName string
+			if detail.CategoryId > 0 {
+				articlePermission, err := models.GetArticlePermission(detail.CategoryId)
+				if err != nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "获取报告权限失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+					return
+				}
+				if articlePermission == nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "报告权限不存在,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+					return
+				}
+				articlePermissionPermissionName = articlePermission.PermissionName
+			} else {
+				articlePermissionPermissionName = detail.CategoryName
+			}
+			var hasPersion bool
+			slice := strings.Split(articlePermissionPermissionName, ",")
+			for _, v := range slice {
+				if strings.Contains(companyPermission, v) {
+					hasPersion = true
+				}
+			}
+			if hasPersion {
+				go services.ArticleHistoryStopTime(articleId, stopTime, outType, user)
+			} else { //无该行业权限
+				hasPermission = 3
+			}
+		}
+	} else { //潜在客户
+		if applyCount > 0 {
+			hasPermission = 5
+		} else {
+			hasPermission = 4
+		}
+	}
+Loop:
+	resp := new(models.ArticleDetailAddStopTimeRep)
+	resp.HasPermission = hasPermission
+	resp.HasFree = hasFree
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+	br.Data = resp
+}

+ 44 - 156
controllers/report.go

@@ -86,23 +86,6 @@ func (this *MobileReportController) TradeList() {
 				mapCategory[v.IdCygx] = v.IdCygx
 			}
 		}
-		//for k, v := range list {
-		//count, err := models.GetUserIsReadThisNewCategoryArticleCount(v.CategoryId, uid)
-		//if err != nil && err.Error() != utils.ErrNoRow() {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
-		//	return
-		//}
-		//Newdetail, err := models.GetNewArticleByCategoryId(v.CategoryId)
-		//if err != nil {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "获取信息失败,Err:" + err.Error()
-		//	return
-		//}
-		//if count == 0 && user.CreatedTime.Before(utils.StrTimeToTime(Newdetail.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(Newdetail.PublishDate)) {
-		//	list[k].IsRed = true
-		//}
-		//}
 	} else {
 		listCategory, err := models.GetTradeArticleAndProductInterior(ChartPermissionId)
 		if err != nil {
@@ -119,6 +102,10 @@ func (this *MobileReportController) TradeList() {
 			categoryMap[v.CategoryId] = v.CategoryId
 			list = append(list, v)
 		}
+		//加了一个需求,现有数据结构不支持,手动添加  2023-06-12
+		//if ChartPermissionId == utils.KE_JI_ID {
+		//	list = append(list, &models.TradeReportMapping{MatchTypeName: "AI前沿", CategoryId: utils.ACTEGORY_ID_AI_QY})
+		//}
 	}
 
 	if err != nil {
@@ -128,55 +115,23 @@ func (this *MobileReportController) TradeList() {
 	}
 
 	for k, v := range list {
-
-		//var condition string
-		//var pars []interface{}
-
-		//categoryIdSet, errCategory := models.GetdetailByCategoryIdSet(v.CategoryId)
-		//if errCategory != nil {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(v.CategoryId)
-		//	return
-		//}
-		//if categoryIdSet != "" {
-		//	condition = ` AND a.category_id IN(` + categoryIdSet + `)`
-		//} else {
-		//	condition = ` AND a.category_id IN(` + strconv.Itoa(v.CategoryId) + `)`
-		//}
-
-		//if v.PolymerizationId != "" {
-		//	condition = ` AND a.category_id IN(` + v.PolymerizationId + `)`
-		//} else {
-		//	condition = ` AND a.category_id IN(` + strconv.Itoa(v.CategoryId) + `)`
-		//}
-
 		if ChartPermissionId != utils.CE_LUE_ID && ChartPermissionId != utils.GU_SHOU_ID {
 			var pageSize int
-			//if ChartPermissionId == utils.KE_JI_ID {
-			//	pageSize = 12
-			//} else {
-			//	pageSize = 3
-			//}
-
+			var listArticle []*models.HomeArticle
 			pageSize = 3
-			listArticle, _, err := models.GetReportAndproductIndustrylList(v.CategoryId, 0, pageSize)
+			if v.CategoryId == utils.ACTEGORY_ID_AI_QY {
+				//加了一个需求,现有数据结构不支持,手动添加  2023-06-12
+				listArticle, _, err = services.GetAiQianYanArtilceList(0, pageSize)
+			} else {
+				listArticle, _, err = models.GetReportAndproductIndustrylList(v.CategoryId, 0, pageSize)
+			}
 			if err != nil {
 				br.Msg = "获取信息失败"
 				br.Msg = "GetHomeList,Err:" + err.Error()
 				return
 			}
-
 			if len(listArticle) > 0 {
 				list[k].UpdateTime = utils.StrTimeToTime(listArticle[0].PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
-				//count, err := models.CheckThisCategoryNewArticleIsRead(uid, v.CategoryId)
-				//if err != nil {
-				//	br.Msg = "获取信息失败"
-				//	br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
-				//	return
-				//}
-				//if count == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.UpdateTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.UpdateTime)) {
-				//	list[k].IsRed = true
-				//}
 			}
 			list[k].ListArticle = listArticle
 		} else {
@@ -801,6 +756,7 @@ func (this *ReportController) IndustrialFllow() {
 	}
 	//处理是否关注全部赛道字段
 	go services.IndustryFllowWithTrack(industrialManagementId, count, uid)
+	go services.IndustryFllowUserLabelLogAdd(industrialManagementId, count, uid) //处理用户标签
 	br.Ret = 200
 	br.Success = true
 	br.Data = resp
@@ -897,6 +853,7 @@ func (this *ReportController) CategoryFllow() {
 		resp.Status = 2
 		br.Msg = "已取消关注"
 	}
+	go services.CategoryFllowUserLabelLogAdd(categoryId, count, uid) //处理用户标签
 	br.Ret = 200
 	br.Success = true
 	br.Data = resp
@@ -1778,7 +1735,7 @@ func (this *ReportController) ResearchDetail() {
 			listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
 		}
 	}
-	go services.AddCygxReportHistoryRecord(user, articleId, "bzyjhz")
+	//go services.AddCygxReportHistoryRecord(user, articleId, "bzyjhz")
 	resp.List = listFirst
 	resp.Detail = detail
 	br.Ret = 200
@@ -1886,7 +1843,7 @@ func (this *ReportController) MinutesDetail() {
 		}
 	}
 
-	go services.AddCygxReportHistoryRecord(user, articleId, "szjyhz")
+	//go services.AddCygxReportHistoryRecord(user, articleId, "szjyhz")
 	resp.List = listFirst
 	resp.Detail = detail
 	br.Ret = 200
@@ -2110,107 +2067,38 @@ func (this *MobileReportController) TacticsList() {
 			return
 		}
 	} else {
-		//获取该产业下所对应的行业图片
-		//var reportType int
-		//if industrialManagementId > 0 {
-		//	reportType = 2
-		//} else {
-		//	reportType = 1
-		//}
-		//detail, errCategory := models.GetdetailByCategoryIdOne(categoryId, reportType)
-		//if errCategory != nil {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
-		//	return
-		//}
-		////对应行业的图片
-		//detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
-		//if err != nil {
-		//	br.Msg = "获取数据失败"
-		//	br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
-		//	return
-		//}
-		//chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
-		//mapChartPermission := make(map[string]string)
-		//var permissionName string
-		//var imgUrlChartPermission string
-		//for _, v := range chartPermissionUrlList {
-		//	vslice := strings.Split(v, "_")
-		//	permissionName = vslice[0]
-		//	imgUrlChartPermission = vslice[len(vslice)-1]
-		//	mapChartPermission[permissionName] = imgUrlChartPermission
-		//}
-		//
-		////对应分类的所图片
-		//detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
-		//if err != nil {
-		//	br.Msg = "获取数据失败"
-		//	br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
-		//	return
-		//}
-		//categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
-		//mapCategoryUrl := make(map[string]string)
-		//var categoryIdStr string
-		//var imgUrlChart string
-		//for _, v := range categoryUrlList {
-		//	vslice := strings.Split(v, "_")
-		//	categoryIdStr = vslice[0]
-		//	imgUrlChart = vslice[len(vslice)-1]
-		//	mapCategoryUrl[categoryIdStr] = imgUrlChart
-		//}
-		//if detail.CeLueFieldId != "" {
-		//	condition = ` AND ce_lue_field_id IN(` + detail.CeLueFieldId + `)`
-		//} else if detail.PolymerizationId != "" {
-		//	condition = ` AND category_id IN(` + detail.PolymerizationId + `)`
-		//} else {
-		//	categoryIdSet, errCategory := models.GetdetailByCategoryIdSet(categoryId)
-		//	if errCategory != nil {
-		//		br.Msg = "获取信息失败"
-		//		br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
-		//		return
-		//	}
-		//	if categoryIdSet != "" {
-		//		condition = ` AND category_id IN(` + categoryIdSet + `)`
-		//	} else {
-		//		condition = ` AND category_id IN(` + strconv.Itoa(categoryId) + `)`
-		//	}
-		//}
-		//
-		//if industrialManagementId > 0 {
-		//	industrialManageentList, err := models.GetIndustrialArticleGroupManagementByIndustrialManagementId(industrialManagementId)
-		//	if err != nil {
-		//		br.Msg = "获取信息失败"
-		//		br.Msg = "获取产业关联的文章ID失败,GetIndustrialArticleGroupManagementByIndustrialManagementIdErr:" + err.Error()
-		//		return
-		//	}
-		//	articleIdList := make([]string, 0)
-		//	for _, v := range industrialManageentList {
-		//		articleIdList = append(articleIdList, strconv.Itoa(v.ArticleId))
-		//	}
-		//	condition += ` AND a.article_id IN (  ` + utils.GetOrmInReplace(len(articleIdList)) + ` )  `
-		//	pars = append(pars, articleIdList)
-		//}
 
-		list, total, err = models.GetReportAndproductIndustrylListimg(categoryId, user.UserId, startSize, pageSize)
-		if err != nil {
-			br.Msg = "获取信息失败"
-			br.Msg = "GetHomeList,Err:" + err.Error()
-			return
+		if categoryId == utils.ACTEGORY_ID_AI_QY {
+			listArticle := make([]*models.HomeArticle, 0)
+			listArticle, total, err = services.GetAiQianYanArtilceList(0, pageSize)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.Msg = "GetAiQianYanArtilceList,Err:" + err.Error()
+				return
+			}
+			for _, v := range listArticle {
+				list = append(list, &models.ArticleListResp{
+					ArticleId:   v.ArticleId,
+					Title:       v.Title,
+					CategoryId:  v.CategoryId,
+					Annotation:  v.Annotation,
+					Abstract:    v.Abstract,
+					Body:        v.Body,
+					PublishDate: v.PublishDate,
+					Resource:    v.Resource,
+				})
+			}
+
+		} else {
+			list, total, err = models.GetReportAndproductIndustrylListimg(categoryId, user.UserId, startSize, pageSize)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.Msg = "GetHomeList,Err:" + err.Error()
+				return
+			}
+
 		}
 
-		//total, err = models.GetHomeCount(condition, pars)
-		//if err != nil {
-		//	br.Msg = "获取信息失败"
-		//	br.Msg = "获取帖子总数失败,Err:" + err.Error()
-		//	return
-		//}
-		//
-		//list, err = models.GetHomeListNew(condition, pars, startSize, pageSize)
-		//if err != nil {
-		//	br.Msg = "获取信息失败"
-		//	br.Msg = "获取帖子数据失败,Err:" + err.Error()
-		//	return
-		//}
 		articleIdMap, err := services.GetUserArticleHistoryRecord(user)
 		if err != nil {
 			br.Msg = "获取信息失败"

+ 76 - 1
controllers/report_selection.go

@@ -170,7 +170,7 @@ func (this *ReportSelectionController) Detail() {
 	//if sellerItem != nil {
 	//	historyRecord.SellerName = sellerItem.RealName
 	//}
-	go services.AddCygxReportHistoryRecord(user, articleId, "bgjx")
+	//go services.AddCygxReportHistoryRecord(user, articleId, "bgjx")
 	resp.List = items
 	resp.ListPermissionSubject = itemsSubject
 	resp.Detail = detail
@@ -235,3 +235,78 @@ func (this *ReportSelectionController) ClickHistory() {
 	br.Success = true
 	br.Msg = "记录成功"
 }
+
+// @Title 上传文章阅读时间
+// @Description 上传文章阅读时间接口
+// @Param  request	body models.AddStopTimeRep true "type json string"
+// @Success 200 {object} models.ArticleDetailResp
+// @router /addStopTime [post]
+func (this *ReportSelectionController) AddStopTime() {
+	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.AddReportSelectionStopTimeRep
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	uid := user.UserId
+	articleId := req.ArticleId
+	stopTime := req.StopTime
+	outType := req.OutType
+	source := req.Source
+	var reportType string
+	if source == 1 {
+		reportType = "bgjx"
+	} else if source == 2 {
+		reportType = "bzyjhz"
+	} else if source == 3 {
+		reportType = "szjyhz"
+	}
+	hasPermission, err := services.GetUserhasPermission(user)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
+	}
+
+	if hasPermission == 1 {
+		historyRecord := new(models.CygxReportHistoryRecord)
+		historyRecord.UserId = uid
+		historyRecord.ArticleId = articleId
+		historyRecord.CreateTime = time.Now().Add(-time.Second * time.Duration(stopTime))
+		historyRecord.Mobile = user.Mobile
+		historyRecord.Email = user.Email
+		historyRecord.CompanyId = user.CompanyId
+		historyRecord.CompanyName = user.CompanyName
+		historyRecord.StopTime = stopTime
+		historyRecord.OutType = outType
+		historyRecord.ReportType = reportType
+		historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM
+		sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
+			return
+		}
+		historyRecord.RealName = user.RealName
+		if sellerItem != nil {
+			historyRecord.SellerName = sellerItem.RealName
+		}
+		go services.AddCygxReportHistoryRecord(historyRecord)
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+}

+ 9 - 6
models/activity.go

@@ -145,6 +145,7 @@ type ActivityDetail struct {
 	IsYidongConduct         bool                       `description:"是否属于易董办会 1:是 、0:否"`
 	IsCanOutboundCall       int                        `description:"是否提供外呼 1:是 、0:否"`
 	TencentConferenceNumber string                     `description:"腾讯会议号"`
+	IsResearchSpecial       bool                       `description:"是否属于特殊的研选"`
 }
 
 // 活动详情
@@ -214,6 +215,7 @@ type ActivityListResp struct {
 	IsYidongConduct         bool                       `description:"是否属于易董办会 1:是 、0:否"`
 	IsCanOutboundCall       int                        `description:"是否提供外呼 1:是 、0:否"`
 	TencentConferenceNumber string                     `description:"腾讯会议号"`
+	IsResearchSpecial       bool                       `description:"是否属于特殊的研选"`
 }
 
 type ActivityArticleResp struct {
@@ -223,12 +225,13 @@ type ActivityArticleResp struct {
 }
 
 type CygxActivityResp struct {
-	HasPermission int    `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
-	PopupMsg      string `description:"权限弹窗信息"`
-	SellerMobile  string `description:"销售电话"`
-	SellerName    string `description:"销售姓名"`
-	IsResearch    bool   `description:"是否属于研选"`
-	Detail        *ActivityListResp
+	HasPermission     int    `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	PopupMsg          string `description:"权限弹窗信息"`
+	SellerMobile      string `description:"销售电话"`
+	SellerName        string `description:"销售姓名"`
+	IsResearch        bool   `description:"是否属于研选"`
+	IsResearchSpecial bool   `description:"是否属于特殊的研选"`
+	Detail            *ActivityListResp
 }
 
 // 列表

+ 1 - 0
models/activity_signup.go

@@ -40,6 +40,7 @@ type SignupStatus struct {
 	GoOutboundMobile  bool   `description:"是否去绑定手机号"`
 	GoBindEmail       bool   `description:"是否去绑定邮箱"`
 	IsResearch        bool   `description:"是否属于研选"`
+	IsResearchSpecial bool   `description:"是否属于特殊的研选"`
 }
 type ActivitySingnupRep struct {
 	ActivityId int `description:"活动id"`

+ 67 - 0
models/article.go

@@ -4,6 +4,50 @@ import (
 	"github.com/beego/beego/v2/client/orm"
 )
 
+type CygxArticle struct {
+	Id               int    `orm:"column(id);pk"`
+	ArticleId        int    `description:"文章id"`
+	Title            string `description:"标题"`
+	TitleEn          string `description:"英文标题 "`
+	UpdateFrequency  string `description:"更新周期"`
+	CreateDate       string `description:"创建时间"`
+	PublishDate      string `description:"发布时间"`
+	Body             string `description:"内容"`
+	BodyText         string `description:"内容"`
+	Abstract         string `description:"摘要"`
+	CategoryName     string `description:"一级分类"`
+	SubCategoryName  string `description:"二级分类"`
+	PublishStatus    int    `description:"发布状态"`
+	CategoryId       int    `description:"分类id"`
+	CategoryIdTwo    int    `description:"分类id用作修改匹配类型使用"`
+	ExpertBackground string `description:"专家背景"`
+	ExpertNumber     string `description:"专家编号"`
+	InterviewDate    string `description:"访谈日期"`
+	Department       string `description:"作者"`
+	ArticleIdMd5     string `description:"ID,md5值"`
+	IsClass          int    `description:"是否归类,1是,0否"`
+	IsSummary        int    `description:"是否是纪要库,1是,0否"`
+	IsReport         int    `description:"是否属于报告,1是,0否"`
+	ReportType       int    `description:"报告类型,1行业报告,2产业报告,0无"`
+	FileLink         string `description:"下载预览链接"`
+	MatchTypeName    string `description:"匹配类型"`
+	Periods          string `description:"期数"`
+	ReportLink       string `description:"报告链接"`
+	ArticleType      string `description:"文章类型 文章类型,lyjh:路演精华 "`
+	HavePublish      int    `description:"是否发布过,1是 ,0 否"`
+	Source           int    `description:"来源 0策略平台同步,1小程序后台添加"`
+	SellerAndMobile  string `description:"销售和手机号"`
+	VideoUrl         string `description:"音频文件URL"`
+	VideoName        string `description:"音频文件名称"`
+	VideoPlaySeconds string `description:"音频播放时长"`
+	Stock            string `description:"个股标签"`
+	FieldName        string `description:"产业标签"`
+	Annotation       string `description:"核心观点"`
+	TypeName         string `description:"策略平台报告类型"`
+	ModifyTimeByCl   string `description:"策略平台报告更新时间"`
+	CeLueFieldId     int    `description:"策略平台领域ID"`
+}
+
 type ArticleDetail struct {
 	ArticleId            int             `description:"报告id"`
 	ArticleIdMd5         string          `description:"报告MD5id"`
@@ -258,3 +302,26 @@ func GetArticleStock() (items []*SummaryArticleStock, err error) {
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+// 列表
+func GetCygxCygxArticleList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxArticle, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_article as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?  `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+// 获取数量
+func GetCygxArticleCount(condition string, pars []interface{}) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_article as art WHERE 1= 1  `
+	if condition != "" {
+		sqlCount += condition
+	}
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}

+ 14 - 2
models/article_history_record.go

@@ -24,7 +24,7 @@ type ArticleTopHistoryRecord struct {
 	CreateTime        time.Time `description:"创建时间"`
 }
 
-//获取用户阅读记录
+// 获取用户阅读记录
 func GetUserToArticleCount(uid, articleId int) (count int, err error) {
 	sqlCount := `SELECT COUNT(1) AS count FROM cygx_article_history_record WHERE user_id=? AND article_id=? `
 	o := orm.NewOrm()
@@ -32,7 +32,7 @@ func GetUserToArticleCount(uid, articleId int) (count int, err error) {
 	return
 }
 
-//获取用户阅读记录
+// 获取用户阅读记录
 func GetUserToArticleHistory(uid int, articleIdArr []int) (items []*CygxArticleHistoryResp, err error) {
 	arrLen := len(articleIdArr)
 	if arrLen == 0 {
@@ -96,3 +96,15 @@ WHERE
 	_, err = orm.NewOrm().Raw(sql, pars, limit).QueryRows(&list)
 	return
 }
+
+type AddStopTimeRep struct {
+	ArticleId int    `description:"文章ID"`
+	StopTime  int    `description:"停留时间"`
+	OutType   int    `description:"退出方式,1正常退出,2强制关闭"`
+	Source    string `description:"来源,MOBILE:手机端,PC:电脑端"`
+}
+
+type ArticleDetailAddStopTimeRep struct {
+	HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	HasFree       int `description:"1:已付费(至少包含一个品类的权限),2:未付费(没有任何品类权限)"`
+}

+ 80 - 40
models/article_history_record_newpv.go

@@ -4,36 +4,39 @@ import (
 	"fmt"
 	"github.com/beego/beego/v2/client/orm"
 	"hongze/hongze_clpt/utils"
+	"strconv"
 	"time"
 )
 
 type CygxArticleHistoryRecordNewpv struct {
-	Id          int `orm:"column(id);pk"`
-	ArticleId   int
-	UserId      int
-	CreateTime  time.Time
-	ModifyTime  time.Time
-	Mobile      string `description:"手机号"`
-	Email       string `description:"邮箱"`
-	CompanyId   int    `description:"公司id"`
-	CompanyName string `description:"公司名称"`
-	StopTime    int    `description:"停留时间"`
-	OutType     int    `description:"退出方式,1正常退出,2强制关闭"`
-	Source      string `description:"来源,MOBILE:手机端,PC:电脑端"`
+	Id               int `orm:"column(id);pk"`
+	ArticleId        int
+	UserId           int
+	CreateTime       time.Time
+	ModifyTime       time.Time
+	Mobile           string `description:"手机号"`
+	Email            string `description:"邮箱"`
+	CompanyId        int    `description:"公司id"`
+	CompanyName      string `description:"公司名称"`
+	StopTime         int    `description:"停留时间"`
+	OutType          int    `description:"退出方式,1正常退出,2强制关闭"`
+	Source           string `description:"来源,MOBILE:手机端,PC:电脑端"`
+	RegisterPlatform int    `description:"来源 1小程序,2:网页"`
 }
 
 type CygxArticleHistoryRecord struct {
-	Id          int `orm:"column(id);pk"`
-	ArticleId   int
-	UserId      int
-	CreateTime  time.Time
-	Mobile      string    `description:"手机号"`
-	Email       string    `description:"邮箱"`
-	CompanyId   int       `description:"公司id"`
-	CompanyName string    `description:"公司名称"`
-	ModifyTime  time.Time `description:"修改时间"`
-	StopTime    int       `description:"停留时间"`
-	OutType     int       `description:"退出方式,1正常退出,2强制关闭"`
+	Id               int `orm:"column(id);pk"`
+	ArticleId        int
+	UserId           int
+	CreateTime       time.Time
+	Mobile           string    `description:"手机号"`
+	Email            string    `description:"邮箱"`
+	CompanyId        int       `description:"公司id"`
+	CompanyName      string    `description:"公司名称"`
+	ModifyTime       time.Time `description:"修改时间"`
+	StopTime         int       `description:"停留时间"`
+	OutType          int       `description:"退出方式,1正常退出,2强制关闭"`
+	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
 }
 
 // 添加阅读记录信息
@@ -102,23 +105,24 @@ func AddCygxArticleViewRecordNewpv(item *CygxArticleHistoryRecordNewpv) (lastId
 }
 
 type CygxArticleHistoryRecordAll struct {
-	Id             int `orm:"column(id);pk"`
-	ArticleId      int
-	UserId         int
-	CreateTime     string
-	ModifyTime     time.Time
-	Mobile         string    `description:"手机号"`
-	Email          string    `description:"邮箱"`
-	CompanyId      int       `description:"公司id"`
-	CompanyName    string    `description:"公司名称"`
-	StopTime       int       `description:"停留时间"`
-	OutType        int       `description:"退出方式,1正常退出,2强制关闭"`
-	Source         string    `description:"来源,MOBILE:手机端,PC:电脑端"`
-	RealName       string    `description:"用户实际名称"`
-	CreateDateApi  time.Time `description:"同步创建时间"`
-	CelueHistoryId int       `description:"策略平台记录的ID"`
-	Platfor        int       `description:"PV阅读记录来源,1:查研观向,2:策略平台"`
-	IsDel          int       `description:"是否删除"`
+	Id               int `orm:"column(id);pk"`
+	ArticleId        int
+	UserId           int
+	CreateTime       string
+	ModifyTime       time.Time
+	Mobile           string    `description:"手机号"`
+	Email            string    `description:"邮箱"`
+	CompanyId        int       `description:"公司id"`
+	CompanyName      string    `description:"公司名称"`
+	StopTime         int       `description:"停留时间"`
+	OutType          int       `description:"退出方式,1正常退出,2强制关闭"`
+	Source           string    `description:"来源,MOBILE:手机端,PC:电脑端"`
+	RealName         string    `description:"用户实际名称"`
+	CreateDateApi    time.Time `description:"同步创建时间"`
+	CelueHistoryId   int       `description:"策略平台记录的ID"`
+	Platfor          int       `description:"PV阅读记录来源,1:查研观向,2:策略平台"`
+	IsDel            int       `description:"是否删除"`
+	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
 }
 
 type EsUserInteraction struct {
@@ -154,3 +158,39 @@ func GetArticleHistoryRecord(condition string, pars []interface{}) (item []*Cygx
 	_, err = o.Raw(sql, pars).QueryRows(&item)
 	return
 }
+
+// 把十分钟之内的阅读记录进行累加
+func UpdateCygxArticleViewRecordNewpv(itemRep *CygxArticleHistoryRecordNewpv, stopTime int) (err error) {
+	o, err := orm.NewOrm().Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+		fmt.Println(err)
+		if err == nil {
+			o.Commit()
+		} else {
+			o.Rollback()
+		}
+	}()
+	sql := `UPDATE cygx_article_history_record_newpv 
+			SET modify_time = NOW(), stop_time = stop_time + ` + strconv.Itoa(stopTime) + `
+			WHERE
+			article_id = ? 
+			AND user_id = ?
+			AND out_type = 2
+			AND timestampdiff(MINUTE,modify_time,NOW()) < 10`
+	_, err = o.Raw(sql, itemRep.ArticleId, itemRep.UserId).Exec()
+
+	// 修改总表的停留时间
+	sql = `UPDATE cygx_article_history_record_all 
+			SET modify_time = NOW(), stop_time = stop_time + ` + strconv.Itoa(stopTime) + `
+			WHERE
+			article_id = ? 
+			AND user_id = ?
+			AND out_type = 2
+			AND timestampdiff(MINUTE,modify_time,NOW()) < 10`
+	_, err = o.Raw(sql, itemRep.ArticleId, itemRep.UserId).Exec()
+
+	return
+}

+ 25 - 0
models/article_view_record.go

@@ -0,0 +1,25 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxArticleViewRecord struct {
+	Id               int `orm:"column(id);pk"`
+	ArticleId        int
+	UserId           int
+	CreateTime       time.Time
+	Mobile           string `description:"手机号"`
+	Email            string `description:"邮箱"`
+	CompanyId        int    `description:"公司id"`
+	CompanyName      string `description:"公司名称"`
+	RegisterPlatform int    `description:"来源 1小程序,2:网页"`
+}
+
+// 添加收藏信息
+func AddCygxArticleViewRecord(item *CygxArticleViewRecord) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}

+ 3 - 0
models/db.go

@@ -57,6 +57,7 @@ func init() {
 		new(CygxPageHistoryRecord),
 		new(CygxArticleDepartmentFollow),
 		new(CygxArticleComment),
+		new(CygxArticleViewRecord),
 		new(CygxArticleHistoryRecordNewpv),
 		new(CygxArticleHistoryRecord),
 		new(CygxArticleHistoryRecordAll),
@@ -69,6 +70,8 @@ func init() {
 		new(CygxAboutUsVideoHistory),
 		new(CygxTacticsTimeLineHistory),
 		new(CygxBannerHistory),
+		new(CygxReportHistoryRecordLog),
+		new(CygxUserLabel),
 		new(CygxInviteCompany),
 		new(CygxApplyRecord),
 	)

+ 1 - 0
models/home.go

@@ -73,6 +73,7 @@ type ArticleListResp struct {
 	IsRed               bool   `description:"是否标红"`
 	CollectNum          int    `description:"收藏人数"`
 	Resource            int    `description:"来源类型,1:文章、2:产品内测"`
+	Cover               string `description:"封面图片"`
 	List                []*IndustrialManagementIdInt
 }
 

+ 50 - 0
models/report_history_record.go

@@ -18,6 +18,26 @@ type CygxReportHistoryRecord struct {
 	ReportType       string    `description:"报告类型,bgjx:报告精选、bzyjhz:本周研究汇总、szjyhz:上周纪要汇总"`
 	RealName         string    `description:"用户实际名称"`
 	SellerName       string    `description:"所属销售"`
+	StopTime         int       `description:"停留时间"`
+	OutType          int       `description:"退出方式,1正常退出,2强制关闭"`
+	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
+}
+
+type CygxReportHistoryRecordLog struct {
+	Id               int `orm:"column(id);pk"`
+	ArticleId        int
+	UserId           int
+	CreateTime       time.Time
+	Mobile           string    `description:"手机号"`
+	Email            string    `description:"邮箱"`
+	CompanyId        int       `description:"公司id"`
+	CompanyName      string    `description:"公司名称"`
+	ModifyTime       time.Time `description:"修改时间"`
+	ReportType       string    `description:"报告类型,bgjx:报告精选、bzyjhz:本周研究汇总、szjyhz:上周纪要汇总"`
+	RealName         string    `description:"用户实际名称"`
+	SellerName       string    `description:"所属销售"`
+	StopTime         int       `description:"停留时间"`
+	OutType          int       `description:"退出方式,1正常退出,2强制关闭"`
 	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
 }
 
@@ -28,3 +48,33 @@ func AddCygxReportHistoryRecord(item *CygxReportHistoryRecord) (lastId int64, er
 	lastId, err = o.Insert(item)
 	return
 }
+
+// 添加历史信息
+func AddCygxReportHistoryRecordLog(item *CygxReportHistoryRecordLog) (lastId int64, err error) {
+	o := orm.NewOrm()
+	item.ModifyTime = time.Now()
+	lastId, err = o.Insert(item)
+	return
+}
+
+type AddStopTimeNewRep struct {
+	Id        int `description:"ID"`
+	ArticleId int `description:"文章ID"`
+	StopTime  int `description:"停留时间"`
+	OutType   int `description:"退出方式,1正常退出,2强制关闭"`
+}
+
+func UpdateArticleStopTime(item *AddStopTimeNewRep) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_article_history_record SET stop_time = ?,out_type = ? WHERE id =?`
+	_, err = o.Raw(sql, item.StopTime, item.OutType, item.Id).Exec()
+	return
+}
+
+// 获取最新的一条阅读记录
+func GetNewArticleHistoryRecord(uid, articleId int) (item *AddStopTimeNewRep, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM  cygx_article_history_record WHERE user_id = ? AND article_id = ? ORDER BY id DESC LIMIT 1;`
+	err = o.Raw(sql, uid, articleId).QueryRow(&item)
+	return
+}

+ 7 - 0
models/report_selection.go

@@ -189,3 +189,10 @@ func GetIndustrialByIds(industrialManagementIds string) (items []*IndustriaRepor
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+type AddReportSelectionStopTimeRep struct {
+	ArticleId int `description:"文章ID"`
+	StopTime  int `description:"停留时间"`
+	OutType   int `description:"退出方式,1正常退出,2强制关闭"`
+	Source    int `description:"来源,1:深度研究、2:本周研究汇总、3:上周纪要汇总"`
+}

+ 1 - 0
models/resource_data.go

@@ -67,6 +67,7 @@ type CygxResourceDataResp struct {
 	IsYidongConduct         bool                       `description:"是否属于易董办会 1:是 、0:否"`
 	IsCanOutboundCall       int                        `description:"是否提供外呼 1:是 、0:否"`
 	TencentConferenceNumber string                     `description:"腾讯会议号"`
+	IsResearchSpecial       bool                       `description:"是否属于特殊的研选"`
 }
 
 type HomeResourceDataListResp struct {

+ 75 - 0
models/user_label.go

@@ -0,0 +1,75 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxUserLabelLogRedis struct {
+	UserId     int       `description:"用户ID"`
+	SourceId   int       `description:"资源ID"`
+	SourceType int       `description:"1:文章阅读、 2产业关注、3:活动到会、4系列关注、5专项调研活动到会。"`
+	IsFllow    int       `description:"1关注、0取消关注"`
+	CreateTime time.Time `description:"创建时间"`
+}
+
+type CygxUserLabel struct {
+	Id         int       `orm:"column(id);pk"`
+	UserId     int       `description:"用户ID"`
+	CompanyId  int       `description:"公司id"`
+	RealName   string    `description:"用户实际名称"`
+	Mobile     string    `description:"手机号"`
+	Email      string    `description:"邮箱"`
+	Label      string    `description:"标签内容"`
+	Weight     int       `description:"权重"`
+	SourceId   int       `description:"来源ID(产业ID,系列ID)"`
+	Source     int       `description:"来源1:产业、2:系列"`
+	IsFollow   int       `description:"是否关注,1是,0否"`
+	CreateTime time.Time `description:"创建时间"`
+	ModifyTime time.Time `description:"更新时间"`
+}
+
+// 获取数量
+func GetCygxUserLabelCount(condition string, pars []interface{}) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_user_label as art WHERE 1= 1   AND modify_time > DATE_SUB(CURDATE(), INTERVAL 3 MONTH)  `
+	if condition != "" {
+		sqlCount += condition
+	}
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+// 添加
+func AddCygxUserLabel(item *CygxUserLabel) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+// 修改是否关注
+func UpdateCygxUserLabelIsFollow(isFollow, sourceId, source, userId int, label string) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_user_label SET is_follow=?,label = ? , modify_time=NOW()  WHERE source_id=? AND source = ? AND user_id = ? `
+	_, err = o.Raw(sql, isFollow, label, sourceId, source, userId).Exec()
+	return
+}
+
+// 修改对应标签权重+1
+func UpdateCygxUserLabelWeight(sourceId, source, userId int, label string) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_user_label SET weight = weight +1 ,label = ? , modify_time=NOW()  WHERE source_id=? AND source = ? AND  user_id = ? `
+	_, err = o.Raw(sql, label, sourceId, source, userId).Exec()
+	return
+}
+
+// 列表
+func GetCygxUserLabelList(condition string, pars []interface{}) (items []*CygxUserLabel, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_user_label as art WHERE 1= 1   AND modify_time > DATE_SUB(CURDATE(), INTERVAL 3 MONTH)	`
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 28 - 0
models/user_label_article.go

@@ -0,0 +1,28 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxUserLabelArticle struct {
+	Id         int       `orm:"column(id);pk"`
+	UserId     int       `description:"用户ID"`
+	CompanyId  int       `description:"公司id"`
+	RealName   string    `description:"用户实际名称"`
+	Mobile     string    `description:"手机号"`
+	Email      string    `description:"邮箱"`
+	Label      string    `description:"标签内容"`
+	ArticleId  int       `description:"文章ID"`
+	SourceId   int       `description:"来源ID(产业ID,系列ID)"`
+	Source     int       `description:"来源1:产业、2:系列"`
+	CreateTime time.Time `description:"创建时间"`
+	ModifyTime time.Time `description:"更新时间"`
+}
+
+// 添加
+func AddCygxUserLabelArticle(item *CygxUserLabelArticle) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}

+ 7 - 0
models/wx_user.go

@@ -201,3 +201,10 @@ func GetUserRemind(uid int) (count int, err error) {
 	err = orm.NewOrm().Raw(sql, uid).QueryRow(&count)
 	return
 }
+
+func ModifyReportLastViewTime(uid int) (err error) {
+	sql := ` UPDATE wx_user SET report_last_view_time=NOW()
+			WHERE user_id=? `
+	_, err = orm.NewOrm().Raw(sql, uid).Exec()
+	return
+}

+ 18 - 0
routers/commentsRouter.go

@@ -187,6 +187,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ArticleController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ArticleController"],
+        beego.ControllerComments{
+            Method: "AddStopTime",
+            Router: `/addStopTime`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ArticleController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ArticleController"],
         beego.ControllerComments{
             Method: "AskAdd",
@@ -718,6 +727,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ReportSelectionController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ReportSelectionController"],
+        beego.ControllerComments{
+            Method: "AddStopTime",
+            Router: `/addStopTime`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ReportSelectionController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ReportSelectionController"],
         beego.ControllerComments{
             Method: "ClickHistory",

+ 50 - 24
services/activity.go

@@ -446,7 +446,7 @@ func GetActivityVideoResp(mapActivityId []int) (mapItem map[int]*models.CygxActi
 	return
 }
 
-func ActivityButtonShow(item *models.ActivityDetail, user *models.WxUserItem) (itemActivity *models.ActivityListResp) {
+func ActivityButtonShow(item *models.ActivityDetail, user *models.WxUserItem, permissionArr []string) (itemActivity *models.ActivityListResp) {
 	articleDetail := item
 	//IsShowAppointment       bool                       `description:"是否展示预约纪要"`
 	//IsShowOutboundCall      bool                       `description:"是否展示预约外呼"`
@@ -456,6 +456,10 @@ func ActivityButtonShow(item *models.ActivityDetail, user *models.WxUserItem) (i
 	if strings.Contains(articleDetail.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
 		articleDetail.IsResearch = true
 	}
+	//如果是 公司调研电话会:3,或 专家线下沙龙:5  而且  除易董同步过来的以外的研选类型活动,必须要有研选的正式权限
+	if (articleDetail.ActivityTypeId == 3 || articleDetail.ActivityTypeId == 5) && articleDetail.YidongActivityId == "" && strings.Contains(articleDetail.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) && utils.InArrayByStr(permissionArr, utils.CHART_PERMISSION_NAME_MF_YANXUAN) {
+		articleDetail.IsResearchSpecial = true
+	}
 
 	activityTimeText := articleDetail.ActivityTimeText
 	activityTimeText = strings.Replace(activityTimeText, "(", "(", -1)
@@ -611,6 +615,7 @@ func ActivityButtonShow(item *models.ActivityDetail, user *models.WxUserItem) (i
 		IsYidongConduct:         v.IsYidongConduct,
 		IsCanOutboundCall:       v.IsCanOutboundCall,
 		TencentConferenceNumber: v.TencentConferenceNumber,
+		IsResearchSpecial:       v.IsResearchSpecial,
 	}
 	au := new(models.UserPermissionAuthInfo)
 	au.SellerName = authInfo.SellerName
@@ -816,13 +821,33 @@ func GetIndustryNewLabelMap(industryIds []int) (labelMap map[int]bool, err error
 }
 
 // GetSpecialDetailUserPower 处理用户查看详情的权限
-func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.ActivityDetail) (havePower bool, err error) {
+func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.ActivityDetail) (havePower, isResearchSpecial bool, err error) {
 	var companyDetailStatus string
 	var userTypeStr string
 	if GetBelongingRai(user.Mobile) || activityInfo.ChartPermissionName == utils.HONG_GUAN_NAME {
 		havePower = true
 		return
 	}
+	userType, permissionStr, permissionStrZhengShi, e := GetUserTypeZhengShi(user.CompanyId)
+	if e != nil {
+		err = errors.New("GetCompanyPermissionUpgrade, Err: " + e.Error())
+		return
+	}
+	//如果是 公司调研电话会:3,或 专家线下沙龙:5  而且  除易董同步过来的以外的研选类型活动,必须要有研选的正式权限
+	if (activityInfo.ActivityTypeId == 3 || activityInfo.ActivityTypeId == 5) && activityInfo.YidongActivityId == "" && strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		isResearchSpecial = true
+	}
+	//如果是 公司调研电话会:3,或 专家线下沙龙:5  而且  除易董同步过来的以外的研选类型活动,必须要有研选的正式权限
+	if isResearchSpecial {
+		if !strings.Contains(permissionStr, utils.CHART_PERMISSION_NAME_YANXUAN) {
+			//如果连试用权限都没有,那么久按照普通的研选样式展示
+			isResearchSpecial = false
+		}
+		if !strings.Contains(permissionStrZhengShi, activityInfo.ChartPermissionName) {
+			havePower = false
+			return
+		}
+	}
 	//处理决策人可见权限
 	if user.IsMaker == 0 && activityInfo.IsMakerShow == 1 {
 		havePower = false
@@ -848,17 +873,35 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 			return
 		}
 	}
-	userType, permissionStr, permissionStrZhengShi, e := GetUserTypeZhengShi(user.CompanyId)
-	if e != nil {
-		err = errors.New("GetCompanyPermissionUpgrade, Err: " + e.Error())
-		return
-	}
+
 	if permissionStr == "" {
 		return
 	}
+
 	//如果是易董的活动且属于研选类型,只要开通任何权限就可以查看详情
 	if activityInfo.YidongActivityId != "" && permissionStr != "" && strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
 		havePower = true
+		return
+	}
+	//医药消费,科技,智造四大行业,验证主客观。如果主客观校验不通过,那么直接返回
+	if strings.Contains(utils.YI_YAO_NAME+utils.XIAO_FEI_NAME+utils.KE_JI_NAME+utils.ZHI_ZAO_NAME, activityInfo.ChartPermissionName) {
+		if activityInfo.ActivityTypeId == 2 || activityInfo.ActivityTypeId == 6 || activityInfo.ActivityTypeId == 7 {
+			if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(主观)") {
+				havePower = true
+			} else {
+				havePower = false
+			}
+		} else {
+			if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(客观)") {
+				havePower = true
+			} else {
+				havePower = false
+			}
+		}
+	}
+	//如果主客观校验不通过,那么直接返回
+	if !havePower {
+		return
 	}
 	if activityInfo.LimitPeopleNum > 0 {
 		mapUserType, e := GetActivityCcustomerTypeList()
@@ -940,23 +983,6 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 			}
 		}
 	}
-	if activityInfo.ActivityTypeId == 2 || activityInfo.ActivityTypeId == 6 || activityInfo.ActivityTypeId == 7 {
-		if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(主观)") {
-			havePower = true
-		} else {
-			havePower = false
-		}
-	} else {
-		if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(客观)") {
-			havePower = true
-		} else {
-			havePower = false
-		}
-	}
-	//如果主客观校验不通过,那么直接返回
-	if !havePower {
-		return
-	}
 
 	permissionShengji, errs := models.GetCompanyPermissionByUserTrip(user.CompanyId)
 	if errs != nil {

+ 36 - 3
services/article.go

@@ -645,7 +645,7 @@ func GetArticleStockMap() (mapResp map[string]int, err error) {
 	return
 }
 
-// 用户报告操作行为,模板消息推送 (先放在活动模块下,避免代码冲突)
+// 用户报告操作行为,模板消息推送
 func ArticleUserRemind(user *models.WxUserItem, articleDetail *models.ArticleDetail, source int) (err error) {
 	defer func() {
 		if err != nil {
@@ -675,15 +675,48 @@ func ArticleUserRemind(user *models.WxUserItem, articleDetail *models.ArticleDet
 	if sellerItemQy != nil {
 		openIdList, err := models.GetUserRecordListByMobile(4, sellerItemQy.Mobile)
 		if err != nil {
-			fmt.Println(err)
 			return err
 		}
 		var keyword1 string
 		var keyword2 string
-
 		keyword1 = articleDetail.Title
 		keyword2 = fmt.Sprint("互动:", sourceMsg, ",", user.RealName, "--", user.CompanyName)
 		SendWxMsgWithArticleUserRemind(keyword1, keyword2, openIdList, articleDetail.ArticleId)
 	}
 	return
 }
+
+// GetAiQianYanArtilceList 获取AI前沿几篇文章
+func GetAiQianYanArtilceList(startSize, pageSize int) (items []*models.HomeArticle, total int, err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("获取AI前沿几篇文章失败"+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	condition += ` AND title LIKE '%AI前沿%' AND publish_status = 1  ORDER BY publish_date DESC   `
+	articleList, e := models.GetCygxCygxArticleList(condition, pars, startSize, pageSize)
+	if e != nil {
+		err = errors.New("GetCygxCygxArticleList, Err: " + e.Error())
+		return
+	}
+	total, e = models.GetCygxArticleCount(condition, pars)
+	if e != nil {
+		err = errors.New("GetCygxArticleCount, Err: " + e.Error())
+		return
+	}
+
+	for _, v := range articleList {
+		item := new(models.HomeArticle)
+		item.ArticleId = v.ArticleId
+		item.Title = v.Title
+		item.Abstract = v.Abstract
+		item.Annotation = v.Annotation
+		item.PublishDate = v.PublishDate
+		item.CategoryId = strconv.Itoa(v.CategoryId)
+		item.Body = v.Body
+		items = append(items, item)
+	}
+	return
+}

+ 91 - 0
services/article_history.go

@@ -0,0 +1,91 @@
+package services
+
+import (
+	"errors"
+	"hongze/hongze_clpt/models"
+	"hongze/hongze_clpt/utils"
+	"strconv"
+	"time"
+)
+
+// 记录用户文章浏览记录
+func ArticleHistory(articleId int, user *models.WxUserItem) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("记录用户文章浏览记录,失败"+err.Error(), 2)
+		}
+	}()
+	recordRedis := new(ReportViewRecord)
+	recordRedis.UserId = user.UserId
+	recordRedis.ReportId = articleId
+	recordRedis.Mobile = user.Mobile
+	recordRedis.Email = user.Email
+	recordRedis.RealName = user.RealName
+	recordRedis.CompanyName = user.CompanyName
+	recordRedis.CreateTime = time.Now()
+	go PushViewRecordNewRedisData(recordRedis, user.CompanyId)
+	uid := user.UserId
+	key := "CYGX_ARTICLE_" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
+	if !utils.Rc.IsExist(key) {
+		//新增浏览记录
+		//这个表貌似没怎么用了,暂时保留记录
+		record := new(models.CygxArticleViewRecord)
+		record.UserId = uid
+		record.ArticleId = articleId
+		record.CreateTime = time.Now()
+		record.Mobile = user.Mobile
+		record.Email = user.Email
+		record.CompanyId = user.CompanyId
+		record.CompanyName = user.CompanyName
+		_, e := models.AddCygxArticleViewRecord(record)
+		if e != nil {
+			err = errors.New("AddCygxArticleViewRecord, Err: " + e.Error())
+			return
+		}
+
+		e = models.ModifyReportLastViewTime(uid)
+		if e != nil {
+			err = errors.New("ModifyReportLastViewTime, Err: " + e.Error())
+			return
+		}
+		utils.Rc.Put(key, 1, 2*time.Second)
+	}
+	return
+}
+
+// 记录用户文章浏览记录带时长
+func ArticleHistoryStopTime(articleId, stopTime, outType int, user *models.WxUserItem) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("记录用户文章浏览记录带时长,失败"+err.Error(), 2)
+		}
+	}()
+	if stopTime < 3 {
+		return
+	}
+	uid := user.UserId
+
+	key := "CYGX_ARTICLE_PV" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid) + "_" + strconv.Itoa(user.CompanyId) + "_" + strconv.Itoa(outType)
+	if !utils.Rc.IsExist(key) {
+		record := new(models.CygxArticleHistoryRecordNewpv)
+		record.UserId = uid
+		record.ArticleId = articleId
+		record.CreateTime = time.Now().Add(-time.Second * time.Duration(stopTime))
+		record.ModifyTime = time.Now()
+		record.Mobile = user.Mobile
+		record.Email = user.Email
+		record.CompanyId = user.CompanyId
+		record.CompanyName = user.CompanyName
+		record.StopTime = stopTime
+		record.OutType = outType
+		record.Source = "WEB"
+		_, e := models.AddCygxArticleViewRecordNewpv(record)
+		if e != nil {
+			err = errors.New("AddCygxArticleViewRecordNewpv, Err: " + e.Error())
+			return
+		}
+		utils.Rc.Put(key, 1, 2*time.Second)
+	}
+	go ArticleHistoryUserLabelLogAdd(articleId, uid)
+	return
+}

+ 0 - 37
services/article_red.go

@@ -107,43 +107,6 @@ func PushViewRecordNewRedisData(reportViewRecord *ReportViewRecord, companyId in
 	return false
 }
 
-// 记录用户文章浏览记录
-func ArticleHistory(articleId int, user *models.WxUserItem) (err error) {
-	defer func() {
-		if err != nil {
-			go utils.SendAlarmMsg("记录用户文章浏览记录,失败"+err.Error(), 2)
-		}
-	}()
-	uid := user.UserId
-	if uid == 0 {
-		return
-	}
-	record := new(models.CygxArticleHistoryRecordNewpv)
-	record.UserId = uid
-	record.ArticleId = articleId
-	record.CreateTime = time.Now()
-	record.ModifyTime = time.Now()
-	record.Mobile = user.Mobile
-	record.Email = user.Email
-	record.CompanyId = user.CompanyId
-	record.CompanyName = user.CompanyName
-	record.StopTime = 0
-	record.OutType = 1
-	record.Source = "WEB"
-
-	recordRedis := new(ReportViewRecord)
-	recordRedis.UserId = user.UserId
-	recordRedis.ReportId = articleId
-	recordRedis.Mobile = user.Mobile
-	recordRedis.Email = user.Email
-	recordRedis.RealName = user.RealName
-	recordRedis.CompanyName = user.CompanyName
-	recordRedis.CreateTime = time.Now()
-	go PushViewRecordNewRedisData(recordRedis, user.CompanyId)
-	_, err = models.AddCygxArticleViewRecordNewpv(record)
-	return
-}
-
 // GetUserArticleHistoryRecord 获取用户已经阅读的文章ID
 func GetUserArticleHistoryRecord(user *models.WxUserItem) (articleIdMap map[int]bool, err error) {
 	var condition string

+ 28 - 22
services/report_history_record.go

@@ -3,33 +3,39 @@ package services
 import (
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/utils"
-	"time"
+	"strconv"
 )
 
-func AddCygxReportHistoryRecord(user *models.WxUserItem, articleId int, reportType string) (err error) {
-	defer func() {
+// 添加历史信息
+func AddCygxReportHistoryRecord(item *models.CygxReportHistoryRecord) (err error) {
+	//defer func() {
+	//	if err != nil {
+	//		go utils.SendAlarmMsg("产品内测用户浏览信息记录失败"+err.Error(), 2)
+	//	}
+	//}()
+	if item.StopTime >= 5 {
+		_, err = models.AddCygxReportHistoryRecord(item)
 		if err != nil {
-			go utils.SendAlarmMsg("研究汇总用户浏览信息记录失败"+err.Error(), 2)
+			go utils.SendAlarmMsg("报告精选用户浏览信息记录失败"+err.Error()+"报告类型"+item.ReportType+"报告ID:"+strconv.Itoa(item.ArticleId), 2)
 		}
-	}()
-	historyRecord := new(models.CygxReportHistoryRecord)
-	historyRecord.UserId = user.UserId
-	historyRecord.ArticleId = articleId
-	historyRecord.CreateTime = time.Now()
-	historyRecord.Mobile = user.Mobile
-	historyRecord.Email = user.Email
-	historyRecord.CompanyId = user.CompanyId
-	historyRecord.CompanyName = user.CompanyName
-	historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM
-	historyRecord.ReportType = reportType
-	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		return
 	}
-	historyRecord.RealName = user.RealName
-	if sellerItem != nil {
-		historyRecord.SellerName = sellerItem.RealName
+
+	historyRecordLog := new(models.CygxReportHistoryRecordLog)
+	historyRecordLog.UserId = item.UserId
+	historyRecordLog.ArticleId = historyRecordLog.ArticleId
+	historyRecordLog.CreateTime = historyRecordLog.CreateTime
+	historyRecordLog.Mobile = historyRecordLog.Mobile
+	historyRecordLog.Email = historyRecordLog.Email
+	historyRecordLog.CompanyId = historyRecordLog.CompanyId
+	historyRecordLog.CompanyName = historyRecordLog.CompanyName
+	historyRecordLog.StopTime = historyRecordLog.StopTime
+	historyRecordLog.OutType = historyRecordLog.OutType
+	historyRecordLog.ReportType = historyRecordLog.ReportType
+	historyRecordLog.RegisterPlatform = historyRecordLog.RegisterPlatform
+
+	_, err = models.AddCygxReportHistoryRecordLog(historyRecordLog)
+	if err != nil {
+		go utils.SendAlarmMsg("报告精选用户浏览信息日志记录失败"+err.Error()+"报告类型"+item.ReportType+"报告ID:"+strconv.Itoa(item.ArticleId), 2)
 	}
-	_, err = models.AddCygxReportHistoryRecord(historyRecord)
 	return
 }

+ 1 - 1
services/resource_data.go

@@ -207,7 +207,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 		}
 		var activityListRersp []*models.ActivityListResp
 		for _, v := range activityList {
-			activityListRersp = append(activityListRersp, ActivityButtonShow(v, user))
+			activityListRersp = append(activityListRersp, ActivityButtonShow(v, user, make([]string, 0)))
 		}
 		//处理不同的报名方式按钮回显
 		mapActivitySignup, e := GetActivitySignupResp(activityIds, user)

+ 8 - 5
services/user.go

@@ -161,6 +161,13 @@ func GetUserTypeZhengShi(companyId int) (userType int, permissionStrnew, permiss
 				return
 			}
 			permissionStrnew = permissionStr
+
+			permissionZhengShiStr, errs = models.GetCompanyPermissionByUserZhengShi(companyId)
+			if errs != nil {
+				err = errs
+				return
+			}
+			permissionStrZhengShinew = permissionZhengShiStr
 			//大套餐客户,数据库添加标识,
 			companyUserTypeDetail, errs := models.GetCygxCompanyUserType(companyId)
 			if errs != nil && errs.Error() != utils.ErrNoRow() {
@@ -173,11 +180,7 @@ func GetUserTypeZhengShi(companyId int) (userType int, permissionStrnew, permiss
 					return
 				}
 			}
-			permissionZhengShiStr, errs = models.GetCompanyPermissionByUserZhengShi(companyId)
-			if errs != nil {
-				err = errs
-				return
-			}
+
 			//1、永续客户 //2、大套餐客户(4个行业全开通的正式客户) //3、分行业套餐客户(开通对应行业的正式客户) //4、仅开通专家套餐的正式客户 //5、开通对应行业套餐或专家套餐的试用客户、 10: 30W套餐客户
 			//大套餐客户定义:医药、消费、科技、智造、策略。5个行业中任意4个及以上是正式权限的,属于大套餐客户(医药、消费、科技、智造需要主客观都开)
 			if companyDetail.Status == "永续" {

+ 78 - 0
services/user_label.go

@@ -0,0 +1,78 @@
+package services
+
+import (
+	"fmt"
+	"hongze/hongze_clpt/models"
+	"hongze/hongze_clpt/utils"
+	"time"
+)
+
+// 添加用户阅读标签到Redis
+func ArticleHistoryUserLabelLogAdd(articleId, uid int) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			msg := fmt.Sprint("articleId:", articleId, "userId:", uid)
+			go utils.SendAlarmMsg("用户关注产业更新相关标签,写入Redis队列消息失败:"+err.Error()+msg, 2)
+		}
+	}()
+	// SourceType 1:文章阅读、 2产业关注、3:活动到会、4系列关注、5专项调研活动到会。
+	log := &models.CygxUserLabelLogRedis{UserId: uid, SourceId: articleId, SourceType: 1, CreateTime: time.Now()}
+	if utils.Re == nil {
+		err := utils.Rc.LPush(utils.CYGX_USER_KEY_LABEL, log)
+		if err != nil {
+			fmt.Println("CygxUserLabelLogRedis LPush Err:" + err.Error())
+		}
+	}
+	return
+}
+
+// 添加用户2产业关注标签到Redis
+func IndustryFllowUserLabelLogAdd(industrialManagementId, count, uid int) (err error) {
+	var isFllow int
+	if count == 0 {
+		isFllow = 1
+	} else {
+		isFllow = 0
+	}
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			msg := fmt.Sprint("industrialManagementId:", industrialManagementId, "isFllow:", isFllow, "userId:", uid)
+			go utils.SendAlarmMsg("用户关注产业更新相关标签,写入Redis队列消息失败:"+err.Error()+msg, 2)
+		}
+	}()
+	log := &models.CygxUserLabelLogRedis{UserId: uid, SourceId: industrialManagementId, SourceType: 2, IsFllow: isFllow, CreateTime: time.Now()}
+	if utils.Re == nil {
+		err := utils.Rc.LPush(utils.CYGX_USER_KEY_LABEL, log)
+		if err != nil {
+			fmt.Println("RecordNewLogs LPush Err:" + err.Error())
+		}
+	}
+	return
+}
+
+// 添加用户4系列关注标签到Redis
+func CategoryFllowUserLabelLogAdd(industrialManagementId, count, uid int) (err error) {
+	var isFllow int
+	if count == 0 {
+		isFllow = 1
+	} else {
+		isFllow = 0
+	}
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			msg := fmt.Sprint("industrialManagementId:", industrialManagementId, "isFllow:", isFllow, "userId:", uid)
+			go utils.SendAlarmMsg("用户关注产业更新相关标签,写入Redis队列消息失败:"+err.Error()+msg, 2)
+		}
+	}()
+	log := &models.CygxUserLabelLogRedis{UserId: uid, SourceId: industrialManagementId, SourceType: 4, IsFllow: isFllow, CreateTime: time.Now()}
+	if utils.Re == nil {
+		err := utils.Rc.LPush(utils.CYGX_USER_KEY_LABEL, log)
+		if err != nil {
+			fmt.Println("RecordNewLogs LPush Err:" + err.Error())
+		}
+	}
+	return
+}

+ 3 - 1
utils/constants.go

@@ -101,6 +101,7 @@ const (
 	CYGX_TACTICS_TIME_LINE_STATUS    string = "cygx_tactics_time_line_status" // 策略时间线是否对外开放
 	TIME_LINE_ID                     int    = 99999                           // 策略时间线的值
 	TIME_LINE_NAME                   string = "时间线"                           // 策略时间线的名称
+	ACTEGORY_ID_AI_QY                int    = 61                              // AI前沿自定义ID
 )
 
 // 模板消息推送类型
@@ -140,7 +141,8 @@ const (
 	YAN_XUAN_TAB_KEY = "yanxuan_header_tab"
 )
 const (
-	YD_TOKEN = "yidong_token"
+	YD_TOKEN            = "yidong_token"
+	CYGX_USER_KEY_LABEL = "CYGX_USER_KEY_LABEL" //查研观向用户标签
 )
 
 // 邀请机构标识