uniugm/admin/apps/game/model/notice.go
2025-04-28 15:56:04 +08:00

35 lines
815 B
Go

package model
import (
"admin/apps/game/model/dto"
"admin/internal/db"
"time"
)
func init() {
db.RegisterTableModels(Notice{})
}
type Notice struct {
ID int `gorm:"primarykey" readonly:"true"`
ProjectId string
ServerIDs []int `gorm:"type:json;serializer:json" name:"公告生效服务器" desc:"为空表示所有服" choices:"GetChoiceServers"`
Content string `name:"公告内容" required:"true"`
StartAt time.Time `name:"开始时间" required:"true"`
EndAt time.Time `name:"结束时间" required:"true"`
CreatedAt time.Time `readonly:"true"`
}
func (lm *Notice) TableName() string {
return "notice"
}
func (m *Notice) GetId() int {
return m.ID
}
func (m *Notice) GetChoiceServers(args ...any) []*dto.CommonDtoFieldChoice {
return getChoiceServers(args[0].(string))
}