完善功能

This commit is contained in:
2025-07-16 15:16:40 +08:00
parent b2871ec0d2
commit f68a5b360b
123 changed files with 4643 additions and 931 deletions

View File

@ -11,8 +11,12 @@ import (
)
type IChapterV1 interface {
ChapterList(ctx context.Context, req *v1.ChapterListReq) (res *v1.ChapterListRes, err error)
ChapterAdd(ctx context.Context, req *v1.ChapterAddReq) (res *v1.ChapterAddRes, err error)
ChapterEdit(ctx context.Context, req *v1.ChapterEditReq) (res *v1.ChapterEditRes, err error)
ChapterDel(ctx context.Context, req *v1.ChapterDelReq) (res *v1.ChapterDelRes, 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)
AppList(ctx context.Context, req *v1.AppListReq) (res *v1.AppListRes, err error)
AppDetail(ctx context.Context, req *v1.AppDetailReq) (res *v1.AppDetailRes, err error)
AppPurchase(ctx context.Context, req *v1.AppPurchaseReq) (res *v1.AppPurchaseRes, err error)
AppProgress(ctx context.Context, req *v1.AppProgressReq) (res *v1.AppProgressRes, err error)
}

View File

@ -6,52 +6,98 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
type ChapterListReq struct {
g.Meta `path:"/chapter" tags:"Chapter" method:"get" summary:"获取章节列表"`
type ListReq struct {
g.Meta `path:"/chapter" tags:"Backend/Author" method:"get" summary:"获取章节列表"`
Page int `json:"page" dc:"页码"`
Size int `json:"size" dc:"每页数量"`
BookId int64 `json:"bookId" dc:"小说ID"`
Title string `json:"title" dc:"章节标题(模糊搜索)"`
IsLocked int `json:"isLocked" dc:"是否锁定0免费1需积分解锁"`
}
type ChapterListRes struct {
type ListRes struct {
Total int `json:"total" dc:"总数"`
List []model.Chapter `json:"list" dc:"章节列表"`
}
type ChapterAddReq struct {
g.Meta `path:"/chapter" tags:"Chapter" method:"post" summary:"新增章节"`
BookId int64 `json:"bookId" dc:"小说ID"`
Title string `json:"title" dc:"章节标题"`
Content string `json:"content" dc:"章节内容"`
type AddReq struct {
g.Meta `path:"/chapter" tags:"Backend/Author" method:"post" summary:"新增章节"`
BookId int64 `json:"bookId" dc:"小说ID" v:"required"`
Title string `json:"title" dc:"章节标题" v:"required"`
Content string `json:"content" dc:"章节内容" v:"required"`
WordCount int `json:"wordCount" dc:"章节字数"`
Sort int `json:"sort" dc:"排序序号"`
IsLocked int `json:"isLocked" dc:"是否锁定0免费1需积分解锁"`
RequiredScore int `json:"requiredScore" dc:"解锁所需积分"`
}
type ChapterAddRes struct {
type AddRes struct {
Success bool `json:"success" dc:"是否成功"`
}
type ChapterEditReq struct {
g.Meta `path:"/chapter" tags:"Chapter" method:"put" summary:"编辑章节"`
type EditReq struct {
g.Meta `path:"/chapter" tags:"Backend/Author" method:"put" summary:"编辑章节"`
Id int64 `json:"id" dc:"章节ID" v:"required"`
BookId int64 `json:"bookId" dc:"小说ID" v:"required"`
Title string `json:"title" dc:"章节标题" v:"required"`
Content string `json:"content" dc:"章节内容" v:"required"`
WordCount int `json:"wordCount" dc:"章节字数"`
Sort int `json:"sort" dc:"排序序号"`
IsLocked int `json:"isLocked" dc:"是否锁定0免费1需积分解锁"`
RequiredScore int `json:"requiredScore" dc:"解锁所需积分"`
}
type EditRes struct {
Success bool `json:"success" dc:"是否成功"`
}
type DelReq struct {
g.Meta `path:"/chapter" tags:"Backend/Author" method:"delete" summary:"删除章节"`
Id int64 `json:"id" dc:"章节ID" v:"required"`
}
type DelRes struct {
Success bool `json:"success" dc:"是否成功"`
}
type AppListReq struct {
g.Meta `path:"/chapter/app/list" tags:"APP" method:"get" summary:"App获取章节列表"`
BookId int64 `json:"bookId" dc:"书籍ID" v:"required"`
IsDesc bool `json:"isDesc" dc:"是否逆序排列"`
Page int `json:"page" dc:"页码"`
Size int `json:"size" dc:"每页数量"`
}
type AppListRes struct {
Total int `json:"total" dc:"总数"`
List []model.ChapterAppItem `json:"list" dc:"章节列表"`
}
type AppDetailReq struct {
g.Meta `path:"/chapter/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"`
BookId int64 `json:"bookId" dc:"小说ID"`
BookId int64 `json:"bookId" dc:"书籍ID"`
Title string `json:"title" dc:"章节标题"`
Content string `json:"content" dc:"章节内容"`
WordCount int `json:"wordCount" dc:"章节字数"`
Sort int `json:"sort" dc:"排序序号"`
IsLocked int `json:"isLocked" dc:"是否锁定0免费1需积分解锁"`
RequiredScore int `json:"requiredScore" dc:"解锁所需积分"`
WordCount int `json:"wordCount" dc:"字数"`
Sort int `json:"sort" dc:"排序"`
IsLocked int `json:"isLocked" dc:"是否锁定"`
RequiredScore int `json:"requiredScore" dc:"所需积分"`
UpdatedAt string `json:"updatedAt" dc:"更新时间"`
}
type ChapterEditRes struct {
type AppPurchaseReq struct {
g.Meta `path:"/chapter/app/purchase" tags:"APP" method:"post" summary:"App购买章节"`
Id int64 `json:"id" dc:"章节ID" v:"required"`
}
type AppPurchaseRes struct {
Success bool `json:"success" dc:"是否成功"`
}
type ChapterDelReq struct {
g.Meta `path:"/chapter" tags:"Chapter" method:"delete" summary:"删除章节"`
Id int64 `json:"id" dc:"章节ID"`
type AppProgressReq struct {
g.Meta `path:"/chapter/app/progress" tags:"APP" method:"post" summary:"App上传阅读进度"`
BookId int64 `json:"bookId" dc:"书籍ID" v:"required"`
ChapterId int64 `json:"chapterId" dc:"章节ID" v:"required"`
Progress int `json:"progress" dc:"阅读进度百分比(0-100)"`
}
type ChapterDelRes struct {
type AppProgressRes struct {
Success bool `json:"success" dc:"是否成功"`
}