142 lines
4.4 KiB
Go
142 lines
4.4 KiB
Go
package model
|
||
|
||
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" 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 {
|
||
Page int
|
||
Size int
|
||
BookId int64
|
||
Title string
|
||
IsLocked int
|
||
}
|
||
type ChapterListOut struct {
|
||
Total int
|
||
List []Chapter
|
||
}
|
||
|
||
type ChapterAddIn struct {
|
||
BookId int64
|
||
Title string
|
||
Content string
|
||
WordCount int
|
||
Sort int
|
||
IsLocked int
|
||
RequiredScore int
|
||
}
|
||
type ChapterEditIn struct {
|
||
Id int64
|
||
BookId int64
|
||
Title string
|
||
Content string
|
||
WordCount int
|
||
Sort int
|
||
IsLocked int
|
||
RequiredScore int
|
||
}
|
||
type ChapterDelIn struct {
|
||
Id int64
|
||
}
|
||
|
||
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:"最后阅读时间"`
|
||
IsPurchased bool `json:"isPurchased" 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 ChapterAppBatchProgressIn struct {
|
||
BookId int64 `json:"bookId" dc:"书籍ID"`
|
||
Chapters []ChapterProgressItem `json:"chapters" dc:"章节进度列表"`
|
||
UserId int64 `json:"userId" dc:"用户ID"`
|
||
}
|
||
|
||
// 章节进度项
|
||
type ChapterProgressItem struct {
|
||
ChapterId int64 `json:"chapterId" dc:"章节ID"`
|
||
Progress int `json:"progress" dc:"阅读进度百分比"`
|
||
}
|
||
|
||
// App 上传阅读进度输出结构体
|
||
type ChapterAppProgressOut struct {
|
||
Success bool `json:"success" dc:"是否成功"`
|
||
}
|