package web import ( "fmt" "videoweb/app/service/playletser" "videoweb/app/service/videoser" "github.com/gin-gonic/gin" ) // Series 剧集列表页:GET /api/app/video/all/list + topic/list。 // 文档:http://172.104.181.99:25319/swagger/index.html#/视频相关接口/get_api_app_video_all_list func Series(c *gin.Context) { q := videoser.ParseSeriesListQuery(c) topics := videoser.FetchVideoTopicListOrEmpty(c, q.MediaType) topicResolved := seriesTopicResolved(q, topics) raw := videoser.FetchVideoAllListOrEmpty(c, q) pageHeading, seoSelections := seriesSEOContext(q, topics) title := pageHeading + " - 黄果短剧" if raw != nil && raw.SeoInfo.Title != "" { title = raw.SeoInfo.Title } list := []videoser.VideoAllListItemResp(nil) total := int64(0) pageNum, pageSize := q.PageNum, q.PageSize var seo videoser.SeoInfo var advitise any if raw != nil { list = raw.List total = raw.TotalCount seo = raw.SeoInfo advitise = raw.Advitise if raw.PageNum > 0 { pageNum = raw.PageNum } if raw.PageSize > 0 { pageSize = raw.PageSize } } HTMLOK(c, "series.html", gin.H{ "title": title, "navActive": "series", "seoInfo": seo, "seoSelections": seoSelections, "pageHeading": pageHeading, "mediaType": q.MediaType, "topicId": q.TopicID, "sortType": q.SortType, "seoEntityValid": topicResolved || total > 0, "topicList": topics, "list": list, "totalCount": total, "pageNum": pageNum, "pageSize": pageSize, "listCount": fmt.Sprintf("共 %d 部", total), "advitise": advitise, "pagination": videoser.BuildSeriesListPagination(q, total), "canonicalPath": q.URL(), }) } func seriesTopicResolved(q videoser.SeriesListQuery, topics []videoser.VideoTopicInfo) bool { if q.TopicID <= 0 { return true } for _, topic := range topics { if topic.ID == q.TopicID { return true } } return false } func seriesSEOContext(q videoser.SeriesListQuery, topics []videoser.VideoTopicInfo) (string, []playletser.SEOSelection) { heading := "剧集与动画" selections := make([]playletser.SEOSelection, 0, 3) if q.MediaType == videoser.MediaFilm || q.MediaType == videoser.MediaAnime { mediaName := videoser.MediaTypeLabel(q.MediaType) heading = mediaName selections = append(selections, playletser.SEOSelection{Dimension: "类型", Value: mediaName}) } if q.TopicID > 0 { for _, topic := range topics { if topic.ID == q.TopicID { name := topic.DisplayName() if name != "" { heading = name + heading selections = append(selections, playletser.SEOSelection{Dimension: "题材", Value: name}) } break } } } if q.SortType == videoser.SortHeat { selections = append(selections, playletser.SEOSelection{Dimension: "排序", Value: "最热"}) } else if q.SortType == videoser.SortCollect { selections = append(selections, playletser.SEOSelection{Dimension: "排序", Value: "收藏最多"}) } return heading, selections }