|
@@ -493,6 +493,7 @@ func GetReportChapterVideoList(permissionIds []int, classifyName string, list []
|
|
|
|
|
|
typeMap := make(map[int]*report_chapter_type.ReportChapterType)
|
|
|
var typeIds []int
|
|
|
+ typeIds = append(typeIds, 0)
|
|
|
for _, v := range typeList {
|
|
|
typeMap[int(v.ReportChapterTypeId)] = v
|
|
|
typeIds = append(typeIds, int(v.ReportChapterTypeId))
|
|
@@ -501,18 +502,10 @@ func GetReportChapterVideoList(permissionIds []int, classifyName string, list []
|
|
|
var chapters []*report_chapter.ReportChapter
|
|
|
setMap := make(map[int]int)
|
|
|
if classifyName != "晨报" {
|
|
|
-
|
|
|
- newTypeIds, tErr := GetWeekTypeIdsByPermissionIds(permissionIds, typeIds)
|
|
|
- if tErr != nil {
|
|
|
- errMsg = tErr.Error()
|
|
|
- err = errors.New("查询章节类型权限出错")
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- chapters, err = report_chapter.GetByTypeIdsAndReportIds(newTypeIds, reportIds, classifyName)
|
|
|
+
|
|
|
+ chapters, err = report_chapter.GetByPermissionIdListAndReportList(permissionIds, reportIds)
|
|
|
|
|
|
setList, _ := user_report_chapter_set.GetUserReportChapterSet(userId)
|
|
|
-
|
|
|
for _, v := range setList {
|
|
|
if v.IsClose == 0 {
|
|
|
setMap[v.TypeId] = v.TypeId
|
|
@@ -531,37 +524,49 @@ func GetReportChapterVideoList(permissionIds []int, classifyName string, list []
|
|
|
if classifyName != "晨报" {
|
|
|
weekAuthMap[v.ReportId] = true
|
|
|
}
|
|
|
- if temp, ok := typeMap[v.TypeId]; ok && v.VideoUrl != "" {
|
|
|
- if reportDetail, ok1 := reportMap[v.ReportId]; ok1 {
|
|
|
- reportDate := reportDetail.CreateTime
|
|
|
- if reportDate.Before(temp.PauseStartTime) || reportDate.After(temp.PauseEndTime) {
|
|
|
- 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)
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+ {
|
|
|
+ if v.VideoUrl == `` {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
+ reportDetail, ok := reportMap[v.ReportId]
|
|
|
+ if !ok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ reportDate := reportDetail.CreateTime
|
|
|
+
|
|
|
+
|
|
|
+ if v.TypeId > 0 {
|
|
|
+
|
|
|
+ temp, ok := typeMap[v.TypeId]
|
|
|
+ if !ok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (reportDate.After(temp.PauseStartTime) && reportDate.Before(temp.PauseEndTime)) || reportDate.Equal(temp.PauseStartTime) || reportDate.Equal(temp.PauseEndTime) {
|
|
|
+ continue
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if classifyName != "晨报" {
|
|
|
+ if _, sok := setMap[v.TypeId]; !sok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ 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)
|
|
|
}
|
|
|
|
|
|
return
|