43 lines
2.0 KiB
Go
43 lines
2.0 KiB
Go
|
|
/**
|
|||
|
|
* @Author: david.yan@qq.com
|
|||
|
|
* @Date: 2021-11-29 15:16:26
|
|||
|
|
* @LastEditors: david.yan@qq.com
|
|||
|
|
* @LastEditTime: 2021-12-08 15:59:00
|
|||
|
|
* @FilePath: /src/git.buka.tv/Cms/internal/models/post.go
|
|||
|
|
*/
|
|||
|
|
package models
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"git.apinb.com/bsm-sdk/core/database"
|
|||
|
|
"git.apinb.com/bsm-sdk/core/types"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// CmsPost 单页文章
|
|||
|
|
type CmsPages struct {
|
|||
|
|
types.Std_IICUDS
|
|||
|
|
SiteIdentity string `gorm:"column:site_identity;type:varchar(36);index;" json:"site_identity"`
|
|||
|
|
|
|||
|
|
Title string `gorm:"column:title;type:varchar(255);default:'';" json:"title"` // 标题
|
|||
|
|
Key string `gorm:"column:key;type:varchar(255);uniqueIndex;" json:"key"` // 内容KEY,唯一,无空格
|
|||
|
|
Description string `gorm:"column:description;type:varchar(255);default:'';" json:"description"` // 描述
|
|||
|
|
CoverPath string `gorm:"column:cover_path;type:varchar(255);default:'';" json:"cover_path"` // 封面
|
|||
|
|
Content string `gorm:"column:content;type:text;default:'';" json:"content"` // 内容
|
|||
|
|
HasAccessory bool `gorm:"column:has_accessory;type:bool;default:false" json:"has_accessory"` // 是否有附件
|
|||
|
|
Type int32 `gorm:"column:type;default:0" json:"type"` // 类型
|
|||
|
|
Hits int64 `gorm:"column:hits;default:0" json:"hits"` // 点击量
|
|||
|
|
|
|||
|
|
AccessoryIdentityArray []string `gorm:"-" json:"accessory_identity_array"` // 附件标识
|
|||
|
|
Accessories []*CmsAccessory `gorm:"foreignkey:PagesIdentity ;references:Identity"` // 附件
|
|||
|
|
Tags []*CmsRelateTags `gorm:"foreignkey:PagesIdentity;references:Identity"` // 标签
|
|||
|
|
TagsIdentityArray []string `gorm:"-" json:"tags_identity_array"` // 标签标识
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func init() {
|
|||
|
|
database.MigrateTables = append(database.MigrateTables, &CmsPages{})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// TableName .CmsPages 单页文章表
|
|||
|
|
func (table *CmsPages) TableName() string {
|
|||
|
|
return "cms_pages" // 对应数据库表名
|
|||
|
|
}
|