完善功能

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

60
internal/model/author.go Normal file
View File

@ -0,0 +1,60 @@
package model
import "github.com/gogf/gf/v2/frame/g"
type Author struct {
g.Meta `orm:"table:authors"`
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"userId" orm:"user_id"`
PenName string `json:"penName" orm:"pen_name"`
Bio string `json:"bio" orm:"bio"`
}
type AuthorListIn struct {
Page int
Size int
PenName string
Status int
}
type AuthorListOut struct {
Total int
List []Author
}
type AuthorAddIn struct {
UserId int64
PenName string
Bio string
Status int
}
type AuthorEditIn struct {
Id int64
PenName string
Bio string
Status int
}
type AuthorDelIn struct {
Id int64
}
type AuthorCRUDOut struct {
Success bool
}
type AuthorApplyIn struct {
PenName string // 笔名
Bio string // 作者简介
}
type AuthorApplyOut struct {
Success bool
}
type AuthorDetailIn struct {
AuthorId int64
}
type AuthorDetailOut struct {
g.Meta `orm:"table:authors"`
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"userId" orm:"user_id"`
PenName string `json:"penName" orm:"pen_name"`
Bio string `json:"bio" orm:"bio"`
User User `json:"user" orm:"with:id = user_id"`
}

View File

@ -1,23 +1,41 @@
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 Book struct {
g.Meta `orm:"table:books"`
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"`
WordsCount int `json:"wordsCount"`
ChaptersCount int `json:"chaptersCount"`
LatestChapterId int64 `json:"latestChapterId"`
Rating float64 `json:"rating"`
ReadCount int64 `json:"readCount"`
Tags string `json:"tags"`
IsRecommended int `json:"isRecommended"`
Id int64 `json:"id" orm:"id"`
AuthorId int64 `json:"authorId" orm:"author_id"`
Author Author `json:"author" orm:"with:id = author_id"`
CategoryId int64 `json:"categoryId" orm:"category_id"`
Category Category `json:"category" orm:"with:id = category_id"`
Title string `json:"title" orm:"title"`
CoverUrl string `json:"coverUrl" orm:"cover_url"`
Description string `json:"description" orm:"description"`
Status int `json:"status" orm:"status"`
WordsCount int `json:"wordsCount" orm:"words_count"`
ChaptersCount int `json:"chaptersCount" orm:"chapters_count"`
LatestChapterId int64 `json:"latestChapterId" orm:"latest_chapter_id"`
Rating float64 `json:"rating" orm:"rating"`
ReadCount int64 `json:"readCount" orm:"read_count"`
CurrentReaders int64 `json:"currentReaders" orm:"current_readers"`
Tags string `json:"tags" orm:"tags"`
IsRecommended int `json:"isRecommended" orm:"is_recommended"`
IsFeatured int `json:"isFeatured" orm:"is_featured"`
Language string `json:"language" orm:"language"`
}
// App作者信息结构体
type AppAuthor struct {
g.Meta `orm:"table:authors"`
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"-" orm:"user_id"`
PenName string `json:"penName" orm:"pen_name"`
Bio string `json:"bio" orm:"bio"`
Status int `json:"status" orm:"status"`
}
type BookListIn struct {
@ -28,6 +46,7 @@ type BookListIn struct {
AuthorId int64
Status int
IsRecommended int
Sort string
}
type BookListOut struct {
Total int
@ -43,6 +62,8 @@ type BookAddIn struct {
Status int
Tags string
IsRecommended int
IsFeatured int
Language string
}
type BookEditIn struct {
Id int64
@ -54,6 +75,8 @@ type BookEditIn struct {
Status int
Tags string
IsRecommended int
IsFeatured int
Language string
}
type BookDelIn struct {
Id int64
@ -62,3 +85,166 @@ type BookDelIn struct {
type BookCRUDOut struct {
Success bool
}
type BookHistoryRemoveOut struct {
Success bool `json:"success" dc:"是否成功"`
}
// App 书籍列表项结构体
type BookAppItem struct {
g.Meta `orm:"table:books"`
Id int64 `json:"id" dc:"书籍ID" orm:"id"`
CoverUrl string `json:"coverUrl" dc:"封面图" orm:"cover_url"`
Rating float64 `json:"rating" dc:"评分" orm:"rating"`
Title string `json:"title" dc:"标题" orm:"title"`
Description string `json:"description" dc:"简介" orm:"description"`
AuthorId int64 `json:"authorId" dc:"作者ID" orm:"author_id"`
Author AppAuthor `json:"author" dc:"作者信息" orm:"with:id = author_id"`
IsFeatured int `json:"isFeatured" dc:"是否精选" orm:"is_featured"`
Language string `json:"language" dc:"语言" orm:"language"`
CategoryId int64 `json:"categoryId" dc:"分类ID" orm:"category_id"`
Category Category `json:"category" dc:"分类信息" orm:"with:id = category_id"`
Status int `json:"status" dc:"状态" orm:"status"`
WordsCount int `json:"wordsCount" dc:"字数" orm:"words_count"`
ChaptersCount int `json:"chaptersCount" dc:"章节数" orm:"chapters_count"`
LatestChapterId int64 `json:"latestChapterId" dc:"最新章节ID" orm:"latest_chapter_id"`
ReadCount int64 `json:"readCount" dc:"阅读人数" orm:"read_count"`
CurrentReaders int64 `json:"currentReaders" dc:"在读人数" orm:"current_readers"`
Tags string `json:"tags" dc:"标签" orm:"tags"`
IsRecommended int `json:"isRecommended" dc:"是否推荐" orm:"is_recommended"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间" orm:"created_at"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间" orm:"updated_at"`
HasRated bool `json:"hasRated" dc:"当前用户是否已评分"`
MyRating float64 `json:"myRating" dc:"当前用户评分未评分为0"`
}
// App 书籍列表查询输入参数
type BookAppListIn struct {
Page int `json:"page" dc:"页码"`
Size int `json:"size" dc:"每页数量"`
IsRecommended bool `json:"isRecommended" dc:"是否推荐"`
IsLatest int `json:"isLatest" dc:"是否最新"`
CategoryId int64 `json:"categoryId" dc:"分类ID"`
Title string `json:"title" dc:"书名模糊搜索"`
UserId int64 `json:"userId" dc:"用户ID"`
AuthorId int `json:"authorId" dc:"作者ID"`
IsFeatured bool `json:"isFeatured" dc:"是否精选"`
Language string `json:"language" dc:"语言"`
Sort string `json:"sort" dc:"排序字段"`
}
// App 书籍列表输出结构体
type BookAppListOut struct {
Total int `json:"total" dc:"总数"`
List []BookAppItem `json:"list" dc:"书籍列表"`
}
// App 书籍详情查询输入参数
type BookAppDetailIn struct {
Id int64 `json:"id" dc:"书籍ID"`
UserId int64 `json:"userId" dc:"用户ID"`
}
// App 书籍详情输出结构体
type BookAppDetailOut 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 *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `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 BookAppRateIn struct {
BookId int64 `json:"bookId" dc:"书籍ID"`
UserId int64 `json:"userId" dc:"用户ID"`
Rating float64 `json:"rating" dc:"评分(1-10分)"`
}
// App 用户评分输出结构体
type BookAppRateOut struct {
Success bool `json:"success" dc:"是否成功"`
}
// 书籍评分模型
type BookRating struct {
g.Meta `orm:"table:book_ratings"`
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"userId" orm:"user_id"`
BookId int64 `json:"bookId" orm:"book_id"`
Score float64 `json:"score" orm:"score"`
Comment string `json:"comment" orm:"comment"`
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"`
}
// 书籍评分输入参数
type BookRatingAddIn struct {
UserId int64 `json:"userId" dc:"用户ID"`
BookId int64 `json:"bookId" dc:"书籍ID"`
Score float64 `json:"score" dc:"评分(1-10分)"`
Comment string `json:"comment" dc:"用户评论"`
}
// 书籍评分输出结构体
type BookRatingCRUDOut struct {
Success bool `json:"success" dc:"是否成功"`
}
// 我的书籍列表项
// =============================
type MyBookItem struct {
Id int64 `json:"id"`
Title string `json:"title"`
CoverUrl string `json:"coverUrl"`
Description string `json:"description"`
Progress int `json:"progress" dc:"阅读进度百分比"`
IsInShelf bool `json:"isInShelf" dc:"是否在书架"`
LastReadAt string `json:"lastReadAt" dc:"最近阅读时间"`
Status int `json:"status" dc:"书籍状态"`
AuthorId int64 `json:"authorId"`
CategoryId int64 `json:"categoryId"`
}
// 我的书籍列表查询参数
// =============================
type MyBookListIn struct {
Type int // 1-正在读 2-已读完 3-历史记录
Page int
Size int
UserId int64
Sort string
}
// 我的书籍列表返回
// =============================
type MyBookListOut struct {
Total int
List []MyBookItem
}
// =============================
// 新增:单独修改精选状态和推荐状态
// =============================
type BookSetFeaturedIn struct {
Id int64 `json:"id" dc:"书籍ID"`
IsFeatured int `json:"isFeatured" dc:"是否精选"`
}
type BookSetRecommendedIn struct {
Id int64 `json:"id" dc:"书籍ID"`
IsRecommended int `json:"isRecommended" dc:"是否推荐"`
}

View File

@ -0,0 +1,24 @@
package model
import "github.com/gogf/gf/v2/frame/g"
type Bookshelve struct {
g.Meta `orm:"table:bookshelves"`
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"userId" orm:"user_id"`
BookId int64 `json:"bookId" orm:"book_id"`
AddedAt int64 `json:"addedAt" orm:"added_at"`
ReadStatus int `json:"readStatus" orm:"read_status"`
}
type BookshelveAddIn struct {
UserId int64
BookId int64
}
type BookshelveDelIn struct {
UserId int64
BookIds []int64
}
type BookshelveCRUDOut struct {
Success bool
}

View File

@ -3,17 +3,17 @@ package model
import "github.com/gogf/gf/v2/frame/g"
type Category struct {
g.Meta `orm:"table:categories"`
Id int64 `json:"id" orm:"id"` // 分类ID
Name string `json:"name" orm:"name"` // 分类名称
Type int `json:type orm:"type"` // 类型1 男频2 女频
g.Meta `orm:"table:categories"`
Id int64 `json:"id" orm:"id"`
Name string `json:"name" orm:"name"`
Channel int `json:"channel" orm:"channel"`
}
type CategoryListIn struct {
Page int
Size int
Name string
Type int
Page int
Size int
Name string
Channel int
}
type CategoryListOut struct {
Total int
@ -21,16 +21,16 @@ type CategoryListOut struct {
}
type CategoryAddIn struct {
Name string
Type int // 类型1 男频2 女频
Name string
Channel int
}
type CategoryEditIn struct {
Id int
Name string
Type int // 类型1 男频2 女频
Id int64
Name string
Channel int
}
type CategoryDelIn struct {
Id int
Id int64
}
type CategoryCRUDOut struct {

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:"是否成功"`
}

View File

@ -11,22 +11,24 @@ import (
// Books is the golang structure of table books for DAO operations like Where/Data.
type Books struct {
g.Meta `orm:"table:books, do:true"`
Id interface{} // 小说ID
AuthorId interface{} // 作者ID
CategoryId interface{} // 分类ID
Title interface{} // 小说标题
CoverUrl interface{} // 封面图片URL
Description interface{} // 小说简介
Status interface{} // 状态1=连载中2=完结3=下架
WordsCount interface{} // 字数
ChaptersCount interface{} // 章节数
LatestChapterId interface{} // 最新章节ID
Rating interface{} // 评分0.00~10.00
ReadCount interface{} // 读人数
Tags interface{} // 标签(逗号分隔)
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
IsRecommended interface{} // 是否推荐0=否1=是
g.Meta `orm:"table:books, do:true"`
Id interface{} // 小说ID
AuthorId interface{} // 作者ID
CategoryId interface{} // 分类ID
Title interface{} // 小说标题
CoverUrl interface{} // 封面图片URL
Description interface{} // 小说简介
Status interface{} // 状态1=连载中2=完结3=下架
WordsCount interface{} // 字数
ChaptersCount interface{} // 章节数
Rating interface{} // 评分0.00~10.00
ReadCount interface{} // 阅读人数
CurrentReaders interface{} // 读人数
Tags interface{} // 标签(逗号分隔)
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
IsRecommended interface{} // 是否推荐0=否1=是
IsFeatured interface{} // 是否精选0=否1=是
Language interface{} // 语言,如 zh=中文en=英文jp=日文
}

View File

@ -19,4 +19,5 @@ type Bookshelves struct {
LastReadChapterId interface{} // 最后阅读章节ID
LastReadPercent interface{} // 阅读进度百分比0.00~100.00
LastReadAt *gtime.Time // 最后阅读时间
ReadStatus interface{} // 阅读状态1=正在读2=已读完3=已收藏
}

View File

@ -14,8 +14,8 @@ type Categories struct {
g.Meta `orm:"table:categories, do:true"`
Id interface{} // 分类ID
Name interface{} // 分类名称
Type interface{} // 分类类型1=男频, 2=女频
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
Channel interface{} // 频道类型1=男频2=女频
}

View File

@ -14,9 +14,9 @@ type UserPointsLogs struct {
g.Meta `orm:"table:user_points_logs, do:true"`
Id interface{} // 积分流水ID
UserId interface{} // 用户ID
ChangeType interface{} // 变动类型,例如 earn、spend、refund 等
ChangeType interface{} // 变动类型,1=消费(spend), 2=收入(earn)
PointsChange interface{} // 积分变化数,正数增加,负数减少
RelatedOrderId interface{} // 关联订单ID
RelatedOrderId interface{} // 关联ID当change_type=1时为chapter_purchases.id当change_type=2时为advertisement_records.id
Description interface{} // 变动说明
CreatedAt *gtime.Time // 变动时间
}

View File

@ -0,0 +1,20 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// UserReadHistory is the golang structure of table user_read_history for DAO operations like Where/Data.
type UserReadHistory struct {
g.Meta `orm:"table:user_read_history, do:true"`
Id interface{} // 历史记录ID
UserId interface{} // 用户ID
BookId interface{} // 小说ID
ChapterId interface{} // 最后阅读章节ID
ReadAt *gtime.Time // 最后阅读时间
}

View File

@ -9,12 +9,15 @@ import (
"github.com/gogf/gf/v2/os/gtime"
)
// ReadRecords is the golang structure of table read_records for DAO operations like Where/Data.
type ReadRecords struct {
g.Meta `orm:"table:read_records, do:true"`
// UserReadRecords is the golang structure of table user_read_records for DAO operations like Where/Data.
type UserReadRecords struct {
g.Meta `orm:"table:user_read_records, do:true"`
Id interface{} // 记录ID
UserId interface{} // 用户ID
BookId interface{} // 小说ID
ChapterId interface{} // 章节ID
Progress interface{} // 阅读进度百分比(0-100)
ReadAt *gtime.Time // 阅读时间
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
}

View File

@ -10,21 +10,23 @@ import (
// Books is the golang structure for table books.
type Books struct {
Id int64 `json:"id" orm:"id" description:"小说ID"` // 小说ID
AuthorId int64 `json:"authorId" orm:"author_id" description:"作者ID"` // 作者ID
CategoryId int64 `json:"categoryId" orm:"category_id" description:"分类ID"` // 分类ID
Title string `json:"title" orm:"title" description:"小说标题"` // 小说标题
CoverUrl string `json:"coverUrl" orm:"cover_url" description:"封面图片URL"` // 封面图片URL
Description string `json:"description" orm:"description" description:"小说简介"` // 小说简介
Status int `json:"status" orm:"status" description:"状态1=连载中2=完结3=下架"` // 状态1=连载中2=完结3=下架
WordsCount int `json:"wordsCount" orm:"words_count" description:"字数"` // 字数
ChaptersCount int `json:"chaptersCount" orm:"chapters_count" description:"章节数"` // 章节数
LatestChapterId int64 `json:"latestChapterId" orm:"latest_chapter_id" description:"最新章节ID"` // 最新章节ID
Rating float64 `json:"rating" orm:"rating" description:"评分0.00~10.00"` // 评分0.00~10.00
ReadCount int64 `json:"readCount" orm:"read_count" description:"读人数"` // 读人数
Tags string `json:"tags" orm:"tags" description:"标签(逗号分隔)"` // 标签(逗号分隔)
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
IsRecommended int `json:"isRecommended" orm:"is_recommended" description:"是否推荐0=否1=是"` // 是否推荐0=否1=是
Id int64 `json:"id" orm:"id" description:"小说ID"` // 小说ID
AuthorId int64 `json:"authorId" orm:"author_id" description:"作者ID"` // 作者ID
CategoryId int64 `json:"categoryId" orm:"category_id" description:"分类ID"` // 分类ID
Title string `json:"title" orm:"title" description:"小说标题"` // 小说标题
CoverUrl string `json:"coverUrl" orm:"cover_url" description:"封面图片URL"` // 封面图片URL
Description string `json:"description" orm:"description" description:"小说简介"` // 小说简介
Status int `json:"status" orm:"status" description:"状态1=连载中2=完结3=下架"` // 状态1=连载中2=完结3=下架
WordsCount int `json:"wordsCount" orm:"words_count" description:"字数"` // 字数
ChaptersCount int `json:"chaptersCount" orm:"chapters_count" description:"章节数"` // 章节数
Rating float64 `json:"rating" orm:"rating" description:"评分0.00~10.00"` // 评分0.00~10.00
ReadCount int64 `json:"readCount" orm:"read_count" description:"阅读人数"` // 阅读人数
CurrentReaders int64 `json:"currentReaders" orm:"current_readers" description:"读人数"` // 读人数
Tags string `json:"tags" orm:"tags" description:"标签(逗号分隔)"` // 标签(逗号分隔)
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
IsRecommended int `json:"isRecommended" orm:"is_recommended" description:"是否推荐0=否1=是"` // 是否推荐0=否1=是
IsFeatured int `json:"isFeatured" orm:"is_featured" description:"是否精选0=否1=是"` // 是否精选0=否1=是
Language string `json:"language" orm:"language" description:"语言,如 zh=中文en=英文jp=日文"` // 语言,如 zh=中文en=英文jp=日文
}

View File

@ -10,11 +10,12 @@ import (
// Bookshelves is the golang structure for table bookshelves.
type Bookshelves struct {
Id int64 `json:"id" orm:"id" description:"记录ID"` // 记录ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
BookId int64 `json:"bookId" orm:"book_id" description:"小说ID"` // 小说ID
AddedAt *gtime.Time `json:"addedAt" orm:"added_at" description:"加入书架时间"` // 加入书架时间
LastReadChapterId int64 `json:"lastReadChapterId" orm:"last_read_chapter_id" description:"最后阅读章节ID"` // 最后阅读章节ID
LastReadPercent float64 `json:"lastReadPercent" orm:"last_read_percent" description:"阅读进度百分比0.00~100.00"` // 阅读进度百分比0.00~100.00
LastReadAt *gtime.Time `json:"lastReadAt" orm:"last_read_at" description:"最后阅读时间"` // 最后阅读时间
Id int64 `json:"id" orm:"id" description:"记录ID"` // 记录ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
BookId int64 `json:"bookId" orm:"book_id" description:"小说ID"` // 小说ID
AddedAt *gtime.Time `json:"addedAt" orm:"added_at" description:"加入书架时间"` // 加入书架时间
LastReadChapterId int64 `json:"lastReadChapterId" orm:"last_read_chapter_id" description:"最后阅读章节ID"` // 最后阅读章节ID
LastReadPercent float64 `json:"lastReadPercent" orm:"last_read_percent" description:"阅读进度百分比0.00~100.00"` // 阅读进度百分比0.00~100.00
LastReadAt *gtime.Time `json:"lastReadAt" orm:"last_read_at" description:"最后阅读时间"` // 最后阅读时间
ReadStatus int `json:"readStatus" orm:"read_status" description:"阅读状态1=正在读2=已读完3=已收藏"` // 阅读状态1=正在读2=已读完3=已收藏
}

View File

@ -10,10 +10,10 @@ import (
// Categories is the golang structure for table categories.
type Categories struct {
Id int64 `json:"id" orm:"id" description:"分类ID"` // 分类ID
Name string `json:"name" orm:"name" description:"分类名称"` // 分类名称
Type int `json:"type" orm:"type" description:"分类类型1=男频, 2=女频"` // 分类类型1=男频, 2=女频
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
Id int64 `json:"id" orm:"id" description:"分类ID"` // 分类ID
Name string `json:"name" orm:"name" description:"分类名称"` // 分类名称
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
Channel int `json:"channel" orm:"channel" description:"频道类型1=男频2=女频"` // 频道类型1=男频2=女频
}

View File

@ -10,11 +10,11 @@ import (
// UserPointsLogs is the golang structure for table user_points_logs.
type UserPointsLogs struct {
Id int64 `json:"id" orm:"id" description:"积分流水ID"` // 积分流水ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
ChangeType string `json:"changeType" orm:"change_type" description:"变动类型,例如 earn、spend、refund 等"` // 变动类型,例如 earn、spend、refund 等
PointsChange int `json:"pointsChange" orm:"points_change" description:"积分变化数,正数增加,负数减少"` // 积分变化数,正数增加,负数减少
RelatedOrderId int64 `json:"relatedOrderId" orm:"related_order_id" description:"关联订单ID"` // 关联订单ID
Description string `json:"description" orm:"description" description:"变动说明"` // 变动说明
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"变动时间"` // 变动时间
Id int64 `json:"id" orm:"id" description:"积分流水ID"` // 积分流水ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
ChangeType int `json:"changeType" orm:"change_type" description:"变动类型,1=消费(spend), 2=收入(earn)"` // 变动类型1=消费(spend), 2=收入(earn)
PointsChange int `json:"pointsChange" orm:"points_change" description:"积分变化数,正数增加,负数减少"` // 积分变化数,正数增加,负数减少
RelatedOrderId int64 `json:"relatedOrderId" orm:"related_order_id" description:"关联ID当change_type=1时为chapter_purchases.id当change_type=2时为advertisement_records.id"` // 关联ID当change_type=1时为chapter_purchases.id当change_type=2时为advertisement_records.id
Description string `json:"description" orm:"description" description:"变动说明"` // 变动说明
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"变动时间"` // 变动时间
}

View File

@ -8,11 +8,11 @@ import (
"github.com/gogf/gf/v2/os/gtime"
)
// ReadRecords is the golang structure for table read_records.
type ReadRecords struct {
Id int64 `json:"id" orm:"id" description:"记录ID"` // 记录ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
BookId int64 `json:"bookId" orm:"book_id" description:"小说ID"` // 小说ID
ChapterId int64 `json:"chapterId" orm:"chapter_id" description:"章节ID"` // 章节ID
ReadAt *gtime.Time `json:"readAt" orm:"read_at" description:"阅读时间"` // 阅读时间
// UserReadHistory is the golang structure for table user_read_history.
type UserReadHistory struct {
Id int64 `json:"id" orm:"id" description:"历史记录ID"` // 历史记录ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
BookId int64 `json:"bookId" orm:"book_id" description:"小说ID"` // 小说ID
ChapterId int64 `json:"chapterId" orm:"chapter_id" description:"最后阅读章节ID"` // 最后阅读章节ID
ReadAt *gtime.Time `json:"readAt" orm:"read_at" description:"最后阅读时间"` // 最后阅读时间
}

View File

@ -0,0 +1,21 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// UserReadRecords is the golang structure for table user_read_records.
type UserReadRecords struct {
Id int64 `json:"id" orm:"id" description:"记录ID"` // 记录ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
BookId int64 `json:"bookId" orm:"book_id" description:"小说ID"` // 小说ID
ChapterId int64 `json:"chapterId" orm:"chapter_id" description:"章节ID"` // 章节ID
Progress int `json:"progress" orm:"progress" description:"阅读进度百分比(0-100)"` // 阅读进度百分比(0-100)
ReadAt *gtime.Time `json:"readAt" orm:"read_at" description:"阅读时间"` // 阅读时间
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
}

View File

@ -1,13 +1,18 @@
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 Feedback struct {
g.Meta `orm:"table:feedbacks"`
Id int64 `json:"id"`
UserId int64 `json:"userId"`
Content string `json:"content"`
Status int `json:"status"`
g.Meta `orm:"table:feedbacks"`
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"userId" orm:"user_id"`
Content string `json:"content" orm:"content"`
Status int `json:"status" orm:"status"`
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"`
User User `json:"user" orm:"with:id=user_id"`
}
type FeedbackListIn struct {

View File

@ -1,36 +0,0 @@
package model
import "github.com/gogf/gf/v2/frame/g"
type ReadRecord struct {
g.Meta `orm:"table:read_records"`
Id int64 `json:"id"`
UserId int64 `json:"userId"`
BookId int64 `json:"bookId"`
ChapterId int64 `json:"chapterId"`
ReadAt int64 `json:"readAt"`
}
type ReadRecordListIn struct {
Page int
Size int
UserId int64
BookId int64
ChapterId int64
}
type ReadRecordListOut struct {
Total int
List []ReadRecord
}
type ReadRecordAddIn struct {
UserId int64
BookId int64
ChapterId int64
}
type ReadRecordDelIn struct {
Id int64
}
type ReadRecordCRUDOut struct {
Success bool
}

View File

@ -4,9 +4,9 @@ import "github.com/gogf/gf/v2/frame/g"
type Tag struct {
g.Meta `orm:"table:tags"`
Id int64 `json:"id"`
Name string `json:"name"`
Type int `json:"type"` // 1=主题, 2=角色, 3=情节
Id int64 `json:"id" orm:"id"`
Name string `json:"name" orm:"name"`
Type int `json:"type" orm:"type"` // 1=主题, 2=角色, 3=情节
}
type TagListIn struct {

View File

@ -1,47 +1 @@
package model
import "github.com/gogf/gf/v2/net/ghttp"
type UploadIn struct {
File *ghttp.UploadFile
Type string
}
type UploadOut struct {
Url string
}
type OssOutput struct {
Url string
}
type OssBytesInput struct {
Bytes []byte
Name string
}
type OssGetFileInput struct {
FilePath string
Name string
}
type OssUploadFileInput struct {
Filename string
File *ghttp.UploadFile
}
type SMSCodeIn struct {
Phone string
Code string
}
type SMSCodeOut struct {
Success bool
}
type CaptchaIn struct {
Name string
}
type CaptchaOut struct {
Success bool
}

View File

@ -1,5 +1,19 @@
package model
import "github.com/gogf/gf/v2/frame/g"
type User struct {
g.Meta `orm:"table:users"`
Id int64 `json:"id" orm:"id"`
Email string `json:"email" orm:"email"`
Username string `json:"username" orm:"username"`
Avatar string `json:"avatar" orm:"avatar"`
}
type AppUser struct {
g.Meta `orm:"table:users"`
Id int64 `json:"id" orm:"id"`
Avatar string `json:"avatar" orm:"avatar"`
}
type UserLoginIn struct {
Email string // 用户名
Password string // 密码

View File

@ -4,10 +4,10 @@ import "github.com/gogf/gf/v2/frame/g"
type UserFollowAuthor struct {
g.Meta `orm:"table:user_follow_authors"`
Id int64 `json:"id"`
UserId int64 `json:"userId"`
AuthorId int64 `json:"authorId"`
FollowedAt int64 `json:"followedAt"`
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"userId" orm:"user_id"`
AuthorId int64 `json:"authorId" orm:"author_id"`
FollowedAt int64 `json:"followedAt" orm:"followed_at"`
}
type UserFollowAuthorListIn struct {

View File

@ -0,0 +1,27 @@
package model
import "github.com/gogf/gf/v2/frame/g"
type UserReadHistory struct {
g.Meta `orm:"table:user_read_history"`
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"userId" orm:"user_id"`
BookId int64 `json:"bookId" orm:"book_id"`
ChapterId int64 `json:"chapterId" orm:"chapter_id"`
ReadAt int64 `json:"readAt" orm:"read_at"`
}
type UserReadHistoryAddIn struct {
UserId int64
BookId int64
ChapterId int64
}
type UserReadHistoryDelIn struct {
UserId int64
BookIds []int64
}
type UserReadHistoryCRUDOut struct {
Success bool
}

View File

@ -0,0 +1,39 @@
package model
import "github.com/gogf/gf/v2/frame/g"
type UserReadRecordModel struct {
g.Meta `orm:"table:user_read_records"`
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"userId" orm:"user_id"`
BookId int64 `json:"bookId" orm:"book_id"`
ChapterId int64 `json:"chapterId" orm:"chapter_id"`
Progress int `json:"progress" orm:"progress"`
ReadAt int64 `json:"readAt" orm:"read_at"`
}
type UserReadRecordListIn struct {
Page int
Size int
UserId int64
BookId int64
ChapterId int64
}
type UserReadRecordListOut struct {
Total int
List []UserReadRecordModel
}
type UserReadRecordAddIn struct {
UserId int64
BookId int64
ChapterId int64
Progress int
}
type UserReadRecordDelIn struct {
UserId int64
BookIds []int64
}
type UserReadRecordCRUDOut struct {
Success bool
}