书籍列表接口新增参数

This commit is contained in:
2025-08-13 15:19:42 +08:00
parent 6ccc87f2bf
commit 8afe651c64
201 changed files with 6987 additions and 1066 deletions

View File

@ -17,10 +17,13 @@ type IBookV1 interface {
Del(ctx context.Context, req *v1.DelReq) (res *v1.DelRes, err error)
ShelfAdd(ctx context.Context, req *v1.ShelfAddReq) (res *v1.ShelfAddRes, err error)
ShelfRemove(ctx context.Context, req *v1.ShelfRemoveReq) (res *v1.ShelfRemoveRes, err error)
HistoryRemove(ctx context.Context, req *v1.HistoryRemoveReq) (res *v1.HistoryRemoveRes, err error)
AppList(ctx context.Context, req *v1.AppListReq) (res *v1.AppListRes, err error)
AppDetail(ctx context.Context, req *v1.AppDetailReq) (res *v1.AppDetailRes, err error)
AppRate(ctx context.Context, req *v1.AppRateReq) (res *v1.AppRateRes, err error)
MyList(ctx context.Context, req *v1.MyListReq) (res *v1.MyListRes, err error)
BookSetFeatured(ctx context.Context, req *v1.BookSetFeaturedReq) (res *v1.BookSetFeaturedRes, err error)
BookSetRecommended(ctx context.Context, req *v1.BookSetRecommendedReq) (res *v1.BookSetRecommendedRes, err error)
BookSetHot(ctx context.Context, req *v1.BookSetHotReq) (res *v1.BookSetHotRes, err error)
BookCoverImage(ctx context.Context, req *v1.BookCoverImageReq) (res *v1.BookCoverImageRes, err error)
}

View File

@ -3,11 +3,13 @@ package v1
import (
"server/internal/model"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/frame/g"
)
type ListReq struct {
g.Meta `path:"/book" tags:"Backend/Author" method:"get" summary:"获取小说列表"`
g.Meta `path:"/book" tags:"Backend/Book" method:"get" summary:"获取小说列表"`
Page int `json:"page" dc:"页码"`
Size int `json:"size" dc:"每页数量"`
Title string `json:"title" dc:"书名模糊搜索"`
@ -23,7 +25,7 @@ type ListRes struct {
}
type AddReq struct {
g.Meta `path:"/book" tags:"Backend/Author" method:"post" summary:"新增小说"`
g.Meta `path:"/book" tags:"Backend/Book" method:"post" summary:"新增小说"`
AuthorId int64 `json:"authorId" dc:"作者ID" v:"required"`
CategoryId int64 `json:"categoryId" dc:"分类ID" v:"required"`
Title string `json:"title" dc:"书名" v:"required"`
@ -40,7 +42,7 @@ type AddRes struct {
}
type EditReq struct {
g.Meta `path:"/book" tags:"Backend/Author" method:"put" summary:"编辑小说"`
g.Meta `path:"/book" tags:"Backend/Book" method:"put" summary:"编辑小说"`
Id int64 `json:"id" dc:"书籍ID" v:"required"`
AuthorId int64 `json:"authorId" dc:"作者ID" v:"required"`
CategoryId int64 `json:"categoryId" dc:"分类ID" v:"required"`
@ -58,7 +60,7 @@ type EditRes struct {
}
type DelReq struct {
g.Meta `path:"/book" tags:"Backend/Author" method:"delete" summary:"删除小说"`
g.Meta `path:"/book" tags:"Backend/Book" method:"delete" summary:"删除小说"`
Id int64 `json:"id" dc:"书籍ID" v:"required"`
}
type DelRes struct {
@ -67,7 +69,7 @@ type DelRes struct {
// 加入书架
type ShelfAddReq struct {
g.Meta `path:"/book/shelf/add" tags:"APP" method:"post" summary:"加入书架"`
g.Meta `path:"/book/shelf/add" tags:"APP/Book" method:"post" summary:"加入书架"`
BookId int64 `json:"bookId" dc:"小说ID" v:"required"`
}
type ShelfAddRes struct {
@ -76,21 +78,30 @@ type ShelfAddRes struct {
// 移除书架
type ShelfRemoveReq struct {
g.Meta `path:"/book/shelf/remove" tags:"APP" method:"post" summary:"移除书架(支持批量)"`
g.Meta `path:"/book/shelf/remove" tags:"APP/Book" method:"post" summary:"移除书架(支持批量)"`
BookIds []int64 `json:"bookIds" dc:"小说ID列表" v:"required"`
}
type ShelfRemoveRes struct {
Success bool `json:"success" dc:"是否成功"`
}
type HistoryRemoveReq struct {
g.Meta `path:"/book/history/remove" tags:"APP/Book" method:"post" summary:"移除阅读记录(支持批量)"`
BookIds []int64 `json:"bookIds" dc:"小说ID列表" v:"required"`
}
type HistoryRemoveRes struct {
Success bool `json:"success" dc:"是否成功"`
}
// App 获取书籍列表
type AppListReq struct {
g.Meta `path:"/book/app/list" tags:"APP" method:"get" summary:"App获取书籍列表"`
g.Meta `path:"/book/app/list" tags:"APP/Book" method:"get" summary:"App获取书籍列表"`
Page int `json:"page" dc:"页码"`
Size int `json:"size" dc:"每页数量"`
IsRecommended bool `json:"isRecommended" dc:"是否推荐"`
IsFeatured bool `json:"isFeatured" dc:"是否精选"`
IsLatest int `json:"isLatest" dc:"是否最新"`
IsHot bool `json:"isHot" dc:"是否最热"`
CategoryId int64 `json:"categoryId" dc:"分类ID"`
Title string `json:"title" dc:"书名模糊搜索"`
AuthorId int `json:"authorId" dc:"作者ID"`
@ -104,34 +115,42 @@ type AppListRes struct {
// App 获取书籍详情
type AppDetailReq struct {
g.Meta `path:"/book/app/detail" tags:"APP" method:"get" summary:"App获取书籍详情"`
g.Meta `path:"/book/app/detail" tags:"APP/Book" method:"get" summary:"App获取书籍详情"`
Id int64 `json:"id" dc:"书籍ID" v:"required"`
}
type AppDetailRes struct {
Id int64 `json:"id" dc:"书籍ID"`
AuthorId int64 `json:"authorId" dc:"作者ID"`
CategoryId int64 `json:"categoryId" dc:"分类ID"`
Title string `json:"title" dc:"书名"`
CoverUrl string `json:"coverUrl" dc:"封面图"`
Description string `json:"description" dc:"简介"`
Status int `json:"status" dc:"状态"`
Tags string `json:"tags" dc:"标签"`
IsRecommended int `json:"isRecommended" dc:"是否推荐"`
IsFeatured int `json:"isFeatured" dc:"是否精选"`
Language string `json:"language" dc:"语言"`
Rating float64 `json:"rating" dc:"评分"`
CurrentReaders int64 `json:"currentReaders" dc:"在读人数"`
CreatedAt string `json:"createdAt" dc:"创建时间"`
UpdatedAt string `json:"updatedAt" dc:"更新时间"`
HasRead bool `json:"hasRead" dc:"是否读过"`
ReadProgress int `json:"readProgress" dc:"阅读进度百分比"`
LastChapterId int64 `json:"lastChapterId" dc:"最近阅读章节ID"`
LastReadAt string `json:"lastReadAt" dc:"最近阅读时间"`
Id int64 `json:"id" dc:"书籍ID"`
CoverUrl string `json:"coverUrl" dc:"封面图"`
Rating float64 `json:"rating" dc:"分"`
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"简介"`
AuthorId int64 `json:"authorId" dc:"作者ID"`
Author model.AppAuthor `json:"author" dc:"作者信息"`
IsFeatured int `json:"isFeatured" dc:"是否精选"`
Language string `json:"language" dc:"语言"`
CategoryId int64 `json:"categoryId" dc:"分类ID"`
Category model.Category `json:"category" dc:"分类信息"`
Status int `json:"status" dc:"状态"`
WordsCount int `json:"wordsCount" dc:"数"`
ChaptersCount int `json:"chaptersCount" dc:"章节数"`
ReadCount int64 `json:"readCount" dc:"阅读人数"`
CurrentReaders int64 `json:"currentReaders" dc:"在读人数"`
Tags string `json:"tags" dc:"标签"`
IsRecommended int `json:"isRecommended" dc:"是否推荐"`
HasRated bool `json:"hasRated" dc:"当前用户是否已评分"`
MyRating float64 `json:"myRating" dc:"当前用户评分未评分为0"`
HasRead bool `json:"hasRead" dc:"是否读过"`
ReadProgress int `json:"readProgress" dc:"阅读进度百分比"`
LastChapterId int64 `json:"lastChapterId" dc:"最近阅读章节ID"`
LastReadAt string `json:"lastReadAt" dc:"最近阅读时间"`
IsInBookshelf bool `json:"isInBookshelf" dc:"当前用户是否已加入书架"`
CreatedAt string `json:"createdAt" dc:"创建时间"`
UpdatedAt string `json:"updatedAt" dc:"更新时间"`
}
// App 用户评分
type AppRateReq struct {
g.Meta `path:"/book/app/rate" tags:"APP" method:"post" summary:"App用户评分"`
g.Meta `path:"/book/app/rate" tags:"APP/Book" method:"post" summary:"App用户评分"`
BookId int64 `json:"bookId" dc:"书籍ID" v:"required"`
Rating float64 `json:"rating" dc:"评分(1-10分)" v:"required"`
}
@ -152,7 +171,7 @@ type BookAppItem struct {
// 我的书籍列表
// =============================
type MyListReq struct {
g.Meta `path:"/book/app/my-books" tags:"APP" method:"get" summary:"获取我的书籍列表"`
g.Meta `path:"/book/app/my-books" tags:"APP/Book" method:"get" summary:"获取我的书籍列表"`
Type int `json:"type" dc:"类型1-正在读 2-已读完 3-历史记录" v:"required"`
Page int `json:"page" dc:"页码"`
Size int `json:"size" dc:"每页数量"`
@ -183,3 +202,20 @@ type BookSetRecommendedReq struct {
type BookSetRecommendedRes struct {
Success bool `json:"success" dc:"是否成功"`
}
type BookSetHotReq struct {
g.Meta `path:"/book/set-hot" tags:"Backend/Book" method:"post" summary:"设置书籍热门状态"`
Id int64 `json:"id" dc:"书籍ID" v:"required"`
IsHot int `json:"isHot" dc:"是否热门" v:"required"`
}
type BookSetHotRes struct {
Success bool `json:"success" dc:"是否成功"`
}
type BookCoverImageReq struct {
g.Meta `path:"/book/coverImage" tags:"Backend/Book" method:"post" summary:"上传封面图"`
File *ghttp.UploadFile `json:"file" v:"required#请上传文件"`
}
type BookCoverImageRes struct {
ImageUrl string `json:"imageUrl" dc:"图片地址"`
}