You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
770 B

package topic
import (
"github.com/gin-gonic/gin"
"live/app/lib"
"live/app/lib/back"
"live/app/lib/tools"
"live/app/logic/topic"
)
type Topic struct {
}
type argsTopicList struct {
Keyword string `json:"keyword" form:"keyword"`
lib.Page
}
// @Title 话题列表
func (t *Topic) List(c *gin.Context) {
args := argsTopicList{}
if err := tools.ParseParams(&args, c); err != nil {
back.Fail(c, err.Error())
return
}
if args.Keyword == "" {
back.Fail(c, "参数不全")
return
}
list, count := (&topic.Topic{}).List(args.Keyword, args.Page)
back.Suc(c, "操作成功", gin.H{
"list": list,
"total": count,
})
}
// @Title 话题列表
func (t *Topic) Hot(c *gin.Context) {
list := (&topic.Topic{}).Hot()
back.Suc(c, "操作成功", list)
}