refactor: 重构服务器冠名逻辑至独立表
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
39
modules/config/model/server_show.go
Normal file
39
modules/config/model/server_show.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"time"
|
||||
)
|
||||
|
||||
const TableNameServerShow = "server_show"
|
||||
|
||||
// ServerShow 绑定服务器展示信息(冠名、属主、到期时间)。
|
||||
type ServerShow struct {
|
||||
*cool.Model
|
||||
ServerID uint32 `gorm:"column:server_id;comment:'服务器ID';uniqueIndex" json:"server_id"`
|
||||
Name string `gorm:"comment:'服务器展示名'" json:"name"`
|
||||
Owner uint32 `gorm:"comment:'服务器属主'" json:"owner"`
|
||||
ExpireTime time.Time `gorm:"column:expire_time;default:0;comment:'展示到期时间'" json:"expire_time"`
|
||||
}
|
||||
|
||||
// TableName ServerShow's table name
|
||||
func (*ServerShow) TableName() string {
|
||||
return TableNameServerShow
|
||||
}
|
||||
|
||||
// GroupName ServerShow's table group
|
||||
func (*ServerShow) GroupName() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
// NewServerShow create a new ServerShow
|
||||
func NewServerShow() *ServerShow {
|
||||
return &ServerShow{
|
||||
Model: cool.NewModel(),
|
||||
}
|
||||
}
|
||||
|
||||
// init 创建表
|
||||
func init() {
|
||||
cool.CreateTable(&ServerShow{})
|
||||
}
|
||||
Reference in New Issue
Block a user