@@ -0,0 +1,50 @@
|
||||
package tonectrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/searcher"
|
||||
"91porn-server/app/service/searcher/vidtonesearcher"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/commod"
|
||||
"91porn-server/models/v/tonerecomod"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// VidList doc
|
||||
// @Summary 获取音色最热视屏列表
|
||||
// @Description 获取音色最热视屏列表
|
||||
// @Tags Tone
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param theme formData string true "主题""
|
||||
// @Param pageNumber formData int true "当前页"
|
||||
// @Param pageSize formData int true "每页条数"
|
||||
// @Success 200 {string} json "{"msg": "操作成功", "data": vidtonesearcher.Result}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /tone/vid/list [post]
|
||||
func VidList(c *gin.Context) {
|
||||
var arg struct {
|
||||
Theme tonerecomod.ThemeType `form:"theme" json:"theme" binding:"required"`
|
||||
commod.Page
|
||||
}
|
||||
if err := c.ShouldBind(&arg); err != nil {
|
||||
common.ServeJSON(c, stderr.ErrParamError, "theme VidList arg error "+err.Error())
|
||||
return
|
||||
}
|
||||
uid, err := common.GetUID(c)
|
||||
if err != nil {
|
||||
common.ServeJSON(c, stderr.ErrAccessForbid, "theme VidList USER_ID is not exist ")
|
||||
return
|
||||
}
|
||||
headOpt := &searcher.Option{}
|
||||
headOpt.SetSkip(int64((arg.PageNumber - 1) * (arg.PageSize)))
|
||||
headOpt.SetLimit(int64(arg.PageSize))
|
||||
vidToneSearcher := vidtonesearcher.NewVidToneSearcher(arg.Theme, uid)
|
||||
result, err := vidToneSearcher.Search(nil, headOpt)
|
||||
if err != nil {
|
||||
common.ServeJSON(c, stderr.ErrNetWorkBusy, err)
|
||||
return
|
||||
}
|
||||
common.ServeJSON(c, stderr.Success, result.Data())
|
||||
}
|
||||
Reference in New Issue
Block a user