完善功能
This commit is contained in:
@ -11,8 +11,16 @@ import (
|
||||
)
|
||||
|
||||
type IBookV1 interface {
|
||||
BookList(ctx context.Context, req *v1.BookListReq) (res *v1.BookListRes, err error)
|
||||
BookAdd(ctx context.Context, req *v1.BookAddReq) (res *v1.BookAddRes, err error)
|
||||
BookEdit(ctx context.Context, req *v1.BookEditReq) (res *v1.BookEditRes, err error)
|
||||
BookDel(ctx context.Context, req *v1.BookDelReq) (res *v1.BookDelRes, err error)
|
||||
List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error)
|
||||
Add(ctx context.Context, req *v1.AddReq) (res *v1.AddRes, err error)
|
||||
Edit(ctx context.Context, req *v1.EditReq) (res *v1.EditRes, err error)
|
||||
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)
|
||||
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)
|
||||
}
|
||||
|
||||
@ -6,56 +6,180 @@ import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type BookListReq struct {
|
||||
g.Meta `path:"/book" tags:"Book" method:"get" summary:"获取小说列表"`
|
||||
Page int `json:"page"`
|
||||
Size int `json:"size"`
|
||||
Title string `json:"title"`
|
||||
CategoryId int64 `json:"categoryId"`
|
||||
AuthorId int64 `json:"authorId"`
|
||||
Status int `json:"status"`
|
||||
IsRecommended int `json:"isRecommended"`
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/book" tags:"Backend/Author" method:"get" summary:"获取小说列表"`
|
||||
Page int `json:"page" dc:"页码"`
|
||||
Size int `json:"size" dc:"每页数量"`
|
||||
Title string `json:"title" dc:"书名模糊搜索"`
|
||||
CategoryId int64 `json:"categoryId" dc:"分类ID"`
|
||||
AuthorId int64 `json:"authorId" dc:"作者ID"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
IsRecommended int `json:"isRecommended" dc:"是否推荐"`
|
||||
Sort string `json:"sort" dc:"排序字段"`
|
||||
}
|
||||
type BookListRes struct {
|
||||
Total int `json:"total"`
|
||||
List []model.Book `json:"list"`
|
||||
type ListRes struct {
|
||||
Total int `json:"total" dc:"总数"`
|
||||
List []model.Book `json:"list" dc:"书籍列表"`
|
||||
}
|
||||
|
||||
type BookAddReq struct {
|
||||
g.Meta `path:"/book" tags:"Book" method:"post" summary:"新增小说"`
|
||||
AuthorId int64 `json:"authorId"`
|
||||
CategoryId int64 `json:"categoryId"`
|
||||
Title string `json:"title"`
|
||||
CoverUrl string `json:"coverUrl"`
|
||||
Description string `json:"description"`
|
||||
Status int `json:"status"`
|
||||
Tags string `json:"tags"`
|
||||
IsRecommended int `json:"isRecommended"`
|
||||
type AddReq struct {
|
||||
g.Meta `path:"/book" tags:"Backend/Author" 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"`
|
||||
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:"语言"`
|
||||
}
|
||||
type BookAddRes struct {
|
||||
Success bool `json:"success"`
|
||||
type AddRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type BookEditReq struct {
|
||||
g.Meta `path:"/book" tags:"Book" method:"put" summary:"编辑小说"`
|
||||
Id int64 `json:"id"`
|
||||
AuthorId int64 `json:"authorId"`
|
||||
CategoryId int64 `json:"categoryId"`
|
||||
Title string `json:"title"`
|
||||
CoverUrl string `json:"coverUrl"`
|
||||
Description string `json:"description"`
|
||||
Status int `json:"status"`
|
||||
Tags string `json:"tags"`
|
||||
IsRecommended int `json:"isRecommended"`
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/book" tags:"Backend/Author" 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"`
|
||||
Title string `json:"title" dc:"书名" v:"required"`
|
||||
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:"语言"`
|
||||
}
|
||||
type BookEditRes struct {
|
||||
Success bool `json:"success"`
|
||||
type EditRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type BookDelReq struct {
|
||||
g.Meta `path:"/book" tags:"Book" method:"delete" summary:"删除小说"`
|
||||
Id int64 `json:"id"`
|
||||
type DelReq struct {
|
||||
g.Meta `path:"/book" tags:"Backend/Author" method:"delete" summary:"删除小说"`
|
||||
Id int64 `json:"id" dc:"书籍ID" v:"required"`
|
||||
}
|
||||
type BookDelRes struct {
|
||||
Success bool `json:"success"`
|
||||
type DelRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
// 加入书架
|
||||
type ShelfAddReq struct {
|
||||
g.Meta `path:"/book/shelf/add" tags:"APP" method:"post" summary:"加入书架"`
|
||||
BookId int64 `json:"bookId" dc:"小说ID" v:"required"`
|
||||
}
|
||||
type ShelfAddRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
// 移除书架
|
||||
type ShelfRemoveReq struct {
|
||||
g.Meta `path:"/book/shelf/remove" tags:"APP" method:"post" summary:"移除书架(支持批量)"`
|
||||
BookIds []int64 `json:"bookIds" dc:"小说ID列表" v:"required"`
|
||||
}
|
||||
type ShelfRemoveRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
// App 获取书籍列表
|
||||
type AppListReq struct {
|
||||
g.Meta `path:"/book/app/list" tags:"APP" 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:"是否最新"`
|
||||
CategoryId int64 `json:"categoryId" dc:"分类ID"`
|
||||
Title string `json:"title" dc:"书名模糊搜索"`
|
||||
AuthorId int `json:"authorId" dc:"作者ID"`
|
||||
Language string `json:"language" dc:"语言"`
|
||||
Sort string `json:"sort" dc:"排序字段"`
|
||||
}
|
||||
type AppListRes struct {
|
||||
Total int `json:"total" dc:"总数"`
|
||||
List []model.BookAppItem `json:"list" dc:"书籍列表"`
|
||||
}
|
||||
|
||||
// App 获取书籍详情
|
||||
type AppDetailReq struct {
|
||||
g.Meta `path:"/book/app/detail" tags:"APP" 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:"最近阅读时间"`
|
||||
}
|
||||
|
||||
// App 用户评分
|
||||
type AppRateReq struct {
|
||||
g.Meta `path:"/book/app/rate" tags:"APP" method:"post" summary:"App用户评分"`
|
||||
BookId int64 `json:"bookId" dc:"书籍ID" v:"required"`
|
||||
Rating float64 `json:"rating" dc:"评分(1-10分)" v:"required"`
|
||||
}
|
||||
type AppRateRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type BookAppItem struct {
|
||||
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:"简介"`
|
||||
HasRated bool `json:"hasRated" dc:"当前用户是否已评分"`
|
||||
MyRating float64 `json:"myRating" dc:"当前用户评分(未评分为0)"`
|
||||
}
|
||||
|
||||
// 我的书籍列表
|
||||
// =============================
|
||||
type MyListReq struct {
|
||||
g.Meta `path:"/book/app/my-books" tags:"APP" method:"get" summary:"获取我的书籍列表"`
|
||||
Type int `json:"type" dc:"类型:1-正在读 2-已读完 3-历史记录" v:"required"`
|
||||
Page int `json:"page" dc:"页码"`
|
||||
Size int `json:"size" dc:"每页数量"`
|
||||
Sort string `json:"sort" dc:"排序字段"`
|
||||
}
|
||||
type MyListRes struct {
|
||||
Total int `json:"total" dc:"总数"`
|
||||
List []model.MyBookItem `json:"list" dc:"书籍列表"`
|
||||
}
|
||||
|
||||
// =============================
|
||||
// 新增:单独修改精选状态和推荐状态
|
||||
// =============================
|
||||
type BookSetFeaturedReq struct {
|
||||
g.Meta `path:"/book/set-featured" tags:"Backend/Book" method:"post" summary:"设置书籍精选状态"`
|
||||
Id int64 `json:"id" dc:"书籍ID" v:"required"`
|
||||
IsFeatured int `json:"isFeatured" dc:"是否精选" v:"required"`
|
||||
}
|
||||
type BookSetFeaturedRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
type BookSetRecommendedReq struct {
|
||||
g.Meta `path:"/book/set-recommended" tags:"Backend/Book" method:"post" summary:"设置书籍推荐状态"`
|
||||
Id int64 `json:"id" dc:"书籍ID" v:"required"`
|
||||
IsRecommended int `json:"isRecommended" dc:"是否推荐" v:"required"`
|
||||
}
|
||||
type BookSetRecommendedRes struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user