Initial commit
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"videoweb/app/service/playletser"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// List 短剧列表页 SSR:GET /api/app/playlet/operate/list,operateType 固定为 1。
|
||||
func List(c *gin.Context) {
|
||||
slug := strings.TrimSpace(c.Param("slug"))
|
||||
if slug == "ai-series" {
|
||||
legacy := playletser.ParseListQuery(
|
||||
routeOrQuery(c, "page", "page"),
|
||||
routeOrQuery(c, "sortOrder", "sortOrder"),
|
||||
c.Query("type"),
|
||||
)
|
||||
redirectCanonical(c, playletser.SeriesPathFromLegacyList(legacy.SortOrder, legacy.PageNum))
|
||||
return
|
||||
}
|
||||
filter := routeOrQuery(c, "sortOrder", "filterType")
|
||||
if filter == "" {
|
||||
filter = strings.TrimSpace(c.Query("sortOrder"))
|
||||
}
|
||||
q, ok := playletser.ParseShortPlayQuery(filter, routeOrQuery(c, "page", "page"))
|
||||
if !ok {
|
||||
NotFound(c, "页面不存在")
|
||||
return
|
||||
}
|
||||
if redirectCanonical(c, playletser.ShortPlayCanonicalPath(q)) {
|
||||
return
|
||||
}
|
||||
raw := playletser.FetchOperateListOrEmpty(c, q)
|
||||
if playletser.PageOutOfRange(q.PageNum, q.PageSize, raw.TotalCount) {
|
||||
NotFound(c, "页面不存在")
|
||||
return
|
||||
}
|
||||
sectionTitle := playletser.ShortPlaySectionTitle(q.FilterType)
|
||||
data := gin.H{
|
||||
"title": "短剧",
|
||||
"description": "浏览黄果短剧全部短剧列表,按分类、标签筛选海量高清短剧,发现更多精彩剧集。",
|
||||
"pageKey": "list",
|
||||
"pageName": "AI成人短剧",
|
||||
"pagePath": playletser.ShortPlayCanonicalPath(q),
|
||||
"navActive": "list",
|
||||
"seoInfo": playletser.SeoInfo{},
|
||||
"seoSelections": []playletser.SEOSelection{{Dimension: "筛选", Value: strings.TrimSuffix(sectionTitle, "的AI成人短剧")}},
|
||||
"filters": playletser.BuildShortPlayFilterTabs(q),
|
||||
"sectionTitle": sectionTitle,
|
||||
"list": raw.List,
|
||||
"itemListOffset": (q.PageNum - 1) * q.PageSize,
|
||||
"pagination": playletser.BuildShortPlayPagination(q, raw.TotalCount),
|
||||
}
|
||||
// /list/ai-short-play/original/ 入口页始终可索引;其余空结果仍 noindex。
|
||||
isOriginalEntry := q.FilterType == 3 && q.PageNum <= 1
|
||||
if !isOriginalEntry && (raw.TotalCount <= 0 || len(raw.List) == 0) {
|
||||
setNoIndex(data, true)
|
||||
}
|
||||
HTMLOK(c, "list.html", data)
|
||||
}
|
||||
Reference in New Issue
Block a user