Browse Source

Merge branch 'feature/8.4_industry_video' of hongze/hongze_cygx into master

xyxie 2 years ago
parent
commit
90227d2fd6

+ 11 - 4
controllers/micro_roadshow.go

@@ -116,10 +116,17 @@ func (this *MicroRoadShowController) List() {
 			}
 		}
 		// 分享图
-		if list[i].Type == 1 {
-			list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
-		} else {
-			list[i].ShareImg = videoShareMap[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]
+			}
+		}
+
+		//修改产业视频的标题
+		if list[i].Type == 3 && list[i].IndustryName != ""{
+			list[i].Title = "5min"+"【"+ list[i].IndustryName +"】"+"逻辑解析"
 		}
 	}
 

+ 212 - 6
controllers/report.go

@@ -251,6 +251,56 @@ func (this *ReportController) IndustryList() {
 		topReadIndustryId = topReadIndustry.IndustrialManagementId
 	}
 
+	//查询产业视频
+	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
+	}
+
+	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
+		}
+	}
+
+
 	nowTime := time.Now().Local()
 	threeMonBefore := nowTime.AddDate(0, -3, 0)
 	for k, v := range list {
@@ -300,6 +350,35 @@ func (this *ReportController) IndustryList() {
 				list[k].IsNew = true
 			}
 		}
+
+		//展示产业视频
+		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
+		}
+
 	}
 	//记录用户搜索的筛选条件
 	if orderColumnNew != "" {
@@ -381,17 +460,73 @@ func (this *ReportController) ArticleCategoryList() {
 			list[k].IsRed = true
 		}
 	}
-	//detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
-	//if err != nil {
-	//	br.Msg = "获取信息失败"
-	//	br.ErrMsg = "获取信息失败,Err:" + err.Error()
-	//	return
-	//}
+
+	// 用户权限
+	authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
+		return
+	}
+
+	videoSimple := new(models.MicroVideoSimpleInfo)
+	// 权限
+	var au  *models.UserPermissionAuthInfo
+	video, err := models.GetMicroRoadshowVideoByIndustryId(industrialManagementId)
+	if err != nil {
+		if err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取产业视频失败"
+			br.ErrMsg = "获取产业视频失败,Err:" + err.Error()
+			return
+		}
+	}else{
+		videoSimple.Id = video.VideoId
+		videoSimple.Title = "5min逻辑【"+video.IndustryName+"】解析"
+		videoSimple.BackgroundImg = video.ImgUrl
+		videoSimple.DetailImgUrl = video.DetailImgUrl
+		if videoSimple.BackgroundImg == "" {
+			// 获取默认图配置
+			_, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
+			if e != nil {
+				br.Msg = "获取视频默认配置图失败"
+				br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
+				return
+			}
+			videoSimple.BackgroundImg = videoMap[video.ChartPermissionId]
+		}
+		videoSimple.PlaySeconds = video.VideoDuration
+		videoSimple.ResourceUrl = video.VideoUrl
+		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
+			}
+			videoSimple.ResourceUrl = ""
+		}
+	}
 	resp := new(models.IndustrialToArticleCategoryListRep)
 	resp.List = list
 	resp.LayoutTime = utils.TimeRemoveHms(detail.LayoutTime)
 	resp.IndustryName = detail.IndustryName
 	resp.IndustrialManagementId = industrialManagementId
+	resp.AuthInfo = au
+	if videoSimple.Id > 0 {
+		resp.IndustryVideo = videoSimple
+	}
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
@@ -2643,9 +2778,79 @@ func (this *ReportController) SearchReportAndResource() {
 			listYxResource[k].IsFollw = true
 		}
 		industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
+
 	}
 
 	if len(industrialIdArr) > 0 {
+		//查询产业视频
+		industrialVideoMap := make(map[int]*models.MicroVideoSimpleInfo)
+		// 获取默认图配置
+		_, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
+		if e != nil {
+			br.Msg = "获取视频默认配置图失败"
+			br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
+			return
+		}
+		videoList, err := models.GetMicroRoadshowVideoByIndustryIds(industrialIdArr)
+		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,
+				ChartPermissionName: v.ChartPermissionName,
+				ChartPermissionId: v.ChartPermissionId,
+			}
+			if tmp.BackgroundImg == "" {
+				tmp.BackgroundImg = videoMap[v.ChartPermissionId]
+			}
+			industrialVideoMap[v.IndustryId] = tmp
+		}
+
+		//查询权限
+		// 用户权限
+		authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+		if e != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
+			return
+		}
+
+		for k, v := range listHzResource {
+			//展示产业视频
+			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 = ""
+				}
+				listHzResource[k].AuthInfo = au
+				listHzResource[k].IndustryVideo = video
+			}
+		}
+
 		//合并产业关联的标的
 		listSubjcet, err = models.GetIndustrialSubjectAllByIndustrialId(industrialIdArr)
 		if err != nil {
@@ -2668,6 +2873,7 @@ func (this *ReportController) SearchReportAndResource() {
 				}
 			}
 		}
+
 	}
 
 	resp := new(models.SearchReportAndResourceResp)

+ 1 - 1
models/industrial_management.go

@@ -61,7 +61,7 @@ func GetIndustrialManagemenCountNoTop(sqlChartPermissionId string, uid int, cond
 func GetIndustrialManagementAll(uid int, condition, orderSrt string, startSize, pageSize int) (items []*IndustrialManagement, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
-			man.*,
+			man.*,re.chart_permission_name as permission_name,
             MAX( art.publish_date ) AS update_time , MIN(art.publish_date) AS min_report_time,(
 			SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ` + strconv.Itoa(uid) + ` AND rec.article_id = art.article_id ) AS readnum ,
 		    (SELECT COUNT( 1 )  FROM cygx_industry_fllow AS f WHERE f.user_id = ` + strconv.Itoa(uid) + ` AND f.industrial_management_id = man.industrial_management_id AND f.type = 1) AS is_follow

+ 25 - 152
models/micro_roadshow.go

@@ -3,6 +3,7 @@ package models
 import (
 	"github.com/beego/beego/v2/client/orm"
 	"github.com/rdlucklib/rdluck_tools/paging"
+	"hongze/hongze_cygx/utils"
 	"time"
 )
 
@@ -17,122 +18,18 @@ type MicroRoadShowPageList struct {
 	Id                  int    `description:"音视频ID"`
 	Title               string `description:"标题"`
 	ResourceUrl         string `description:"链接"`
-	Type                int    `description:"类型: 1-音频; 2-视频"`
+	Type                int    `description:"类型: 1-音频; 2-活动视频; 3-产业视频"`
 	PublishTime         string `description:"发布时间"`
 	BackgroundImg       string `description:"背景图"`
 	ShareImg            string `description:"分享封面图"`
 	ChartPermissionId   int    `description:"行业ID"`
 	ChartPermissionName string `description:"行业名称"`
+	IndustryName        string `description:"产业名称"`
 	PlaySeconds         string `description:"音视频时长"`
 	ActivityId          int    `description:"活动ID"`
 	AuthInfo            *UserPermissionAuthInfo
 }
 
-// GetMicroRoadShowAudioPageList 获取微路演音频列表-分页
-func GetMicroRoadShowAudioPageList(startSize, pageSize int, condition string, pars []interface{}) (total int, list []*MicroRoadShowPageList, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-				a.activity_voice_id AS id,
-				a.voice_name AS title,
-				a.voice_url AS resource_url,
-				1 AS type,
-				b.activity_time AS publish_time,
-				b.chart_permission_id,
-				b.chart_permission_name,
-				a.voice_play_seconds AS play_seconds,
-				a.img_url AS background_img,
-				a.activity_id
-			FROM
-				cygx_activity_voice AS a
-			JOIN cygx_activity AS b ON a.activity_id = b.activity_id
-			WHERE 1 = 1 `
-	if condition != `` {
-		sql += condition
-	}
-	sql += ` ORDER BY publish_time DESC`
-
-	//totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
-	//err = o.Raw(totalSql, pars).QueryRow(&total)
-	//if err != nil {
-	//	return
-	//}
-
-	sql += ` LIMIT ?,?`
-	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
-	return
-}
-
-// GetMicroRoadShowAudioTotal 获取微路演音频数量
-func GetMicroRoadShowAudioTotal(condition string, pars []interface{}) (total int, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-				a.activity_id
-			FROM
-				cygx_activity_voice AS a
-			JOIN cygx_activity AS b ON a.activity_id = b.activity_id
-			WHERE 1 = 1 `
-	if condition != `` {
-		sql += condition
-	}
-	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
-	err = o.Raw(totalSql, pars).QueryRow(&total)
-	if err != nil {
-		return
-	}
-	return
-}
-
-// GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
-func GetMicroRoadShowVideoPageList(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}) (total int, list []*MicroRoadShowPageList, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-			video_id AS id,
-			video_name AS title,
-			video_url AS resource_url,
-			2 AS type,
-			publish_date AS publish_time,
-			chart_permission_id,
-			chart_permission_name,
-			video_duration AS play_seconds,
-			img_url AS background_img,
-			"" as  activity_id
-		FROM
-			cygx_micro_roadshow_video 
-		WHERE
-			publish_status = 1 `
-	if condition != `` {
-		sql += condition
-	}
-	sql += ` UNION ALL
-		SELECT
-			video_id AS id,
-			video_name AS title,
-			video_url AS resource_url,
-			2 AS type,
-		art.activity_time as publish_time,
-			art.chart_permission_id,
-			art.chart_permission_name,
-			"",
-			"",
-			v.activity_id
-		FROM
-			cygx_activity_video as v
-			INNER JOIN cygx_activity as art on art.activity_id = v.activity_id WHERE 1= 1  `
-	if conditionAct != `` {
-		sql += conditionAct
-	}
-	sql += ` ORDER BY publish_time DESC`
-	//totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
-	//err = o.Raw(totalSql, pars, parsAct).QueryRow(&total)
-	//if err != nil {
-	//	return
-	//}
-
-	sql += ` LIMIT ?,?`
-	_, err = o.Raw(sql, pars, parsAct, startSize, pageSize).QueryRows(&list)
-	return
-}
-
 // GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
 func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}, audioId, videoId, activityVideoId int) (total int, list []*MicroRoadShowPageList, err error) {
 	o := orm.NewOrm()
@@ -142,12 +39,14 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			video_id AS id,
 			video_name AS title,
 			video_url AS resource_url,
-			2 AS type,
+			3 AS type,
 			publish_date AS publish_time,
 			chart_permission_id,
 			chart_permission_name,
+            industry_name,
 			video_duration AS play_seconds,
 			img_url AS background_img,
+			share_img_url AS share_img,
 			"" as  activity_id
 		FROM
 			cygx_micro_roadshow_video 
@@ -173,6 +72,8 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			art.chart_permission_name,
 			"" AS play_seconds,
 			"" AS background_img,
+			"" AS share_img,
+			"" AS industry_name,
 			v.activity_id
 		FROM
 			cygx_activity_video as v
@@ -197,6 +98,8 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			b.chart_permission_name,
 			a.voice_play_seconds AS play_seconds,
 			a.img_url AS background_img,
+			"" AS share_img,
+            "" AS industry_name,
 			a.activity_id 
 		FROM
 			cygx_activity_voice AS a
@@ -216,51 +119,6 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 	return
 }
 
-// GetMicroRoadShowVideoTotal 获取微路演视频总量
-func GetMicroRoadShowVideoTotal(condition string, pars []interface{}, conditionAct string, parsAct []interface{}) (total int, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-			video_id AS id,
-			video_name AS title,
-			video_url AS resource_url,
-			2 AS type,
-			publish_date AS publish_time,
-			chart_permission_id,
-			chart_permission_name,
-			video_duration AS play_seconds,
-			img_url AS background_img,
-			"" as  activity_id
-		FROM
-			cygx_micro_roadshow_video 
-		WHERE
-			publish_status = 1 `
-	if condition != `` {
-		sql += condition
-	}
-	sql += ` UNION ALL
-		SELECT
-			video_id AS id,
-			video_name AS title,
-			video_url AS resource_url,
-			2 AS type,
-		art.activity_time as publish_time,
-			art.chart_permission_id,
-			art.chart_permission_name,
-			"",
-			"",
-			v.activity_id
-		FROM
-			cygx_activity_video as v
-			INNER JOIN cygx_activity as art on art.activity_id = v.activity_id WHERE 1= 1  `
-	if conditionAct != `` {
-		sql += conditionAct
-	}
-	sql += ` ORDER BY publish_time DESC`
-	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
-	err = o.Raw(totalSql, pars, parsAct).QueryRow(&total)
-	return
-}
-
 type AddVideoHistoryReq struct {
 	VideoId     int `description:"视频ID"`
 	PlaySeconds int `description:"播放时长"`
@@ -416,6 +274,7 @@ type MicroRoadshowVideo struct {
 	VideoUrl            string    `description:"视频地址"`
 	CreateTime          time.Time `description:"创建时间"`
 	ImgUrl              string    `description:"背景图链接"`
+	DetailImgUrl        string    `description:"产业详情页背景图"`
 }
 
 // GetMicroRoadshowVideoById 主键获取微路演视频
@@ -431,3 +290,17 @@ func UpdateCygxActivityVideoCounts(activityId int) (err error) {
 	_, err = o.Raw(sql, activityId).Exec()
 	return
 }
+
+// GetMicroRoadshowVideoByIndustryIds 根据行业ID查询产业视频列表
+func GetMicroRoadshowVideoByIndustryIds(industrialIdArr []int) (list []*MicroRoadshowVideo, err error) {
+	sql := `SELECT * FROM cygx_micro_roadshow_video WHERE industry_id in (` + utils.GetOrmInReplace(len(industrialIdArr)) + `)  and publish_status = 1 `
+	_, err = orm.NewOrm().Raw(sql, industrialIdArr).QueryRows(&list)
+	return
+}
+
+// GetMicroRoadshowVideoByIndustryId 根据行业ID查询产业视频列表
+func GetMicroRoadshowVideoByIndustryId(industryId int) (item *MicroRoadshowVideo, err error) {
+	sql := `SELECT * FROM cygx_micro_roadshow_video WHERE industry_id = ? and publish_status = 1`
+	err = orm.NewOrm().Raw(sql, industryId).QueryRow(&item)
+	return
+}

+ 26 - 10
models/report.go

@@ -10,6 +10,7 @@ import (
 type IndustrialManagementList struct {
 	Paging *paging.PagingItem
 	List   []*IndustrialManagement
+
 }
 
 type IndustrialManagement struct {
@@ -32,6 +33,19 @@ type IndustrialManagement struct {
 	IndustrialSubjectList  []*IndustrialSubject `description:"标的列表"`
 	ChartPermissionId      int                  `description:"行业ID"`
 	PermissionName         string               `description:"行业名称"`
+	IndustryVideo          *MicroVideoSimpleInfo
+	AuthInfo               *UserPermissionAuthInfo
+}
+
+type MicroVideoSimpleInfo struct {
+	Id                  int    `description:"视频ID"`
+	Title               string `description:"标题"`
+	ResourceUrl         string `description:"链接"`
+	BackgroundImg       string `description:"背景图"`
+	PlaySeconds         int    `description:"音视频时长"`
+	DetailImgUrl        string `description:"产业详情页背景图"`
+	ChartPermissionId   int    `description:"行业ID"`
+	ChartPermissionName string `description:"行业名称"`
 }
 
 type IndustrialAnalyst struct {
@@ -382,16 +396,18 @@ func GetArticleCollectionList(condition string, userId int) (items []*ArticleCol
 
 //用户收藏榜start
 type IndustrialManagementHotResp struct {
-	IndustrialManagementId int                  `orm:"column(industrial_management_id);pk" description:"产业id"`
-	IndustryName           string               `description:"产业名称"`
-	IsFollw                bool                 `description:"是否关注"`
-	FllowNum               int                  `description:"关注数量"`
-	IsNew                  bool                 `description:"是否新标签"`
-	IsHot                  bool                 `description:"是否新标签"`
-	PublishDate            string               `description:"发布时间"`
-	ArticleReadNum         int                  `description:"文章阅读数量"`
-	Source                 int                  `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
-	IndustrialSubjectList  []*IndustrialSubject `description:"标的列表"`
+	IndustrialManagementId int                   `orm:"column(industrial_management_id);pk" description:"产业id"`
+	IndustryName           string                `description:"产业名称"`
+	IsFollw                bool                  `description:"是否关注"`
+	FllowNum               int                   `description:"关注数量"`
+	IsNew                  bool                  `description:"是否新标签"`
+	IsHot                  bool                  `description:"是否新标签"`
+	PublishDate            string                `description:"发布时间"`
+	ArticleReadNum         int                   `description:"文章阅读数量"`
+	Source                 int                   `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
+	IndustrialSubjectList  []*IndustrialSubject  `description:"标的列表"`
+	IndustryVideo          *MicroVideoSimpleInfo `description:"产业视频"`
+	AuthInfo               *UserPermissionAuthInfo
 }
 
 type IndustrialManagementHotListResp struct {

+ 2 - 0
models/report_mapping.go

@@ -101,9 +101,11 @@ type IndustrialToArticleCategoryRep struct {
 }
 
 type IndustrialToArticleCategoryListRep struct {
+	AuthInfo               *UserPermissionAuthInfo
 	LayoutTime             string `description:"布局时间"`
 	IndustryName           string `description:"产业名称"`
 	IndustrialManagementId int    `description:"产业D"`
+	IndustryVideo          *MicroVideoSimpleInfo
 	List                   []*IndustrialToArticleCategoryRep
 }
 

+ 0 - 190
services/micro_roadshow.go

@@ -5,199 +5,9 @@ import (
 	"errors"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/utils"
-	"math"
-	"strconv"
-	"strings"
-	"sync"
 	"time"
 )
 
-// GetMicroRoadShowPageList 获取微路演列表
-func GetMicroRoadShowPageList(pageSize, currentIndex, audioId, videoId, activityVideoId int, keywords string) (respList []*models.MicroRoadShowPageList, total int, err error) {
-	var e error
-	// 根据每页数据量获取音视频配比
-	audioRatio, videoRatio, audioPageNum, videoPageNum, sliceNum, e := getMicroRoadShowDataRatio(pageSize)
-	if e != nil {
-		err = errors.New("获取微路演列表数据音视频配比失败, Err: " + e.Error())
-		return
-	}
-
-	audioTotal := 0
-	videoTotal := 0
-	audioList := make([]*models.MicroRoadShowPageList, 0)
-	videoList := make([]*models.MicroRoadShowPageList, 0)
-	if keywords != "" {
-		keywords = "%" + keywords + "%"
-	}
-	// 查询指定音频/视频时, 调整比例为1方便后面组合数据
-	if audioId > 0 || videoId > 0 || activityVideoId > 0 {
-		audioRatio = 1
-		videoRatio = 1
-	}
-
-	wg := sync.WaitGroup{}
-
-	wg.Add(2)
-
-	// 分页查询音频
-	go func() {
-		defer wg.Done()
-		// 如果筛选条件为指定视频ID则不做音频查询
-		if videoId > 0 || activityVideoId > 0 {
-			return
-		}
-		var audioCond string
-		var audioPars []interface{}
-		// 活动已发布且已结束
-		audioCond += ` AND b.publish_status = 1 AND b.active_state = 3`
-		//活动音频,设置有效时间为30天,失效后该活动就不再支持音频回放。有效期起始时间为活动的开始时间
-		endTime := time.Now().AddDate(0, 0, -30).Format("2006-01-02 15:04:05")
-		audioCond += ` AND b.activity_time > ? `
-		audioPars = append(audioPars, endTime)
-		if keywords != "" {
-			audioCond += ` AND a.voice_name LIKE ? OR b.label LIKE ?`
-			audioPars = append(audioPars, keywords, keywords)
-		}
-		if audioId > 0 {
-			audioCond += ` AND a.activity_voice_id = ?`
-			audioPars = append(audioPars, audioId)
-		}
-		audioStartSize := 0
-		if currentIndex > 1 {
-			audioStartSize = (currentIndex - 1) * audioPageNum
-		}
-		audioTotal, audioList, e = models.GetMicroRoadShowAudioPageList(audioStartSize, audioPageNum, audioCond, audioPars)
-	}()
-
-	// 分页查询视频
-	go func() {
-		defer wg.Done()
-		// 如果筛选条件为指定音频ID则不做视频查询
-		if audioId > 0 {
-			return
-		}
-
-		var videoCond string
-		var videoCondAct string
-		var videoPars []interface{}
-		var videoParsAct []interface{}
-		if keywords != "" {
-			videoCond += ` AND video_name LIKE ?`
-			videoPars = append(videoPars, keywords)
-
-			videoCondAct += ` AND video_name LIKE ?`
-			videoParsAct = append(videoParsAct, keywords)
-		}
-		if videoId > 0 {
-			videoCond += ` AND video_id = ?`
-			videoPars = append(videoPars, videoId)
-		}
-
-		if activityVideoId > 0 {
-			videoCondAct += ` AND video_id = ?`
-			videoParsAct = append(videoParsAct, activityVideoId)
-		}
-
-		//如果传了路演的或者活动的视频ID只查询一个
-		if videoId > 0 {
-			videoCondAct += ` AND video_id = 0 `
-		}
-		if activityVideoId > 0 {
-			videoCond += ` AND video_id = 0 `
-		}
-
-		endTime := time.Now().AddDate(0, 0, -30).Format("2006-01-02 15:04:05")
-		videoCondAct += ` AND art.activity_time > ? `
-		videoParsAct = append(videoParsAct, endTime)
-
-		videoCond += ` AND publish_status = 1`
-		videoStartSize := 0
-		if currentIndex > 1 {
-			videoStartSize = (currentIndex - 1) * videoPageNum
-		}
-		videoTotal, videoList, e = models.GetMicroRoadShowVideoPageList(videoStartSize, videoPageNum, videoCond, videoPars, videoCondAct, videoParsAct)
-	}()
-
-	wg.Wait()
-
-	if e != nil {
-		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
-		return
-	}
-
-	// 按比例组合列表
-	audioNum := 0
-	videoNum := 0
-	audioLen := len(audioList)
-	videoLen := len(videoList)
-	for i := 0; i < sliceNum; i++ {
-		// 音频-每次取对应比例的数据直至取完
-		for a := 0; a < audioRatio; a++ {
-			if audioNum >= audioLen {
-				break
-			}
-			respList = append(respList, audioList[audioNum])
-			audioNum += 1
-		}
-		// 视频
-		for b := 0; b < videoRatio; b++ {
-			if videoNum >= videoLen {
-				break
-			}
-			respList = append(respList, videoList[videoNum])
-			videoNum += 1
-		}
-	}
-	total = audioTotal + videoTotal
-	return
-}
-
-// getMicroRoadShowDataRatio 获取微路演列表数据音视频配比
-func getMicroRoadShowDataRatio(pageSize int) (audioRatio, videoRatio, audioPageNum, videoPageNum, sliceNum int, err error) {
-	if pageSize <= 0 {
-		pageSize = utils.PageSize20
-	}
-	key := models.MicroRoadShowListDataRatioConfigKey
-	config, e := models.GetConfigByCode(key)
-	if e != nil && e.Error() != utils.ErrNoRow() {
-		err = errors.New("获取微路演列表数据量配置失败, Err: " + e.Error())
-		return
-	}
-
-	// 默认音频视频展示比例为4:1
-	ratio := "4:1"
-	if config != nil {
-		ratio = config.ConfigValue
-	}
-	ratioArr := strings.Split(ratio, ":")
-	if len(ratioArr) != 2 {
-		err = errors.New("微路演列表数据量配比有误")
-		return
-	}
-	audioRatio, e = strconv.Atoi(ratioArr[0])
-	if e != nil {
-		err = errors.New("微路演列表数据量配比有误")
-		return
-	}
-	videoRatio, e = strconv.Atoi(ratioArr[1])
-	if e != nil {
-		err = errors.New("微路演列表数据量配比有误")
-		return
-	}
-	totalRatio := audioRatio + videoRatio
-	if totalRatio == 0 {
-		err = errors.New("微路演列表数据量配比有误")
-		return
-	}
-
-	// 每比率对应数量(向上取整)
-	sliceNum = int(math.Ceil(float64(pageSize) / float64(totalRatio)))
-	audioPageNum = audioRatio * sliceNum
-	videoPageNum = videoRatio * sliceNum
-
-	return
-}
-
 // GetMicroRoadShowDefaultImgConfig 获取微路演默认图/分享图配置
 func GetMicroRoadShowDefaultImgConfig() (audioMap, videoMap, audioShareMap, videoShareMap map[int]string, err error) {
 	audioMap = make(map[int]string, 0)