@@ -0,0 +1,157 @@
|
||||
package hotspotctr
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/rankser"
|
||||
"91porn-server/app/service/search"
|
||||
"91porn-server/app/service/searcher"
|
||||
"91porn-server/app/service/searcher/tonesearcher"
|
||||
"91porn-server/app/service/searcher/vidhotsearcher"
|
||||
"91porn-server/app/service/tagser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/commod"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// HotTag
|
||||
// @Summary 获取用户喜欢标签及标签下对应的视频列表(默认3个视频)
|
||||
// @Description 热点,获取用户喜欢标签及标签下对应的视频列表(默认3个视频)
|
||||
// @Tags 热点
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param pageNumber formData integer true "页数"
|
||||
// @Param pageSize formData integer true "每页条数"
|
||||
// @Success 200 {object} tagser.TagGroupResp "成功"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/app/hotspot/htag [get]
|
||||
func HotTag(ctx *gin.Context) {
|
||||
var arg struct {
|
||||
commod.Page
|
||||
}
|
||||
if err := ctx.ShouldBind(&arg); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, "hotspotctr HotTag arg error "+err.Error())
|
||||
return
|
||||
}
|
||||
uid, err := common.GetUID(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNoToken, err)
|
||||
return
|
||||
}
|
||||
param := commod.Page{}
|
||||
if err := ctx.ShouldBind(¶m); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err)
|
||||
return
|
||||
}
|
||||
resp := tagser.GetTagsList(uid, param)
|
||||
common.ServeJSON(ctx, stderr.Success, resp)
|
||||
}
|
||||
|
||||
// Rank doc
|
||||
// @Summary 热点 - rank
|
||||
// @Description 获取排行和音色热点
|
||||
// @Tags 热点
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Success 200 {string} json "{"msg": "操作成功" "data":{}}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败" "data":{}}"
|
||||
// @Router /api/app/hotspot/rank [get]
|
||||
func Rank(ctx *gin.Context) {
|
||||
rankMap, err := rankser.GetRankMap()
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err)
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, rankMap)
|
||||
}
|
||||
|
||||
// Tone doc
|
||||
// @Summary 热点 - tone
|
||||
// @Description 获取排行和音色热点
|
||||
// @Tags 热点
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Success 200 {string} json "{"msg": "操作成功" "data":{}}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败" "data":{}}"
|
||||
// @Router /api/app/hotspot/area [get]
|
||||
func Area(ctx *gin.Context) {
|
||||
res, err := tonesearcher.NewToneSearcher().Search(nil, nil)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNetWorkBusy, err)
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{
|
||||
"list": res.Data(),
|
||||
"hasNext": res.HasNext(),
|
||||
})
|
||||
}
|
||||
|
||||
// WonderTagList doc
|
||||
// @Summary 热点 - 发现精彩
|
||||
// @Description 获取发现精彩标签列表
|
||||
// @Tags 热点
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param pageNumber query integer true "页码"
|
||||
// @Param pageSize query integer true "每页条数"
|
||||
// @Success 200 {string} json "{"msg": "操作成功", "data":[]}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/app/hotspot/wonder/list [get]
|
||||
func WonderTagList(ctx *gin.Context) {
|
||||
var arg struct {
|
||||
commod.Page
|
||||
}
|
||||
if err := ctx.ShouldBind(&arg); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, "hotspotctr WonderTagList arg error "+err.Error())
|
||||
return
|
||||
}
|
||||
skip := int64((arg.PageNumber - 1) * arg.PageSize)
|
||||
limit := int64(arg.PageSize)
|
||||
tags, hasNext, err := search.GetWonderTagList(skip, limit)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNetWorkBusy, "hotspotctr WonderTags error: "+err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{
|
||||
"list": tags,
|
||||
"hasNext": hasNext,
|
||||
})
|
||||
}
|
||||
|
||||
// HotVidList doc
|
||||
// @Summary 热点 - 今日最热视屏
|
||||
// @Description 今日最热视屏
|
||||
// @Tags 热点
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param pageNumber query integer true "页码"
|
||||
// @Param pageSize query integer true "每页条数"
|
||||
// @Success 200 {string} json "{"msg": "操作成功", "data":{}}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/app/hotspot/hotvid/list [get]
|
||||
func HotVidList(ctx *gin.Context) {
|
||||
var arg struct {
|
||||
commod.Page
|
||||
}
|
||||
if err := ctx.ShouldBind(&arg); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, "hotspotctr HotVidList arg error "+err.Error())
|
||||
return
|
||||
}
|
||||
uid, err := common.GetUID(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNoToken, err)
|
||||
return
|
||||
}
|
||||
opt := (&searcher.Option{}).
|
||||
SetSkip(int64((arg.PageNumber - 1) * arg.PageSize)).
|
||||
SetLimit(int64(arg.PageSize)) //最热视屏
|
||||
res, err := vidhotsearcher.NewVidHotSearcher(uid).Search(nil, opt)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err)
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{
|
||||
"list": res.Data(),
|
||||
"hasNext": res.HasNext(),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user