29 lines
1.8 KiB
Go
29 lines
1.8 KiB
Go
|
|
package model
|
|||
|
|
|
|||
|
|
import "time"
|
|||
|
|
|
|||
|
|
// Chapter 对应表 chapters(mid 为自增主键,id 保留业务标识如 1.1、preface)
|
|||
|
|
type Chapter struct {
|
|||
|
|
MID int `gorm:"column:mid;primaryKey;autoIncrement" json:"mid"`
|
|||
|
|
ID string `gorm:"column:id;size:20;uniqueIndex" json:"id"`
|
|||
|
|
PartID string `gorm:"column:part_id;size:20" json:"partId"`
|
|||
|
|
PartTitle string `gorm:"column:part_title;size:100" json:"partTitle"`
|
|||
|
|
ChapterID string `gorm:"column:chapter_id;size:20" json:"chapterId"`
|
|||
|
|
ChapterTitle string `gorm:"column:chapter_title;size:200" json:"chapterTitle"`
|
|||
|
|
SectionTitle string `gorm:"column:section_title;size:200" json:"sectionTitle"`
|
|||
|
|
Content string `gorm:"column:content;type:longtext" json:"content,omitempty"`
|
|||
|
|
WordCount *int `gorm:"column:word_count" json:"wordCount,omitempty"`
|
|||
|
|
IsFree *bool `gorm:"column:is_free" json:"isFree,omitempty"`
|
|||
|
|
Price *float64 `gorm:"column:price;type:decimal(10,2)" json:"price,omitempty"`
|
|||
|
|
SortOrder *int `gorm:"column:sort_order" json:"sortOrder,omitempty"`
|
|||
|
|
Status *string `gorm:"column:status;size:20" json:"status,omitempty"`
|
|||
|
|
IsNew *bool `gorm:"column:is_new" json:"isNew,omitempty"` // stitch_soul:目录/首页「最新新增」标记
|
|||
|
|
// 普通版/增值版:两者分开互斥,添加文章时勾选归属
|
|||
|
|
EditionStandard *bool `gorm:"column:edition_standard" json:"editionStandard,omitempty"` // 是否属于普通版
|
|||
|
|
EditionPremium *bool `gorm:"column:edition_premium" json:"editionPremium,omitempty"` // 是否属于增值版
|
|||
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|||
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (Chapter) TableName() string { return "chapters" }
|