Files
web_hgtv_h5/app/api/web/detail.go
T
谢宇宁andClaude Opus 5.5 3639d2184a Initial commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 14:47:17 +07:00

33 lines
791 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package web
import (
"strings"
"videoweb/app/service/playletser"
"github.com/gin-gonic/gin"
)
// Detail 详情页 SSR:GET /api/app/playlet/detail;seoInfo 直接注入模板。
func Detail(c *gin.Context) {
key := strings.TrimSpace(c.Param("slug"))
if key == "" {
NotFound(c, "未找到该短剧")
return
}
raw := playletser.FetchDetailOrNilByKey(c, key)
if raw == nil {
NotFound(c, "未找到该短剧")
return
}
// 有 slug 使用 slug,否则保留 ID 路由。
if redirectCanonical(c, playletser.DetailPath(raw.Slug, raw.ID)) {
return
}
HTMLOK(c, "detail.html", gin.H{
"title": raw.Title,
"detail": raw,
"seoInfo": raw.SeoInfo,
"episodeRanges": playletser.BuildEpisodeRanges(raw.PlayletChapterInfo, raw.TotalEpisode, 30),
})
}