详情页评论改推荐列表

This commit is contained in:
谢宇宁
2026-09-29 16:45:18 +07:00
parent d546160cc7
commit 41a45c8975
16 changed files with 160 additions and 1207 deletions
+52 -118
View File
@@ -2,7 +2,6 @@ package web
import (
"strings"
"videoweb/app/service/commentser"
"videoweb/app/service/playletser"
"videoweb/app/service/videoser"
@@ -76,20 +75,6 @@ func Play(c *gin.Context) {
})
}
commentObjectID := playlet.ID
commentObjectType := commentser.ObjectTypePlaylet
if chapterID > 0 {
commentObjectID = chapterID
commentObjectType = commentser.ObjectTypeChapter
}
comments := commentser.FetchListOrEmpty(c, commentser.ListQuery{
ObjectID: commentObjectID,
ObjectType: commentObjectType,
PageNum: 1,
PageSize: 4,
SortOrder: commentser.SortHot,
})
canWatch := false
episode := 0
if chapter != nil {
@@ -119,45 +104,36 @@ func Play(c *gin.Context) {
}
data := gin.H{
"title": title,
"navActive": "list",
"seoInfo": seo,
"playlet": playlet,
"chapter": chapter,
"chapterID": chapterID,
"episode": episode,
"canWatch": canWatch,
"mainURL": mainURL,
"previewURL": previewURL,
"hasPreview": previewURL != "",
"nextChapterID": playletser.NextChapterID(playlet, chapterID),
"advitise": playlet.Advitise,
"related": playlet.RelatedRecommendData,
"guessLike": guessLike.List,
"guessPage": guessLike.PageNum,
"guessPageSize": guessLike.PageSize,
"guessTotal": guessLike.TotalCount,
"hotList": hotList,
"hotMoreURL": playletser.AllListURL("all", 0, 0, 2, 1),
"comments": comments.List,
"commentTotal": comments.TotalCount,
"commentPage": comments.PageNum,
"commentSize": comments.PageSize,
"commentObjectID": commentObjectID,
"commentObjectType": commentObjectType,
"title": title,
"navActive": "list",
"seoInfo": seo,
"playlet": playlet,
"chapter": chapter,
"chapterID": chapterID,
"episode": episode,
"canWatch": canWatch,
"mainURL": mainURL,
"previewURL": previewURL,
"hasPreview": previewURL != "",
"nextChapterID": playletser.NextChapterID(playlet, chapterID),
"advitise": playlet.Advitise,
"related": playlet.RelatedRecommendData,
"guessLike": guessLike.List,
"guessPage": guessLike.PageNum,
"guessPageSize": guessLike.PageSize,
"guessTotal": guessLike.TotalCount,
"hotList": hotList,
"hotMoreURL": playletser.AllListURL("all", 0, 0, 2, 1),
"playResponse": gin.H{
"playlet": playlet,
"chapter": chapter,
"chapterID": chapterID,
"canWatch": canWatch,
"mainURL": mainURL,
"previewURL": previewURL,
"hasPreview": previewURL != "",
"guessLike": guessLike,
"hotList": hotList,
"comments": comments,
"commentObjectID": commentObjectID,
"commentObjectType": commentObjectType,
"playlet": playlet,
"chapter": chapter,
"chapterID": chapterID,
"canWatch": canWatch,
"mainURL": mainURL,
"previewURL": previewURL,
"hasPreview": previewURL != "",
"guessLike": guessLike,
"hotList": hotList,
},
}
data["canonicalPath"] = playletser.PlayPath(playlet.Slug, playlet.ID)
@@ -192,27 +168,6 @@ func SeriesPlay(c *gin.Context) {
videoURL := strings.TrimSpace(video.Video.URL)
canWatch := videoURL != ""
commentObjectID := video.ID
// 视频评论:objectType=20(swagger:10-短剧 11-短剧剧集 20-视频)
commentObjectType := commentser.ObjectTypeVideo
comments := commentser.FetchListOrEmpty(c, commentser.ListQuery{
ObjectID: commentObjectID,
ObjectType: commentObjectType,
PageNum: 1,
PageSize: 4,
SortOrder: commentser.SortHot,
})
if comments.PageNum <= 0 {
comments.PageNum = 1
}
if comments.PageSize <= 0 {
comments.PageSize = 4
}
commentTotal := comments.TotalCount
if commentTotal <= 0 && video.CountComment > 0 {
commentTotal = video.CountComment
}
hot := playletser.FetchAllListOrEmpty(c, playletser.AllListQuery{
PageNum: 1,
PageSize: 8,
@@ -245,51 +200,30 @@ func SeriesPlay(c *gin.Context) {
}
data := gin.H{
"title": title,
"navActive": "aiSeries",
"seoInfo": video.SeoInfo,
"video": video,
"videoID": video.ID,
"videoSlug": video.Slug,
"cover": cover,
"videoURL": videoURL,
"canWatch": canWatch,
"guessLike": guessLike.List,
"guessPage": guessLike.PageNum,
"guessPageSize": guessLike.PageSize,
"guessTotal": guessLike.TotalCount,
"guessPlayletID": guessPlayletID,
"advitise": video.Advitise,
"comments": comments.List,
"commentTotal": commentTotal,
"commentPage": comments.PageNum,
"commentSize": comments.PageSize,
"commentObjectID": commentObjectID,
"commentObjectType": commentObjectType,
"hotList": hotList,
"hotMoreURL": playletser.AllListURL("all", 0, 0, 2, 1),
"title": title,
"navActive": "aiSeries",
"seoInfo": video.SeoInfo,
"video": video,
"videoID": video.ID,
"videoSlug": video.Slug,
"cover": cover,
"videoURL": videoURL,
"canWatch": canWatch,
"guessLike": guessLike.List,
"guessPage": guessLike.PageNum,
"guessPageSize": guessLike.PageSize,
"guessTotal": guessLike.TotalCount,
"guessPlayletID": guessPlayletID,
"advitise": video.Advitise,
"hotList": hotList,
"hotMoreURL": playletser.AllListURL("all", 0, 0, 2, 1),
"videoResponse": gin.H{
"video": video,
"videoURL": videoURL,
"canWatch": canWatch,
"comments": comments,
"hotList": hotList,
"guessLike": guessLike,
"guessPlayletID": guessPlayletID,
"commentObjectID": commentObjectID,
"commentObjectType": commentObjectType,
},
"commentDebug": gin.H{
"path": "/api/app/comment/list",
"objectId": commentObjectID,
"objectType": commentObjectType, // 20-视频
"pageNum": comments.PageNum,
"pageSize": comments.PageSize,
"totalCount": commentTotal,
"list": comments.List,
"apis": []string{
"GET /api/app/comment/list",
},
"video": video,
"videoURL": videoURL,
"canWatch": canWatch,
"hotList": hotList,
"guessLike": guessLike,
"guessPlayletID": guessPlayletID,
},
"playDebug": gin.H{
"canWatch": canWatch,