Browse Source

专栏列表调整音频部分

xiexiaoyuan 3 years ago
parent
commit
443e50bca0

+ 2 - 0
models/response/classify.go

@@ -38,6 +38,8 @@ type ClassReportListItem struct {
 	PublishTime        time.Time `description:"发布时间" json:"publish_time"`
 	Stage              int    `description:"期数" json:"stage"`
 	VideoUrl           string `description:"音频文件URL" json:"video_url"`
+	VideoName           string    `json:"video_name"`               //音频文件名称
+	VideoPlaySeconds    string    `json:"video_play_seconds"`      //音频播放时长
 }
 type ClassReportList struct {
 	List    []*ClassReportListItem   	`json:"list"`

+ 1 - 1
models/tables/rddp/report/query.go

@@ -186,7 +186,7 @@ func GetReportListByCondition(condition string, pars []interface{}) (list []*Rep
 // GetListByClassifyIdSecond 按照二级类型分页查询
 func GetListByClassifyIdSecond(classifyIdSecond int,  offset , limit int) (reportList []*Report, err error) {
 	err = global.MYSQL["rddp"].Model(Report{}).
-		Select("id, classify_id_first, classify_name_first, classify_id_second, classify_name_second, title, stage, publish_time, author,  video_url, abstract").
+		Select("id, classify_id_first, classify_name_first, classify_id_second, classify_name_second, title, stage, publish_time, author, video_name, video_url, video_play_seconds, abstract").
 		Where("classify_id_second = ? and state = 2 ", classifyIdSecond).
 		Order("publish_time desc, id desc").
 		Offset(offset).

+ 5 - 0
services/report/classify.go

@@ -205,6 +205,11 @@ func GetClassifyReportList(user user.UserInfo, classifyIdSecond int, pageIndex,
 			reportItem.Abstract = reportInfo.Abstract
 			reportItem.Author = reportInfo.Author
 			reportItem.ReportImgUrl = classifyInfo.ReportImgUrl
+			reportItem.VideoName = reportInfo.VideoName
+			reportItem.VideoPlaySeconds = reportInfo.VideoPlaySeconds
+			if  reportInfo.VideoUrl != "" && reportInfo.VideoName == "" {
+				reportItem.VideoName = reportInfo.Title
+			}
 			if authOk {
 				reportItem.VideoUrl = reportInfo.VideoUrl
 			}

+ 6 - 0
services/report/report.go

@@ -384,6 +384,9 @@ func GetReportDetail(userinfo user.UserInfo, reportId int) (reportDetail respons
 	reportItem.ContentSub = html.UnescapeString(reportInfo.ContentSub)
 	reportItem.Frequency = reportInfo.Frequency
 	reportItem.VideoName = reportInfo.VideoName
+	if reportInfo.VideoName == "" &&  reportInfo.VideoUrl != "" {
+		reportItem.VideoName = reportInfo.Title
+	}
 	reportItem.VideoPlaySeconds = reportInfo.VideoPlaySeconds
 	reportItem.Author = reportInfo.Author
 	var reportTypeList []*response.ReportChapterListItem
@@ -729,6 +732,9 @@ func GetReportList(user user.UserInfo, keyWord string, classifyIdFirst, classify
 					videoTemp := new(response.VideoListItem)
 					videoTemp.VideoUrl = reportInfo.VideoUrl
 					videoTemp.VideoName = reportInfo.VideoName
+					if reportInfo.VideoName == "" {
+						videoTemp.VideoName = reportInfo.Title
+					}
 					videoTemp.VideoPlaySeconds = reportInfo.VideoPlaySeconds
 					reportItem.VideoList = append(reportItem.VideoList, videoTemp)
 				}

+ 6 - 0
services/report/report_chapter.go

@@ -221,6 +221,9 @@ func GetChapterDetail(user user.UserInfo, reportChapterId int) (reportChapterDet
 	reportChapterItem.PublishTime = reportChapter.PublishTime
 	reportChapterItem.VideoPlaySeconds = reportChapter.VideoPlaySeconds
 	reportChapterItem.VideoName = reportChapter.VideoName
+	if reportChapter.VideoUrl != "" && reportChapter.VideoName == "" {
+		reportChapterItem.VideoName = reportChapter.Title
+	}
 	reportChapterItem.VideoSize = reportChapter.VideoSize
 	reportChapterItem.TypeName = reportChapter.TypeName
 	reportChapterItem.Author = reportChapter.Author
@@ -385,6 +388,9 @@ func GetReportChapterVideoList(permissionIds []int, classifyName string, list []
 					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)