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

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

31
internal/model/admin.go Normal file
View File

@ -0,0 +1,31 @@
package model
type Admin struct {
}
type AdminLoginIn struct {
Username string
Password string
}
type AdminLoginOut struct {
Token string
}
type AdminInfoIn struct {
AdminId int64 // 管理员ID
}
type AdminInfoOut struct {
AdminId int64 // 管理员ID
Username string // 用户名
}
type AdminEditPassIn struct {
AdminId int64 // 管理员ID
OldPass string // 旧密码
NewPass string // 新密码
}
type AdminEditPassOut struct {
Success bool // 是否成功
}

13
internal/model/base.go Normal file
View File

@ -0,0 +1,13 @@
package model
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Base 包含数据库表常见的公共字段
type Base struct {
Id int64 `json:"id" orm:"id,primary"` // 主键 ID
CreatedAt *gtime.Time `json:"created_at" orm:"created_at"` // 创建时间
UpdatedAt *gtime.Time `json:"updated_at" orm:"updated_at"` // 更新时间
DeletedAt *gtime.Time `json:"deleted_at" orm:"deleted_at"` // 软删除时间
}

64
internal/model/book.go Normal file
View File

@ -0,0 +1,64 @@
package model
import "github.com/gogf/gf/v2/frame/g"
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"`
}
type BookListIn struct {
Page int
Size int
Title string
CategoryId int64
AuthorId int64
Status int
IsRecommended int
}
type BookListOut struct {
Total int
List []Book
}
type BookAddIn struct {
AuthorId int64
CategoryId int64
Title string
CoverUrl string
Description string
Status int
Tags string
IsRecommended int
}
type BookEditIn struct {
Id int64
AuthorId int64
CategoryId int64
Title string
CoverUrl string
Description string
Status int
Tags string
IsRecommended int
}
type BookDelIn struct {
Id int64
}
type BookCRUDOut struct {
Success bool
}

View File

@ -0,0 +1,38 @@
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 女频
}
type CategoryListIn struct {
Page int
Size int
Name string
Type int
}
type CategoryListOut struct {
Total int
List []Category
}
type CategoryAddIn struct {
Name string
Type int // 类型1 男频2 女频
}
type CategoryEditIn struct {
Id int
Name string
Type int // 类型1 男频2 女频
}
type CategoryDelIn struct {
Id int
}
type CategoryCRUDOut struct {
Success bool
}

54
internal/model/chapter.go Normal file
View File

@ -0,0 +1,54 @@
package model
import "github.com/gogf/gf/v2/frame/g"
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"`
}
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
}

View File

@ -0,0 +1,21 @@
// =================================================================================
// 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"
)
// Admins is the golang structure of table admins for DAO operations like Where/Data.
type Admins struct {
g.Meta `orm:"table:admins, do:true"`
Id interface{} // 管理员ID
Username interface{} // 管理员用户名
PasswordHash interface{} // 密码哈希
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -0,0 +1,23 @@
// =================================================================================
// 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"
)
// Authors is the golang structure of table authors for DAO operations like Where/Data.
type Authors struct {
g.Meta `orm:"table:authors, do:true"`
Id interface{} // 作者ID
UserId interface{} // 用户ID
PenName interface{} // 笔名
Bio interface{} // 作者简介
Status interface{} // 状态1=正常2=禁用
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -0,0 +1,21 @@
// =================================================================================
// 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"
)
// BookRatings is the golang structure of table book_ratings for DAO operations like Where/Data.
type BookRatings struct {
g.Meta `orm:"table:book_ratings, do:true"`
Id interface{} // 评分ID
UserId interface{} // 用户ID
BookId interface{} // 小说ID
Score interface{} // 评分0~10
Comment interface{} // 用户评论
CreatedAt *gtime.Time // 创建时间
}

View File

@ -0,0 +1,32 @@
// =================================================================================
// 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"
)
// 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=是
}

View File

@ -0,0 +1,22 @@
// =================================================================================
// 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"
)
// Bookshelves is the golang structure of table bookshelves for DAO operations like Where/Data.
type Bookshelves struct {
g.Meta `orm:"table:bookshelves, do:true"`
Id interface{} // 记录ID
UserId interface{} // 用户ID
BookId interface{} // 小说ID
AddedAt *gtime.Time // 加入书架时间
LastReadChapterId interface{} // 最后阅读章节ID
LastReadPercent interface{} // 阅读进度百分比0.00~100.00
LastReadAt *gtime.Time // 最后阅读时间
}

View File

@ -0,0 +1,21 @@
// =================================================================================
// 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"
)
// Categories is the golang structure of table categories for DAO operations like Where/Data.
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 // 软删除时间戳
}

View File

@ -0,0 +1,26 @@
// =================================================================================
// 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"
)
// Chapters is the golang structure of table chapters for DAO operations like Where/Data.
type Chapters struct {
g.Meta `orm:"table:chapters, do:true"`
Id interface{} // 章节ID
BookId interface{} // 小说ID
Title interface{} // 章节标题
Content interface{} // 章节内容
WordCount interface{} // 章节字数
Sort interface{} // 排序序号
IsLocked interface{} // 是否锁定0=免费1=需积分解锁
RequiredScore interface{} // 解锁该章节所需积分
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -0,0 +1,21 @@
// =================================================================================
// 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"
)
// Feedbacks is the golang structure of table feedbacks for DAO operations like Where/Data.
type Feedbacks struct {
g.Meta `orm:"table:feedbacks, do:true"`
Id interface{} // 反馈ID
UserId interface{} // 用户ID
Content interface{} // 反馈内容
Status interface{} // 处理状态1=未处理2=处理中3=已处理
CreatedAt *gtime.Time // 反馈时间
UpdatedAt *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"
)
// 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"`
Id interface{} // 记录ID
UserId interface{} // 用户ID
BookId interface{} // 小说ID
ChapterId interface{} // 章节ID
ReadAt *gtime.Time // 阅读时间
}

21
internal/model/do/tags.go Normal file
View File

@ -0,0 +1,21 @@
// =================================================================================
// 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"
)
// Tags is the golang structure of table tags for DAO operations like Where/Data.
type Tags struct {
g.Meta `orm:"table:tags, do:true"`
Id interface{} // 标签ID
Name interface{} // 标签名称
Type interface{} // 标签类型1=主题, 2=角色, 3=情节
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -0,0 +1,21 @@
// =================================================================================
// 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"
)
// UserChapterPurchases is the golang structure of table user_chapter_purchases for DAO operations like Where/Data.
type UserChapterPurchases struct {
g.Meta `orm:"table:user_chapter_purchases, do:true"`
Id interface{} // 购买记录ID
UserId interface{} // 用户ID
BookId interface{} // 小说ID
ChapterId interface{} // 章节ID
PointsUsed interface{} // 消耗积分数
PurchaseTime *gtime.Time // 购买时间
}

View File

@ -0,0 +1,19 @@
// =================================================================================
// 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"
)
// UserFollowAuthors is the golang structure of table user_follow_authors for DAO operations like Where/Data.
type UserFollowAuthors struct {
g.Meta `orm:"table:user_follow_authors, do:true"`
Id interface{} // 关注ID
UserId interface{} // 用户ID
AuthorId interface{} // 作者ID
FollowedAt *gtime.Time // 关注时间
}

View File

@ -0,0 +1,19 @@
// =================================================================================
// 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"
)
// UserPoints is the golang structure of table user_points for DAO operations like Where/Data.
type UserPoints struct {
g.Meta `orm:"table:user_points, do:true"`
Id interface{} // 积分账户ID
UserId interface{} // 用户ID
PointsBalance interface{} // 当前积分余额
UpdatedAt *gtime.Time // 更新时间
}

View File

@ -0,0 +1,22 @@
// =================================================================================
// 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"
)
// UserPointsLogs is the golang structure of table user_points_logs for DAO operations like Where/Data.
type UserPointsLogs struct {
g.Meta `orm:"table:user_points_logs, do:true"`
Id interface{} // 积分流水ID
UserId interface{} // 用户ID
ChangeType interface{} // 变动类型,例如 earn、spend、refund 等
PointsChange interface{} // 积分变化数,正数增加,负数减少
RelatedOrderId interface{} // 关联订单ID
Description interface{} // 变动说明
CreatedAt *gtime.Time // 变动时间
}

View File

@ -0,0 +1,24 @@
// =================================================================================
// 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"
)
// Users is the golang structure of table users for DAO operations like Where/Data.
type Users struct {
g.Meta `orm:"table:users, do:true"`
Id interface{} // 用户ID
Username interface{} // 用户名
PasswordHash interface{} // 密码哈希
Avatar interface{} // 头像URL
Email interface{} // 邮箱
Points interface{} // 积分
CreatedAt *gtime.Time // 注册时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -0,0 +1,19 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Admins is the golang structure for table admins.
type Admins struct {
Id int64 `json:"id" orm:"id" description:"管理员ID"` // 管理员ID
Username string `json:"username" orm:"username" description:"管理员用户名"` // 管理员用户名
PasswordHash string `json:"passwordHash" orm:"password_hash" 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:"软删除时间戳"` // 软删除时间戳
}

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"
)
// Authors is the golang structure for table authors.
type Authors struct {
Id int64 `json:"id" orm:"id" description:"作者ID"` // 作者ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
PenName string `json:"penName" orm:"pen_name" description:"笔名"` // 笔名
Bio string `json:"bio" orm:"bio" description:"作者简介"` // 作者简介
Status int `json:"status" orm:"status" 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:"软删除时间戳"` // 软删除时间戳
}

View File

@ -0,0 +1,19 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// BookRatings is the golang structure for table book_ratings.
type BookRatings 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
Score float64 `json:"score" orm:"score" description:"评分0~10"` // 评分0~10
Comment string `json:"comment" orm:"comment" description:"用户评论"` // 用户评论
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
}

View File

@ -0,0 +1,30 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// 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=是
}

View File

@ -0,0 +1,20 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// 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:"最后阅读时间"` // 最后阅读时间
}

View File

@ -0,0 +1,19 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// 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:"软删除时间戳"` // 软删除时间戳
}

View File

@ -0,0 +1,24 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Chapters is the golang structure for table chapters.
type Chapters struct {
Id int64 `json:"id" orm:"id" description:"章节ID"` // 章节ID
BookId int64 `json:"bookId" orm:"book_id" description:"小说ID"` // 小说ID
Title string `json:"title" orm:"title" description:"章节标题"` // 章节标题
Content string `json:"content" orm:"content" description:"章节内容"` // 章节内容
WordCount int `json:"wordCount" orm:"word_count" description:"章节字数"` // 章节字数
Sort int `json:"sort" orm:"sort" description:"排序序号"` // 排序序号
IsLocked int `json:"isLocked" orm:"is_locked" description:"是否锁定0=免费1=需积分解锁"` // 是否锁定0=免费1=需积分解锁
RequiredScore int `json:"requiredScore" orm:"required_score" 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:"软删除时间戳"` // 软删除时间戳
}

View File

@ -0,0 +1,19 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Feedbacks is the golang structure for table feedbacks.
type Feedbacks struct {
Id int64 `json:"id" orm:"id" description:"反馈ID"` // 反馈ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
Content string `json:"content" orm:"content" description:"反馈内容"` // 反馈内容
Status int `json:"status" orm:"status" description:"处理状态1=未处理2=处理中3=已处理"` // 处理状态1=未处理2=处理中3=已处理
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"反馈时间"` // 反馈时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
}

View File

@ -0,0 +1,18 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
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:"阅读时间"` // 阅读时间
}

View File

@ -0,0 +1,19 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Tags is the golang structure for table tags.
type Tags 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=角色, 3=情节"` // 标签类型1=主题, 2=角色, 3=情节
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:"软删除时间戳"` // 软删除时间戳
}

View File

@ -0,0 +1,19 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// UserChapterPurchases is the golang structure for table user_chapter_purchases.
type UserChapterPurchases 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
PointsUsed int `json:"pointsUsed" orm:"points_used" description:"消耗积分数"` // 消耗积分数
PurchaseTime *gtime.Time `json:"purchaseTime" orm:"purchase_time" description:"购买时间"` // 购买时间
}

View File

@ -0,0 +1,17 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// UserFollowAuthors is the golang structure for table user_follow_authors.
type UserFollowAuthors struct {
Id int64 `json:"id" orm:"id" description:"关注ID"` // 关注ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
AuthorId int64 `json:"authorId" orm:"author_id" description:"作者ID"` // 作者ID
FollowedAt *gtime.Time `json:"followedAt" orm:"followed_at" description:"关注时间"` // 关注时间
}

View File

@ -0,0 +1,17 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// UserPoints is the golang structure for table user_points.
type UserPoints struct {
Id int64 `json:"id" orm:"id" description:"积分账户ID"` // 积分账户ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
PointsBalance int `json:"pointsBalance" orm:"points_balance" description:"当前积分余额"` // 当前积分余额
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
}

View File

@ -0,0 +1,20 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// 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:"变动时间"` // 变动时间
}

View File

@ -0,0 +1,22 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Users is the golang structure for table users.
type Users struct {
Id int64 `json:"id" orm:"id" description:"用户ID"` // 用户ID
Username string `json:"username" orm:"username" description:"用户名"` // 用户名
PasswordHash string `json:"passwordHash" orm:"password_hash" description:"密码哈希"` // 密码哈希
Avatar string `json:"avatar" orm:"avatar" description:"头像URL"` // 头像URL
Email string `json:"email" orm:"email" description:"邮箱"` // 邮箱
Points uint64 `json:"points" orm:"points" 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:"软删除时间戳"` // 软删除时间戳
}

View File

@ -0,0 +1,30 @@
package model
import "github.com/gogf/gf/v2/frame/g"
type Feedback struct {
g.Meta `orm:"table:feedbacks"`
Id int64 `json:"id"`
UserId int64 `json:"userId"`
Content string `json:"content"`
Status int `json:"status"`
}
type FeedbackListIn struct {
Page int
Size int
UserId int64
Status int
}
type FeedbackListOut struct {
Total int
List []Feedback
}
type FeedbackAddIn struct {
UserId int64
Content string
}
type FeedbackCRUDOut struct {
Success bool
}

View File

@ -0,0 +1,36 @@
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
}

38
internal/model/tag.go Normal file
View File

@ -0,0 +1,38 @@
package model
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=情节
}
type TagListIn struct {
Page int
Size int
Name string
Type int
}
type TagListOut struct {
Total int
List []Tag
}
type TagAddIn struct {
Name string
Type int
}
type TagEditIn struct {
Id int64
Name string
Type int
}
type TagDelIn struct {
Id int64
}
type TagCRUDOut struct {
Success bool
}

47
internal/model/upload.go Normal file
View File

@ -0,0 +1,47 @@
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
}

71
internal/model/user.go Normal file
View File

@ -0,0 +1,71 @@
package model
type UserLoginIn struct {
Email string // 用户名
Password string // 密码
}
type UserLoginOut struct {
Token string // 登录令牌
}
type UserRegisterIn struct {
Email string // 用户名
Password string // 密码
Password2 string // 邮箱
}
type UserRegisterOut struct {
Success bool // 是否成功
}
type UserInfoIn struct {
UserId int64 // 用户ID
}
type UserInfoOut struct {
UserId int64 // 用户ID
Username string // 用户名
Email string // 邮箱
Points uint64 // 积分
Avatar string // 头像
}
type UserDeleteIn struct {
UserId int64 // 用户ID
Password string // 密码
}
type UserDeleteOut struct {
Success bool // 是否成功
}
type UserCodeIn struct {
Email string // 邮箱
}
type UserCodeOut struct {
Success bool // 是否成功
}
type UserEditPassIn struct {
Email string
Password string
Password2 string
Sign string
}
type UserEditPassOut struct {
Success bool // 是否成功
}
type VertifyCodeIn struct {
Email string
Code string
}
type VertifyCodeOut struct {
Sign string
}
type UserInfoAPI struct {
}

View File

@ -0,0 +1,33 @@
package model
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"`
}
type UserFollowAuthorListIn struct {
Page int
Size int
UserId int64
AuthorId int64
}
type UserFollowAuthorListOut struct {
Total int
List []UserFollowAuthor
}
type UserFollowAuthorAddIn struct {
UserId int64
AuthorId int64
}
type UserFollowAuthorDelIn struct {
Id int64
}
type UserFollowAuthorCRUDOut struct {
Success bool
}