39 lines
928 B
Go
39 lines
928 B
Go
package model
|
||
|
||
import (
|
||
"admin/internal/db"
|
||
"gorm.io/gorm"
|
||
"time"
|
||
)
|
||
|
||
func init() {
|
||
db.RegisterTableModels(Ban{})
|
||
}
|
||
|
||
type Ban struct {
|
||
ID int `gorm:"primarykey" readonly:"true"`
|
||
ProjectId string `gorm:"type:varchar(255);uniqueIndex:idx_ban"`
|
||
BanType string `name:"封禁类型" required:"true" choices:"GetBanTypeChoices" multi_choice:"true"`
|
||
Value string `gorm:"type:varchar(128);uniqueIndex:idx_ban" name:"封禁账号" required:"true" desc:"填账号"`
|
||
ExpireSeconds int `name:"封禁秒数" desc:"封禁到期秒数,为0表示永久封禁"`
|
||
|
||
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
|
||
}
|
||
|
||
func (m *Ban) GetBanTypeChoices() []string {
|
||
return []string{
|
||
"作弊",
|
||
"广告",
|
||
}
|
||
}
|