Forráskód Böngészése

Merge branch 'mfyx_3.6' of http://8.136.199.33:3000/cxzhang/hongze_mfyx into debug

xingzai 7 hónapja
szülő
commit
c4b5405045
2 módosított fájl, 103 hozzáadás és 8 törlés
  1. 4 0
      controllers/home.go
  2. 99 8
      services/es_comprehensive.go

+ 4 - 0
controllers/home.go

@@ -89,6 +89,10 @@ func (this *HomeController) NewList() {
 			if labelKeyword != utils.LABEL_L2_1 && labelKeyword != utils.LABEL_L2_2 {
 				condition += `  AND IF ( source = 'yanxuanspecial' , source_id   IN (0) ,1=1 ) `
 			}
+			//如果不是全部活动,就不展示对应的音视频
+			if labelKeyword != utils.LABEL_L1_1 {
+				condition += `   AND source  NOT IN ('activityvoice','activityvideo') `
+			}
 		}
 
 		yanxuanArticleIds = append(yanxuanArticleIds, 0)

+ 99 - 8
services/es_comprehensive.go

@@ -452,12 +452,20 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 	var activityIds []int             //活动
 	var yanxuanSpecialIds []int       // 研选专栏
 	var yanxuanspecialauthorIds []int //研选作者ID
+	var activityvideoIds []string     // 活动视频
+	var activityvoiceIds []string     //活动音频
+	var roadshowIds []string          //微路演
+	var askserieVideoIds []string     //问答系列视频
 	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt "`
 	for _, v := range list {
 		if v.Source == "article" {
 			articleIds = append(articleIds, v.SourceId)
 		} else if v.Source == "activity" {
 			activityIds = append(activityIds, v.SourceId)
+		} else if v.Source == "activityvideo" {
+			activityvideoIds = append(activityvideoIds, strconv.Itoa(v.SourceId))
+		} else if v.Source == "activityvoice" {
+			activityvoiceIds = append(activityvoiceIds, strconv.Itoa(v.SourceId))
 		} else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL {
 			yanxuanSpecialIds = append(yanxuanSpecialIds, v.SourceId)
 		} else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL_AUTHOR {
@@ -614,24 +622,107 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 		}
 	}
 
+	if len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds)+len(askserieVideoIds) > 0 {
+
+		audioIdstr := strings.Join(activityvoiceIds, ",")
+		activityVideoIdsStr := strings.Join(activityvideoIds, ",")
+		roadshowIdsStr := strings.Join(roadshowIds, ",")
+		askserieVideoIdsStr := strings.Join(askserieVideoIds, ",")
+
+		list, _, e := GetMicroRoadShowMycollectV12(len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds)+len(askserieVideoIds), 0, audioIdstr, activityVideoIdsStr, roadshowIdsStr, askserieVideoIdsStr, user)
+		if e != nil {
+			err = errors.New("GetMicroRoadShowMycollect, Err: " + e.Error())
+			return
+		}
+
+		// 用户权限
+		authInfo, permissionArr, e := GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+		if e != nil {
+			err = errors.New("GetUserRaiPermissionInfo, Err: " + e.Error())
+			return
+		}
+
+		// 获取默认图配置
+		audioMap, videoMap, audioShareMap, videoShareMap, e := GetMicroRoadShowDefaultImgConfig()
+		if e != nil {
+			err = errors.New("GetMicroRoadShowDefaultImgConfig, Err: " + e.Error())
+			return
+		}
+		//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+		for i := range list {
+			// 权限
+			au := new(models.UserPermissionAuthInfo)
+			au.SellerName = authInfo.SellerName
+			au.SellerMobile = authInfo.SellerMobile
+			au.HasPermission = authInfo.HasPermission
+			au.OperationMode = authInfo.OperationMode
+			if au.HasPermission == 1 {
+				// 非宏观权限进一步判断是否有权限
+				if list[i].ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, list[i].ChartPermissionName) {
+					au.HasPermission = 2
+				}
+			}
+			// 无权限的弹框提示
+			if au.HasPermission != 1 {
+				if au.OperationMode == UserPermissionOperationModeCall {
+					if list[i].Type == 1 {
+						au.PopupMsg = UserPermissionPopupMsgCallActivity
+					} else {
+						au.PopupMsg = UserPermissionPopupMsgCallMicroVideo
+					}
+				} else {
+					if list[i].Type == 1 {
+						au.PopupMsg = UserPermissionPopupMsgApplyActivity
+					} else {
+						au.PopupMsg = UserPermissionPopupMsgApplyMicroVideo
+					}
+				}
+			}
+			list[i].AuthInfo = au
+			list[i].PublishTime = utils.StrTimeToTime(list[i].PublishTime).Format(utils.FormatDate)
+			// 默认图
+			if list[i].BackgroundImg == "" {
+				if list[i].Type == 1 {
+					list[i].BackgroundImg = audioMap[list[i].ChartPermissionId]
+				} else {
+					list[i].BackgroundImg = videoMap[list[i].ChartPermissionId]
+				}
+			}
+			// 分享图
+			if list[i].ShareImg == "" {
+				if list[i].Type == 1 {
+					list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
+				} else {
+					list[i].ShareImg = videoShareMap[list[i].ChartPermissionId]
+				}
+			}
+			list[i].LabelKeywordImgLink = utils.LABEL_ICO_10
+		}
+		//Type                int    `description:"类型: 1-音频; 2-活动视频; 3-产业视频"`
+		for _, item := range list {
+			if item.Type == 1 {
+				mapItems[fmt.Sprint("activityvoice", item.Id)].Activityvoice = item
+			} else if item.Type == 2 {
+				mapItems[fmt.Sprint("activityvideo", item.Id)].Activityvideo = item
+			} else if item.Type == 3 {
+				mapItems[fmt.Sprint("roadshow", item.Id)].Roadshow = item
+			} else if item.Type == 4 {
+				mapItems[fmt.Sprint(utils.CYGX_OBJ_ASKSERIEVIDEO, item.Id)].AskserieVideo = item
+			}
+		}
+	}
+
 	for _, vList := range list {
 		for _, v := range mapItems {
 			//如果这些类型都为空,那么就不合并
-			//如果这些类型都为空,那么就不合并
-			if v.Article == nil && v.Activity == nil && v.YanxuanSpecial == nil && v.YanxuanSpecialAuthor == nil {
+			if v.Article == nil && v.Activity == nil && v.Activityvideo == nil && v.Activityvoice == nil && v.YanxuanSpecial == nil {
 				continue
 			}
-
 			if v.SourceId == vList.SourceId && v.Source == vList.Source {
 				items = append(items, v)
 			}
 		}
 	}
-	for _, v := range items {
-		if v.IndustrialResource != nil {
-			v.Source = "industrialsource"
-		}
-	}
 	return
 }