xbook

package
v0.1.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2023 License: BSD-3-Clause-Clear Imports: 4 Imported by: 0

Documentation

Overview

书籍模组 其中的书籍查找功能请自行连接数据库编写,此模组暂不提供书籍查找功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create added in v0.1.23

func Create(c *Book) error

创建书籍信息

c	书籍的结构信息

func CreateMenu added in v0.1.23

func CreateMenu(c *BookChapter, cn *BookContent) error

创建章节信息

c	章节信息
cn	内容信息(该项的ID字段会直接进行覆盖)

func Regedit

func Regedit(c *Config)

入口配置

Types

type Book added in v0.1.23

type Book struct {
	Id          uint   `gorm:"column:id;type:int unsigned;primaryKey;autoIncrement;not null" form:"id" json:"id"`
	UserId      uint   `gorm:"column:user_id;type:INT UNSIGNED;index:user_id;comment:创建人" json:"user_id" form:"user_id"`  // 创建人ID
	Title       string `gorm:"column:title;type:varchar(200);comment:书籍标题" form:"title" json:"title"`                     //书籍标题
	Desc        string `gorm:"column:desc;type:varchar(500);comment:书籍简单描述" form:"desc" json:"desc"`                      //书籍简单描述
	Content     string `gorm:"column:content;type:text;comment:书籍简介" form:"content" json:"content"`                       //书籍简介
	Thumb       uint   `gorm:"column:thumb;type:int unsigned;comment:书籍封面图片(图片ID)" form:"thumb" json:"thumb"`             //书籍封面图片(图片ID)
	Author      string `gorm:"column:author;type:varchar(100);comment:书籍作者" form:"author" json:"author"`                  //书籍作者
	Ids         string `gorm:"column:ids;type:varchar(200);comment:书籍出版IDS编号" form:"ids" json:"ids"`                      //书籍出版IDS编号
	PublishDate string `gorm:"column:publish_date;type:date;comment:出版日期" form:"publish_date" json:"publish_date"`        //出版日期
	PublishShop string `gorm:"column:publish_shop;type:varchar(100);comment:出版商" form:"publish_shop" json:"publish_shop"` //出版商
	AuditStatus uint8  ``                                                                                                 // 审核状态 0-未审核 98-审核拒绝 99-审核通过 97-放弃审核(编辑以后再次编辑时,会将之前的编辑文章调整为放弃审核状态)
	/* 274-byte string literal not displayed */
	IsDeleted uint8  `gorm:"column:is_deleted;type:tinyint unsigned;comment:是否删除" form:"-" json:"-"` //是否删除
	CreatedAt string `gorm:"column:created_at;type:datetime" form:"created_at" json:"created_at"`
	UpdatedAt string `gorm:"column:updated_at;type:datetime" form:"updated_at" json:"updated_at"`
}

书籍表,存储书籍简介等信息

func BookList added in v0.1.29

func BookList(keywords string, offset, limit int) (int64, []Book, error)

获取书籍列表信息

keywords	搜索关键词
offset		跳过条数
limit		查询条数

func (*Book) TableName added in v0.1.23

func (c *Book) TableName() string

返回所属表名信息

type BookChapter added in v0.1.23

type BookChapter struct {
	Id          uint   `gorm:"column:id;type:int unsigned;primaryKey;autoIncrement;not null" form:"id" json:"id"`
	BookId      uint   `gorm:"column:book_id;type:int unsigned;comment:书籍ID" form:"book_id" json:"book_id"` //书籍ID
	Title       string `gorm:"column:title;type:varchar(200);comment:章节标题" form:"title" json:"title"`       //章节标题
	Fid         uint   `gorm:"column:fid;type:int unsigned;comment:上级章节/册的ID" form:"fid" json:"fid"`        //上级章节/册的ID
	AuditStatus uint8  ``                                                                                   // 审核状态 0-未审核 98-审核拒绝 99-审核通过 97-放弃审核(编辑以后再次编辑时,会将之前的编辑文章调整为放弃审核状态)
	/* 255-byte string literal not displayed */
	CreatedAt string `gorm:"column:created_at;type:datetime" form:"created_at" json:"created_at"`
	UpdatedAt string `gorm:"column:updated_at;type:datetime" form:"updated_at" json:"updated_at"`
}

书籍章节内容表

func Menu(id uint) []BookChapter

获取书籍章节信息

id	书籍ID

func (*BookChapter) TableName added in v0.1.23

func (c *BookChapter) TableName() string

返回所属表名信息

type BookContent added in v0.1.23

type BookContent struct {
	Id         uint   `gorm:"column:id;type:int unsigned;primaryKey;not null" form:"id" json:"id"`
	Content    string `gorm:"column:content;type:mediumtext;comment:章节内容" form:"content" json:"content"`        //章节内容
	Translate  string `gorm:"column:translate;type:mediumtext;comment:译文" form:"translate" json:"translate"`    //译文
	Annotation string `gorm:"column:annotation;type:mediumtext;comment:批注" form:"annotation" json:"annotation"` //批注
}

书籍章节内容表

func (*BookContent) TableName added in v0.1.23

func (c *BookContent) TableName() string

返回所属表名信息

type Config

type Config struct {
	DB          *gorm.DB
	BooksName   string // 书籍所在数据表名称
	TitlesName  string // 书籍章节所在数据表名称
	ContentName string // 书籍内容所在数据表名称

	// 以下内容为函数挂载,用于后期数据量大了以后的功能扩展使用
	// 获取书籍列表函数
	FuncBookList func(keywords string, offset, limit int) (int64, []Book, error)
}

配置项信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL