@@ -0,0 +1,64 @@
|
||||
package annouctrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/annouser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/v/annoumod"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// GetAnnou doc
|
||||
// @Summary 获取公告
|
||||
// @Description 获取公告
|
||||
// @Tags annou
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param pageNumber formData integer true "查询页码"
|
||||
// @Param pageSize formData integer true "页码大小"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/app/annou/list [get]
|
||||
func GetAnnou(ctx *gin.Context) {
|
||||
if _, err := common.GetUID(ctx); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNoToken, nil)
|
||||
return
|
||||
}
|
||||
req := annoumod.PopReq{}
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
info, _ := annouser.GetAnnouList(req.Type)
|
||||
infos := []*annouser.Annou{info}
|
||||
common.ServeJSON(ctx, stderr.Success, infos)
|
||||
}
|
||||
|
||||
// GetAnnous doc
|
||||
// @Summary 获取公告列表
|
||||
// @Description 获取消息模块公告列表
|
||||
// @Tags annou
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param pageNumber formData integer true "查询页码"
|
||||
// @Param pageSize formData integer true "页码大小"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/app/annou/msg/list [get]
|
||||
func GetAnnous(ctx *gin.Context) {
|
||||
_, err := common.GetUID(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNoToken, nil)
|
||||
return
|
||||
}
|
||||
req := annoumod.MsgListReq{}
|
||||
err1 := ctx.ShouldBind(&req)
|
||||
if err1 != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
info, err := annouser.MsgAnnouList(req)
|
||||
common.ServeJSON(ctx, stderr.Success, info)
|
||||
}
|
||||
Reference in New Issue
Block a user