xarticle

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: BSD-3-Clause-Clear Imports: 1 Imported by: 0

Documentation

Overview

文章模块

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Regedit

func Regedit(ac *ArticleConfig)

文章模块注册

ac	配置项信息

Types

type Article

type Article struct {
	Id           uint   `gorm:"column:id;primaryKey;type:INT UNSIGNED;not null;autoIncrement" json:"id" form:"id"`         // 文章ID
	Title        string `gorm:"column:title;type:varchar(200)" json:"title" form:"title"`                                  // 文章标题
	UserId       uint   `gorm:"column:user_id;type:INT UNSIGNED;not null" json:"user_id" form:"user_id"`                   // 创建人id
	GiveLikeNum  uint   `gorm:"column:give_like_num;type:INT UNSIGNED;not null" json:"give_like_num" form:"give_like_num"` // 点赞次数
	BrowseNum    uint   `gorm:"column:browse_num;type:INT UNSIGNED;not null" json:"browse_num" form:"browse_num"`          // 浏览次数
	CollectNum   uint   `gorm:"column:collect_num;type:INT UNSIGNED;not null" json:"collect_num" form:"collect_num"`       // 收藏次数
	ShareNum     uint   `gorm:"column:share_num;type:INT UNSIGNED;not null" json:"share_num" form:"share_num"`             // 分享量
	CommentNum   int    `gorm:"column:comment_num;type:INT UNSIGNED;not null" json:"comment_num" form:"comment_num"`       // 评论数量
	DonotComment uint8  `gorm:"do_not_comment;type:TINYINT UNSIGNED;not null" json:"do_not_comment" form:"do_not_comment"` // 是否禁止评论
	IsDelete     int8   `gorm:"column:is_delete;type:TINYINT UNSIGNED" json:"is_delete" form:"is_delete"`                  // 是否删除 1-删除 0-未删除
	CreatedAt    string `gorm:"column:created_at;type:datetime" json:"created_at" form:"created_at"`                       // 创建时间
	UpdatedAt    string `gorm:"column:updated_at;type:datetime" json:"updated_at" form:"updated_at"`                       // 更新时间
}

文章主表,用于展示文章的主要信息

func (*Article) TableName

func (c *Article) TableName() string

表名

type ArticleComment

type ArticleComment struct {
	Id        uint   `gorm:"column:id;primaryKey;type:INT UNSIGNED;not null;autoIncrement" json:"id" form:"id"` // 评论ID
	ArticleId uint   `gorm:"column:article_id;type:INT UNSIGNED;not null" json:"article_id" form:"article_id"`  // 文章ID
	CommentId uint   `gorm:"column:comment_id;type:INT UNSIGNED;not null" json:"comment_id" form:"comment_id"`  // 回复评论ID
	UserId    uint   `gorm:"column:user_id;type:INT UNSIGNED;not null" json:"user_id" form:"user_id"`           // 创建人id
	Content   string `gorm:"column:content;type:varchar(200)" json:"content" form:"content"`                    // 文章评论 200字内
	IsDelete  int8   `gorm:"column:is_delete;type:TINYINT UNSIGNED" json:"is_delete" form:"is_delete"`          // 是否删除 1-删除 0-未删除
	CreatedAt string `gorm:"column:created_at;type:datetime" json:"created_at" form:"created_at"`               // 创建时间
}

文章评论表

func (*ArticleComment) TableName

func (c *ArticleComment) TableName() string

表名

type ArticleConfig

type ArticleConfig struct {
	DB                      *gorm.DB // 数据库操作句柄
	ArticleName             string   // 文章主表表名
	ArticleContentName      string   // 文章内容表表名
	ArticleCommentName      string   // 文章评论表表名
	ArticleEditsName        string   // 文章内容修改表表名
	ArticleEditsContentName string   // 文章内容修改表(内容)表名
}

type ArticleContent

type ArticleContent struct {
	ArticleId uint   `gorm:"column:id;primaryKey;type:INT UNSIGNED;not null" json:"id" form:"id"` // 文章ID
	Content   string `gorm:"column:content;type:longtext" json:"content" form:"content"`          // 文章内容
}

文章详情表,用于存储文章的详情内容

func (*ArticleContent) TableName

func (c *ArticleContent) TableName() string

表名

type ArticleEdits

type ArticleEdits struct {
	Id          uint   `gorm:"column:id;primaryKey;type:INT UNSIGNED;not null;autoIncrement" json:"id" form:"id"`          // 文章ID
	Title       string `gorm:"column:title;type:varchar(200)" json:"title" form:"title"`                                   // 文章标题
	UserId      uint   `gorm:"column:user_id;type:INT UNSIGNED;not null" json:"user_id" form:"user_id"`                    // 创建人id
	AuditStatus uint8  `gorm:"column:audit_status;type:TINYINT UNSIGNED;not null" json:"audit_status" form:"audit_status"` // 审核状态 0-未审核 98-审核拒绝 99-审核通过
	AuditUserId uint   `gorm:"column:audit_user_id;type:INT UNSIGNED;not null" json:"audit_user_id" form:"audit_user_id"`  // 审核人id
	CreatedAt   string `gorm:"column:created_at;type:datetime" json:"created_at" form:"created_at"`                        // 创建时间
	UpdatedAt   string `gorm:"column:updated_at;type:datetime" json:"updated_at" form:"updated_at"`                        // 审核时间
}

文章编辑表,该表每次编辑都会重新生成一条记录

func (*ArticleEdits) TableName

func (c *ArticleEdits) TableName() string

表名

type ArticleEditsContent

type ArticleEditsContent struct {
	ArticleEditsId uint   `gorm:"column:id;primaryKey;type:INT UNSIGNED;not null" json:"id" form:"id"` // 文章编辑条目ID
	Content        string `gorm:"column:content;type:longtext" json:"content" form:"content"`          // 文章内容
}

文章编辑表对应的内容,审核通过后会将该内容替换到文章表中

func (*ArticleEditsContent) TableName

func (c *ArticleEditsContent) TableName() string

表名

Jump to

Keyboard shortcuts

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