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.NovelSearchListReq true "参数列表"
|
|
// @Success 200 {object} laosiji.NovelSearchListResp "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Router /api/web/admin/laosiji/novel/search [POST]
|
|
func NovelSearch(ctx *gin.Context) {
|
|
param := laosiji.NovelSearchListReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
resp, err := laosijiser.NovelSearch(ctx, param)
|
|
if err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
common.ServeJSON(ctx, stderr.Success, resp)
|
|
}
|
|
|
|
// @Tags 老司机
|
|
// @Summary 查询小说详情
|
|
// @Description 查询小说详情
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body laosiji.NovelDetailReq true "参数列表"
|
|
// @Success 200 {object} laosiji.NovelDetailResp "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Router /api/web/admin/laosiji/novel/detail [POST]
|
|
func NovelDetail(ctx *gin.Context) {
|
|
param := laosiji.NovelDetailReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
resp, err := laosijiser.NovelDetail(ctx, param)
|
|
if err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
common.ServeJSON(ctx, stderr.Success, resp)
|
|
}
|
|
|
|
// @Tags 老司机
|
|
// @Summary 添加小说到本地
|
|
// @Description 添加小说到本地
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body laosiji.NovelAddListReq true "参数列表"
|
|
// @Success 200 {string} string "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Router /api/web/admin/laosiji/novel/add [POST]
|
|
func NovelAdd(ctx *gin.Context) {
|
|
param := laosiji.NovelAddListReq{}
|
|
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
|
|
}
|
|
err = laosijiser.NovelAddList(ctx, param, manager)
|
|
if err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
common.ServeJSON(ctx, stderr.Success, nil)
|
|
}
|