|
@@ -12,6 +12,7 @@ import (
|
|
|
"hongze/hongze_yb/models/tables/rddp/report"
|
|
|
"hongze/hongze_yb/models/tables/rddp/report_chapter"
|
|
|
"hongze/hongze_yb/models/tables/report_chapter_type"
|
|
|
+ "hongze/hongze_yb/models/tables/user_report_chapter_set"
|
|
|
"hongze/hongze_yb/services"
|
|
|
"hongze/hongze_yb/services/collection"
|
|
|
"hongze/hongze_yb/services/company"
|
|
@@ -387,7 +388,7 @@ func CheckDayReportPermission(userInfo user.UserInfo, productAuthOk bool) (authO
|
|
|
}
|
|
|
|
|
|
// GetReportChapterVideoList 根据报告获取章节的音频列表
|
|
|
-func GetReportChapterVideoList(permissionIds []int, classifyName string, list []*report.Report) (videoMap map[int][]*response.VideoListItem, weekAuthMap map[int]bool, errMsg string, err error) {
|
|
|
+func GetReportChapterVideoList(permissionIds []int, classifyName string, list []*report.Report, userId uint64) (videoMap map[int][]*response.VideoListItem, weekAuthMap map[int]bool, errMsg string, err error) {
|
|
|
videoMap = make(map[int][]*response.VideoListItem)
|
|
|
weekAuthMap = make(map[int]bool)
|
|
|
var reportIds []int
|
|
@@ -417,6 +418,7 @@ func GetReportChapterVideoList(permissionIds []int, classifyName string, list []
|
|
|
}
|
|
|
|
|
|
var chapters []*report_chapter.ReportChapter
|
|
|
+ setMap := make(map[int]int)
|
|
|
if classifyName == "周报" {
|
|
|
// 查询用户有权限的章节ID
|
|
|
newTypeIds, tErr := GetWeekTypeIdsByPermissionIds(permissionIds, typeIds)
|
|
@@ -427,6 +429,14 @@ func GetReportChapterVideoList(permissionIds []int, classifyName string, list []
|
|
|
}
|
|
|
// 查询章节列表
|
|
|
chapters, err = report_chapter.GetByTypeIdsAndReportIds(newTypeIds, reportIds, classifyName)
|
|
|
+ //获取音频设置章节
|
|
|
+ setList, _ := user_report_chapter_set.GetUserReportChapterSet(userId)
|
|
|
+
|
|
|
+ for _, v := range setList {
|
|
|
+ if v.IsClose == 0 {
|
|
|
+ setMap[v.TypeId] = v.TypeId
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
// 查询章节列表
|
|
|
chapters, err = report_chapter.GetByTypeIdsAndReportIds(typeIds, reportIds, classifyName)
|
|
@@ -444,15 +454,29 @@ func GetReportChapterVideoList(permissionIds []int, classifyName string, list []
|
|
|
if reportDetail, ok1 := reportMap[v.ReportId]; ok1 {
|
|
|
reportDate := reportDetail.CreateTime
|
|
|
if reportDate.Before(temp.PauseStartTime) || reportDate.After(temp.PauseEndTime) {
|
|
|
- videoItem := new(response.VideoListItem)
|
|
|
- videoItem.VideoPlaySeconds = v.VideoPlaySeconds
|
|
|
- videoItem.VideoName = v.VideoName
|
|
|
- if v.VideoName == "" {
|
|
|
- videoItem.VideoName = v.Title
|
|
|
+ if classifyName == "周报" {
|
|
|
+ if _, sok := setMap[v.TypeId]; sok {
|
|
|
+ videoItem := new(response.VideoListItem)
|
|
|
+ videoItem.VideoPlaySeconds = v.VideoPlaySeconds
|
|
|
+ videoItem.VideoName = v.VideoName
|
|
|
+ if v.VideoName == "" {
|
|
|
+ videoItem.VideoName = v.Title
|
|
|
+ }
|
|
|
+ videoItem.VideoUrl = v.VideoUrl
|
|
|
+ videoItem.Sort = v.Sort
|
|
|
+ videoMap[v.ReportId] = append(videoMap[v.ReportId], videoItem)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ videoItem := new(response.VideoListItem)
|
|
|
+ videoItem.VideoPlaySeconds = v.VideoPlaySeconds
|
|
|
+ videoItem.VideoName = v.VideoName
|
|
|
+ if v.VideoName == "" {
|
|
|
+ videoItem.VideoName = v.Title
|
|
|
+ }
|
|
|
+ videoItem.VideoUrl = v.VideoUrl
|
|
|
+ videoItem.Sort = v.Sort
|
|
|
+ videoMap[v.ReportId] = append(videoMap[v.ReportId], videoItem)
|
|
|
}
|
|
|
- videoItem.VideoUrl = v.VideoUrl
|
|
|
- videoItem.Sort = v.Sort
|
|
|
- videoMap[v.ReportId] = append(videoMap[v.ReportId], videoItem)
|
|
|
}
|
|
|
}
|
|
|
|