初始化项目框架,完成部分接口开发

This commit is contained in:
2025-07-10 21:04:29 +08:00
commit b2871ec0d2
168 changed files with 6399 additions and 0 deletions

18
api/chapter/chapter.go Normal file
View File

@ -0,0 +1,18 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package chapter
import (
"context"
"server/api/chapter/v1"
)
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)
}

57
api/chapter/v1/chapter.go Normal file
View File

@ -0,0 +1,57 @@
package v1
import (
"server/internal/model"
"github.com/gogf/gf/v2/frame/g"
)
type ChapterListReq struct {
g.Meta `path:"/chapter" tags:"Chapter" 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 {
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:"章节内容"`
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 {
Success bool `json:"success" dc:"是否成功"`
}
type ChapterEditReq struct {
g.Meta `path:"/chapter" tags:"Chapter" method:"put" summary:"编辑章节"`
Id int64 `json:"id" 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:"解锁所需积分"`
}
type ChapterEditRes 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 ChapterDelRes struct {
Success bool `json:"success" dc:"是否成功"`
}