84 lines
2.4 KiB
Go
84 lines
2.4 KiB
Go
package laosijictrl
|
|
|
|
import (
|
|
"91porn-server/common"
|
|
"91porn-server/common/laosiji"
|
|
"91porn-server/common/stderr"
|
|
"91porn-server/web/service/laosijiser"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// @Tags 老司机
|
|
// @Summary 查询帖子列表
|
|
// @Description 查询帖子列表
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body laosiji.PostSearchListReq true "参数列表"
|
|
// @Success 200 {object} laosiji.PostSearchListResp "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Router /api/web/admin/laosiji/post/search [POST]
|
|
func PostSearch(ctx *gin.Context) {
|
|
param := laosiji.PostSearchListReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
resp, err := laosijiser.PostSearch(ctx, param)
|
|
if err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrInterServerError, "")
|
|
return
|
|
}
|
|
common.ServeJSON(ctx, stderr.Success, resp)
|
|
}
|
|
|
|
// @Tags 老司机
|
|
// @Summary 查询帖子详情
|
|
// @Description 查询帖子详情
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body laosiji.PostDetailReq true "参数列表"
|
|
// @Success 200 {object} laosiji.PostDetailResp "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Router /api/web/admin/laosiji/post/detail [POST]
|
|
func PostDetail(ctx *gin.Context) {
|
|
param := laosiji.PostDetailReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
resp, err := laosijiser.PostDetail(ctx, param)
|
|
if err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrInterServerError, err.Error())
|
|
return
|
|
}
|
|
common.ServeJSON(ctx, stderr.Success, resp)
|
|
}
|
|
|
|
// @Tags 老司机
|
|
// @Summary 添加帖子到本地
|
|
// @Description 添加帖子到本地
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body laosiji.PostAddListReq true "参数列表"
|
|
// @Success 200 {string} string "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Router /api/web/admin/laosiji/post/add [POST]
|
|
func PostAdd(ctx *gin.Context) {
|
|
param := laosiji.PostAddListReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
manager, err := common.GetAdminAct(ctx)
|
|
if err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
hits, err := laosijiser.PostAddList(ctx, param, manager)
|
|
if err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrInterServerError, err.Error())
|
|
return
|
|
}
|
|
common.ServeJSON(ctx, stderr.Success, buildAddResp(hits))
|
|
}
|