完善功能
This commit is contained in:
@ -20,44 +20,48 @@ type BooksDao struct {
|
||||
|
||||
// BooksColumns defines and stores column names for the table books.
|
||||
type BooksColumns struct {
|
||||
Id string // 小说ID
|
||||
AuthorId string // 作者ID
|
||||
CategoryId string // 分类ID
|
||||
Title string // 小说标题
|
||||
CoverUrl string // 封面图片URL
|
||||
Description string // 小说简介
|
||||
Status string // 状态:1=连载中,2=完结,3=下架
|
||||
WordsCount string // 字数
|
||||
ChaptersCount string // 章节数
|
||||
LatestChapterId string // 最新章节ID
|
||||
Rating string // 评分(0.00~10.00)
|
||||
ReadCount string // 阅读人数
|
||||
Tags string // 标签(逗号分隔)
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
IsRecommended string // 是否推荐:0=否,1=是
|
||||
Id string // 小说ID
|
||||
AuthorId string // 作者ID
|
||||
CategoryId string // 分类ID
|
||||
Title string // 小说标题
|
||||
CoverUrl string // 封面图片URL
|
||||
Description string // 小说简介
|
||||
Status string // 状态:1=连载中,2=完结,3=下架
|
||||
WordsCount string // 字数
|
||||
ChaptersCount string // 章节数
|
||||
Rating string // 评分(0.00~10.00)
|
||||
ReadCount string // 阅读人数
|
||||
CurrentReaders string // 在读人数
|
||||
Tags string // 标签(逗号分隔)
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
IsRecommended string // 是否推荐:0=否,1=是
|
||||
IsFeatured string // 是否精选:0=否,1=是
|
||||
Language string // 语言,如 zh=中文,en=英文,jp=日文
|
||||
}
|
||||
|
||||
// booksColumns holds the columns for the table books.
|
||||
var booksColumns = BooksColumns{
|
||||
Id: "id",
|
||||
AuthorId: "author_id",
|
||||
CategoryId: "category_id",
|
||||
Title: "title",
|
||||
CoverUrl: "cover_url",
|
||||
Description: "description",
|
||||
Status: "status",
|
||||
WordsCount: "words_count",
|
||||
ChaptersCount: "chapters_count",
|
||||
LatestChapterId: "latest_chapter_id",
|
||||
Rating: "rating",
|
||||
ReadCount: "read_count",
|
||||
Tags: "tags",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
IsRecommended: "is_recommended",
|
||||
Id: "id",
|
||||
AuthorId: "author_id",
|
||||
CategoryId: "category_id",
|
||||
Title: "title",
|
||||
CoverUrl: "cover_url",
|
||||
Description: "description",
|
||||
Status: "status",
|
||||
WordsCount: "words_count",
|
||||
ChaptersCount: "chapters_count",
|
||||
Rating: "rating",
|
||||
ReadCount: "read_count",
|
||||
CurrentReaders: "current_readers",
|
||||
Tags: "tags",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
IsRecommended: "is_recommended",
|
||||
IsFeatured: "is_featured",
|
||||
Language: "language",
|
||||
}
|
||||
|
||||
// NewBooksDao creates and returns a new DAO object for table data access.
|
||||
|
||||
@ -27,6 +27,7 @@ type BookshelvesColumns struct {
|
||||
LastReadChapterId string // 最后阅读章节ID
|
||||
LastReadPercent string // 阅读进度百分比(0.00~100.00)
|
||||
LastReadAt string // 最后阅读时间
|
||||
ReadStatus string // 阅读状态:1=正在读,2=已读完,3=已收藏
|
||||
}
|
||||
|
||||
// bookshelvesColumns holds the columns for the table bookshelves.
|
||||
@ -38,6 +39,7 @@ var bookshelvesColumns = BookshelvesColumns{
|
||||
LastReadChapterId: "last_read_chapter_id",
|
||||
LastReadPercent: "last_read_percent",
|
||||
LastReadAt: "last_read_at",
|
||||
ReadStatus: "read_status",
|
||||
}
|
||||
|
||||
// NewBookshelvesDao creates and returns a new DAO object for table data access.
|
||||
|
||||
@ -22,20 +22,20 @@ type CategoriesDao struct {
|
||||
type CategoriesColumns struct {
|
||||
Id string // 分类ID
|
||||
Name string // 分类名称
|
||||
Type string // 分类类型:1=男频, 2=女频
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
Channel string // 频道类型:1=男频,2=女频
|
||||
}
|
||||
|
||||
// categoriesColumns holds the columns for the table categories.
|
||||
var categoriesColumns = CategoriesColumns{
|
||||
Id: "id",
|
||||
Name: "name",
|
||||
Type: "type",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
Channel: "channel",
|
||||
}
|
||||
|
||||
// NewCategoriesDao creates and returns a new DAO object for table data access.
|
||||
|
||||
@ -22,9 +22,9 @@ type UserPointsLogsDao struct {
|
||||
type UserPointsLogsColumns struct {
|
||||
Id string // 积分流水ID
|
||||
UserId string // 用户ID
|
||||
ChangeType string // 变动类型,例如 earn、spend、refund 等
|
||||
ChangeType string // 变动类型,1=消费(spend), 2=收入(earn)
|
||||
PointsChange string // 积分变化数,正数增加,负数减少
|
||||
RelatedOrderId string // 关联订单ID
|
||||
RelatedOrderId string // 关联ID:当change_type=1时,为chapter_purchases.id;当change_type=2时,为advertisement_records.id
|
||||
Description string // 变动说明
|
||||
CreatedAt string // 变动时间
|
||||
}
|
||||
|
||||
81
internal/dao/internal/user_read_history.go
Normal file
81
internal/dao/internal/user_read_history.go
Normal file
@ -0,0 +1,81 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// UserReadHistoryDao is the data access object for the table user_read_history.
|
||||
type UserReadHistoryDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserReadHistoryColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// UserReadHistoryColumns defines and stores column names for the table user_read_history.
|
||||
type UserReadHistoryColumns struct {
|
||||
Id string // 历史记录ID
|
||||
UserId string // 用户ID
|
||||
BookId string // 小说ID
|
||||
ChapterId string // 最后阅读章节ID
|
||||
ReadAt string // 最后阅读时间
|
||||
}
|
||||
|
||||
// userReadHistoryColumns holds the columns for the table user_read_history.
|
||||
var userReadHistoryColumns = UserReadHistoryColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
BookId: "book_id",
|
||||
ChapterId: "chapter_id",
|
||||
ReadAt: "read_at",
|
||||
}
|
||||
|
||||
// NewUserReadHistoryDao creates and returns a new DAO object for table data access.
|
||||
func NewUserReadHistoryDao() *UserReadHistoryDao {
|
||||
return &UserReadHistoryDao{
|
||||
group: "default",
|
||||
table: "user_read_history",
|
||||
columns: userReadHistoryColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *UserReadHistoryDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *UserReadHistoryDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *UserReadHistoryDao) Columns() UserReadHistoryColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *UserReadHistoryDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UserReadHistoryDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *UserReadHistoryDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@ -11,62 +11,68 @@ import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ReadRecordsDao is the data access object for the table read_records.
|
||||
type ReadRecordsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns ReadRecordsColumns // columns contains all the column names of Table for convenient usage.
|
||||
// UserReadRecordsDao is the data access object for the table user_read_records.
|
||||
type UserReadRecordsDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserReadRecordsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// ReadRecordsColumns defines and stores column names for the table read_records.
|
||||
type ReadRecordsColumns struct {
|
||||
// UserReadRecordsColumns defines and stores column names for the table user_read_records.
|
||||
type UserReadRecordsColumns struct {
|
||||
Id string // 记录ID
|
||||
UserId string // 用户ID
|
||||
BookId string // 小说ID
|
||||
ChapterId string // 章节ID
|
||||
Progress string // 阅读进度百分比(0-100)
|
||||
ReadAt string // 阅读时间
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// readRecordsColumns holds the columns for the table read_records.
|
||||
var readRecordsColumns = ReadRecordsColumns{
|
||||
// userReadRecordsColumns holds the columns for the table user_read_records.
|
||||
var userReadRecordsColumns = UserReadRecordsColumns{
|
||||
Id: "id",
|
||||
UserId: "user_id",
|
||||
BookId: "book_id",
|
||||
ChapterId: "chapter_id",
|
||||
Progress: "progress",
|
||||
ReadAt: "read_at",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewReadRecordsDao creates and returns a new DAO object for table data access.
|
||||
func NewReadRecordsDao() *ReadRecordsDao {
|
||||
return &ReadRecordsDao{
|
||||
// NewUserReadRecordsDao creates and returns a new DAO object for table data access.
|
||||
func NewUserReadRecordsDao() *UserReadRecordsDao {
|
||||
return &UserReadRecordsDao{
|
||||
group: "default",
|
||||
table: "read_records",
|
||||
columns: readRecordsColumns,
|
||||
table: "user_read_records",
|
||||
columns: userReadRecordsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *ReadRecordsDao) DB() gdb.DB {
|
||||
func (dao *UserReadRecordsDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *ReadRecordsDao) Table() string {
|
||||
func (dao *UserReadRecordsDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *ReadRecordsDao) Columns() ReadRecordsColumns {
|
||||
func (dao *UserReadRecordsDao) Columns() UserReadRecordsColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *ReadRecordsDao) Group() string {
|
||||
func (dao *UserReadRecordsDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *ReadRecordsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
func (dao *UserReadRecordsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
@ -76,6 +82,6 @@ func (dao *ReadRecordsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *ReadRecordsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
func (dao *UserReadRecordsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalReadRecordsDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalReadRecordsDao = *internal.ReadRecordsDao
|
||||
|
||||
// readRecordsDao is the data access object for the table read_records.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type readRecordsDao struct {
|
||||
internalReadRecordsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// ReadRecords is a globally accessible object for table read_records operations.
|
||||
ReadRecords = readRecordsDao{
|
||||
internal.NewReadRecordsDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/user_read_history.go
Normal file
27
internal/dao/user_read_history.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalUserReadHistoryDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalUserReadHistoryDao = *internal.UserReadHistoryDao
|
||||
|
||||
// userReadHistoryDao is the data access object for the table user_read_history.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type userReadHistoryDao struct {
|
||||
internalUserReadHistoryDao
|
||||
}
|
||||
|
||||
var (
|
||||
// UserReadHistory is a globally accessible object for table user_read_history operations.
|
||||
UserReadHistory = userReadHistoryDao{
|
||||
internal.NewUserReadHistoryDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
27
internal/dao/user_read_records.go
Normal file
27
internal/dao/user_read_records.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"server/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalUserReadRecordsDao is an internal type for wrapping the internal DAO implementation.
|
||||
type internalUserReadRecordsDao = *internal.UserReadRecordsDao
|
||||
|
||||
// userReadRecordsDao is the data access object for the table user_read_records.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type userReadRecordsDao struct {
|
||||
internalUserReadRecordsDao
|
||||
}
|
||||
|
||||
var (
|
||||
// UserReadRecords is a globally accessible object for table user_read_records operations.
|
||||
UserReadRecords = userReadRecordsDao{
|
||||
internal.NewUserReadRecordsDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
Reference in New Issue
Block a user