xingzai vor 2 Jahren
Ursprung
Commit
333e955fd0
1 geänderte Dateien mit 103 neuen und 0 gelöschten Zeilen
  1. 103 0
      controllers/report_billboard.go

+ 103 - 0
controllers/report_billboard.go

@@ -3,6 +3,7 @@ package controllers
 import (
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
 	"time"
 )
@@ -148,6 +149,108 @@ func (this *ReportBillboardController) FllowList() {
 		list[k].PermissionName = permissionMap[v.ChartPermissionId]
 	}
 
+	//查询产业视频
+	industrialVideoMap := make(map[int]*models.MicroVideoSimpleInfo)
+	var industrialManagementIds []int
+	for _, v := range list {
+		if v.IndustrialManagementId > 0 {
+			industrialManagementIds = append(industrialManagementIds, v.IndustrialManagementId)
+		}
+	}
+
+	// 用户权限
+	authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
+		return
+	}
+	mapUPdateTime := make(map[int]string)
+
+	if len(industrialManagementIds) > 0 {
+		// 获取默认图配置
+		_, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
+		if e != nil {
+			br.Msg = "获取视频默认配置图失败"
+			br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
+			return
+		}
+		videoList, err := models.GetMicroRoadshowVideoByIndustryIds(industrialManagementIds)
+		if err != nil {
+			br.Msg = "产业视频列表失败"
+			br.ErrMsg = "产业视频列表失败, Err: " + err.Error()
+			return
+		}
+		for _, v := range videoList {
+			tmp := &models.MicroVideoSimpleInfo{
+				Id:                  v.VideoId,
+				Title:               "5min逻辑【" + v.IndustryName + "】解析",
+				ResourceUrl:         v.VideoUrl,
+				BackgroundImg:       v.ImgUrl,
+				PlaySeconds:         v.VideoDuration,
+				DetailImgUrl:        v.DetailImgUrl,
+				ChartPermissionId:   v.ChartPermissionId,
+				ChartPermissionName: v.ChartPermissionName,
+			}
+			if tmp.BackgroundImg == "" {
+				tmp.BackgroundImg = videoMap[v.ChartPermissionId]
+			}
+			industrialVideoMap[v.IndustryId] = tmp
+		}
+		//获取这些产业下最新更新的文章
+		listUpdateTime, err := models.GetNewArticleDetailByIndustrialIds(industrialManagementIds)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			return
+		}
+		for _, v := range listUpdateTime {
+			mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
+		}
+
+		//时间线的更新时间
+		//	maptimelineUPdateTime := make(map[int]string)
+		listtimelinePublishdate, err := models.GetTimeLineReportIndustrialPublishdateList(industrialManagementIds)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			return
+		}
+		for _, v := range listtimelinePublishdate {
+			if mapUPdateTime[v.IndustrialManagementId] != "" {
+				if utils.StrTimeToTime(v.PublishDate).After(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
+					mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
+				}
+			}
+		}
+	}
+
+	for k, v := range list {
+		//展示产业视频
+		if video, ok := industrialVideoMap[v.IndustrialManagementId]; ok {
+			//控制用户权限
+			// 权限
+			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 video.ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, video.ChartPermissionName) {
+					au.HasPermission = 2
+				}
+			}
+			// 无权限的弹框提示
+			if au.HasPermission != 1 {
+				if au.OperationMode == services.UserPermissionOperationModeCall {
+					au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
+				} else {
+					au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
+				}
+				video.ResourceUrl = ""
+			}
+			list[k].AuthInfo = au
+			list[k].IndustryVideo = video
+		}
+	}
+
 	page := paging.GetPaging(1, topNum, len(list))
 	resp := new(models.IndustrialManagementList)
 	resp.List = list