uniugm/admin/apps/game/model/notice.go

46 lines
1.5 KiB
Go
Raw Normal View History

2025-04-24 20:39:31 +08:00
package model
import (
"admin/internal/db"
2025-05-16 15:17:10 +08:00
"admin/internal/model/dto"
2025-04-24 20:39:31 +08:00
"time"
)
func init() {
db.RegisterTableModels(Notice{})
}
type Notice struct {
2025-06-06 18:30:12 +08:00
ID int `gorm:"primarykey" readonly:"true"`
ProjectId int `gorm:"index:idx_project_id"`
//ServerIDs []string `gorm:"type:json;serializer:json" name:"公告生效服务器" desc:"为空表示所有服" choices:"GetChoiceServers"`
Mod string `name:"公告分栏标题" desc:"显示到公告弹窗左边的分栏标题" required:"true"` // 左边分栏标题
Title string `name:"公告标题" desc:"显示到公告内容区里的标题" required:"true"` // 公告内容上面的标题
Content string `name:"公告内容" desc:"仅支持<color=#xxx></color>颜色标签和\\n换行标签" type:"text" required:"true"` // 公告内容
//StartAt time.Time `name:"开始时间" required:"true"`
//EndAt time.Time `name:"结束时间" required:"true"`
Status bool `name:"是否启用" type:"tagStatus" choices:"GetStatusChoices" required:"true"`
2025-04-24 20:39:31 +08:00
2025-04-28 15:56:04 +08:00
CreatedAt time.Time `readonly:"true"`
2025-05-15 17:30:33 +08:00
UpdatedAt time.Time `readonly:"true"`
2025-04-24 20:39:31 +08:00
}
func (lm *Notice) TableName() string {
return "notice"
}
func (m *Notice) GetId() int {
return m.ID
}
2025-04-30 15:46:14 +08:00
func (m *Notice) GetChoiceServers(project *Project) []*dto.CommonDtoFieldChoice {
return getChoiceServers(project)
2025-04-24 20:39:31 +08:00
}
2025-06-06 18:30:12 +08:00
func (m *Notice) GetStatusChoices(project *Project) []*dto.CommonDtoFieldChoice {
return []*dto.CommonDtoFieldChoice{
{Desc: "禁用", Value: false},
{Desc: "启动", Value: true},
}
}