在richcms现有的版本中,标签(tag)系统结构较为简单,不能把标签做为一个小专题来展示。以下是新标签系统的调整思路。
老的标签结构:
common/repository/model/tag.go
// Tag 标签
type Tag struct {
TagId int64 `gorm:"column:tag_id;primary_key" json:"tag_id"` //标签id
CateId int `gorm:"column:cate_id" json:"cate_id"` //标题所属的栏目,如果为0,表示不属于任何栏目
TagName string `gorm:"column:tag_name" json:"tag_name"` //名称
TagMatch string `gorm:"column:tag_match" json:"tag_match"` //匹配
Title string `gorm:"column:title" json:"title"` //seo
Keywords string `gorm:"column:keywords" json:"keywords"` //seo
Description string `gorm:"column:description" json:"description"` //seo
State enum.CommonState `gorm:"column:state" json:"state"` //状态
Updated int `gorm:"column:updated" json:"updated"` //更新时间
Created int `gorm:"column:created" json:"created"` //创建时间
CateName string `gorm:"-" json:"cate_name"` //栏目名称
Link string `gorm:"-" json:"-"` //链接地址
}
新的标签结构:
common/repository/model/tag.go
// Tag 标签
type Tag struct {
TagId int64 `gorm:"column:tag_id;size:20;primary_key" json:"tag_id"` //标签id
TagEName string `gorm:"column:tag_e_name;type:varchar(30)" json:"tag_e_name"` //英文名称
TagName string `gorm:"column:tag_name;type:varchar(30)" json:"tag_name"` //名称
ParentId int64 `gorm:"column:parent_id;size:20;default:0" json:"parent_id"` //父标签ID
RootId int64 `gorm:"column:root_id;size:20;default:0" json:"root_id"` //最上级ID
TagMatch string `gorm:"column:tag_match;type:varchar(30)" json:"tag_match"` //匹配
OrderId int `gorm:"column:order_id;size:11;default:0" json:"order_id"` //排序值
Photo string `gorm:"column:photo;type:varchar(300)" json:"photo"` //图片
TagType enum.TagType `gorm:"column:tag_type;size:4;default:0" json:"tag_type"` //标签类型
Title string `gorm:"column:title;type:varchar(300)" json:"title"` //seo
Keywords string `gorm:"column:keywords;type:varchar(300)" json:"keywords"` //seo
Description string `gorm:"column:description;type:varchar(300)" json:"description"` //seo
Content string `gorm:"column:content;type:varchar(8000)" json:"content"` //标签的内容文本
State enum.CommonState `gorm:"column:state;size:4;default:0" json:"state"` //状态
Updated int `gorm:"column:updated;size:11;default:0;" json:"updated"` //更新时间
Created int `gorm:"column:created;size:11;default:0" json:"created"` //创建时间
Link string `gorm:"-" json:"-"` //链接地址
}
新增加的结构包括有:图片、排序值(orderId)、TagEName(英文名)、Content(标签的长文本)。
这种结构有利于,对标签页面展开深入的说明,内容更丰富。特别适合做小专题。