package playletser import ( "fmt" "videoweb/app/service/upstream" "github.com/gin-gonic/gin" ) const hotLikePath = "/api/app/playlet/hot-like" // PlayletHotSearchItem 对应 swagger proto.PlayletHotSearchItem。 type PlayletHotSearchItem struct { Keyword string `json:"keyword"` Count int64 `json:"count"` } // PlayletHotLikeResp 对应 swagger proto.PlayletHotLikeResp。 type PlayletHotLikeResp struct { HotSearch []PlayletHotSearchItem `json:"hotSearch"` GuessLike []CommonData `json:"guessLike"` } // FetchHotLike 获取前 10 个热搜词及按收藏量排序的 15 部猜你喜欢短剧。 func FetchHotLike(c *gin.Context) (*PlayletHotLikeResp, error) { var env APIEnvelope[PlayletHotLikeResp] if err := upstream.GetPublicJSON(c, hotLikePath, &env); err != nil { return nil, err } if env.Code != 200 { return nil, fmt.Errorf("playlet hot-like code=%d msg=%s tip=%s", env.Code, env.Msg, env.Tip) } return &env.Data, nil }