40 lines
1.0 KiB
Go
Raw Normal View History

2025-04-24 20:39:31 +08:00
package model
import (
"admin/internal/db"
"gorm.io/gorm"
"time"
)
func init() {
db.RegisterTableModels(Ban{})
}
type Ban struct {
2025-04-26 13:50:26 +08:00
ID int `gorm:"primarykey" readonly:"true"`
ProjectId string `gorm:"type:varchar(255);uniqueIndex:idx_ban"`
ServerConfID string `gorm:"type:varchar(200);uniqueIndex:idx_server" required:"true"`
BanType string `name:"封禁类型" required:"true" choices:"GetBanTypeChoices" multi_choice:"true"`
Value string `gorm:"type:varchar(128);uniqueIndex:idx_ban" name:"封禁账号" required:"true" desc:"填账号"`
ExpireAt int64 `name:"封禁到期时间" desc:"封禁到期时间0表示永久封禁"`
2025-04-24 20:39:31 +08:00
CreatedAt time.Time `readonly:"true"`
UpdatedAt time.Time `readonly:"true"`
DeletedAt gorm.DeletedAt `gorm:"index" readonly:"true"`
}
func (lm *Ban) TableName() string {
return "ban"
}
func (m *Ban) GetId() int {
return m.ID
}
2025-04-26 13:50:26 +08:00
func (m *Ban) GetBanTypeChoices(projectId string) []string {
2025-04-24 20:39:31 +08:00
return []string{
"作弊",
"广告",
}
}