Files
谢宇宁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

46 lines
1.0 KiB
Go

package web
import (
"net/http"
"strconv"
"strings"
"videoweb/app/service/playletser"
"videoweb/pub/common/log"
"github.com/gin-gonic/gin"
)
// ChapterDetail 代理上游 GET /api/app/playlet/chapter/detail(播放页 CSR 切集)。
func ChapterDetail(c *gin.Context) {
chapterID, _ := strconv.ParseInt(c.Query("chapterId"), 10, 64)
playletID, _ := strconv.ParseInt(c.Query("playletId"), 10, 64)
playletSlug := strings.TrimSpace(c.Query("playletSlug"))
if chapterID <= 0 {
c.JSON(http.StatusOK, gin.H{
"code": 1001,
"msg": "参数错误",
"tip": "缺少 chapterId",
"data": nil,
})
return
}
data, err := playletser.FetchChapterDetail(c, chapterID, playletID, playletSlug)
if err != nil {
log.Error("chapter detail upstream failed", log.E(err))
c.JSON(http.StatusOK, gin.H{
"code": 500,
"msg": "chapter detail failed",
"tip": "获取剧集失败,请稍后重试",
"data": nil,
})
return
}
c.JSON(http.StatusOK, gin.H{
"code": 200,
"msg": "success",
"tip": "成功",
"data": data,
})
}