Files
hfb_jysh/backend/internal/model/announcement.go
T

36 lines
1.6 KiB
Go

package model
import "time"
// 公告中心来源模式(distribution_sites.announcement_mode):
// - inherit:分站展示主站公告 + 本站公告(默认)
// - own_only:分站只展示本站公告
const (
AnnouncementModeInherit = "inherit"
AnnouncementModeOwnOnly = "own_only"
)
type Announcement struct {
ID uint64 `gorm:"primaryKey" json:"id"`
// DistributionSiteID 公告归属站点:0=主站,>0=对应分站(分站公告中心按站点隔离)。
DistributionSiteID uint64 `gorm:"not null;default:0;index" json:"distribution_site_id"`
Title string `gorm:"size:255;not null" json:"title"`
Content string `gorm:"type:text;not null" json:"content"`
Category string `gorm:"size:32;not null;default:'notice'" json:"category"`
Priority int `gorm:"not null;default:0" json:"priority"`
IsPinned bool `gorm:"not null;default:false" json:"is_pinned"`
IsImportant bool `gorm:"not null;default:false" json:"is_important"`
// IsPopup 标记弹窗公告:前台首页弹出且需用户手动关闭,多条生效时只弹优先级最高的一条。
IsPopup bool `gorm:"not null;default:false" json:"is_popup"`
ViewCount int `gorm:"not null;default:0" json:"view_count"`
Status string `gorm:"size:32;not null;default:'draft'" json:"status"`
PublishedAt *time.Time `json:"published_at"`
CreatedBy *uint64 `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (Announcement) TableName() string {
return "announcements"
}