完善功能

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

@ -1,17 +1,20 @@
package model
import "github.com/gogf/gf/v2/frame/g"
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
type Chapter struct {
g.Meta `orm:"table:chapters"`
Id int64 `json:"id"`
BookId int64 `json:"bookId"`
Title string `json:"title"`
Content string `json:"content"`
WordCount int `json:"wordCount"`
Sort int `json:"sort"`
IsLocked int `json:"isLocked"`
RequiredScore int `json:"requiredScore"`
Id int64 `json:"id" orm:"id"`
BookId int64 `json:"bookId" orm:"book_id"`
Title string `json:"title" orm:"title"`
Content string `json:"content" orm:"content"`
WordCount int `json:"wordCount" orm:"word_count"`
Sort int `json:"sort" orm:"sort"`
IsLocked int `json:"isLocked" orm:"is_locked"`
RequiredScore int `json:"requiredScore" orm:"required_score"`
}
type ChapterListIn struct {
@ -52,3 +55,73 @@ type ChapterDelIn struct {
type ChapterCRUDOut struct {
Success bool
}
// App 章节列表查询输入参数
type ChapterAppListIn struct {
BookId int64 `json:"bookId" dc:"书籍ID"`
IsDesc bool `json:"isDesc" dc:"是否逆序排列"`
Page int `json:"page" dc:"页码"`
Size int `json:"size" dc:"每页数量"`
UserId int64 `json:"userId" dc:"用户ID"`
}
// App 章节列表输出结构体(不包含 content
type ChapterAppItem struct {
g.Meta `orm:"table:chapters"`
Id int64 `json:"id" orm:"id" dc:"章节ID"`
Title string `json:"title" orm:"title" dc:"章节标题"`
WordCount int `json:"wordCount" orm:"word_count" dc:"字数"`
Sort int `json:"sort" orm:"sort" dc:"排序"`
IsLocked int `json:"isLocked" orm:"is_locked" dc:"是否锁定"`
RequiredScore int `json:"requiredScore" orm:"required_score" dc:"所需积分"`
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" dc:"更新时间"`
ReadProgress int `json:"readProgress" dc:"阅读进度百分比"`
ReadAt *gtime.Time `json:"readAt" dc:"最后阅读时间"`
}
type ChapterAppListOut struct {
List []ChapterAppItem
Total int
}
// App 章节详情查询输入参数
type ChapterAppDetailIn struct {
Id int64 `json:"id" dc:"章节ID"`
}
// App 章节详情输出结构体
type ChapterAppDetailOut struct {
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:"是否锁定"`
RequiredScore int `json:"requiredScore" dc:"所需积分"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// App 购买章节输入参数
type ChapterAppPurchaseIn struct {
Id int64 `json:"id" dc:"章节ID"`
UserId int64 `json:"userId" dc:"用户ID"`
}
// App 购买章节输出结构体
type ChapterAppPurchaseOut struct {
Success bool `json:"success" dc:"是否成功"`
}
// App 上传阅读进度输入参数
type ChapterAppProgressIn struct {
BookId int64 `json:"bookId" dc:"书籍ID"`
ChapterId int64 `json:"chapterId" dc:"章节ID"`
Progress int `json:"progress" dc:"阅读进度百分比"`
UserId int64 `json:"userId" dc:"用户ID"`
}
// App 上传阅读进度输出结构体
type ChapterAppProgressOut struct {
Success bool `json:"success" dc:"是否成功"`
}