feat(config): 添加服务器登录配置字段和商店商品ID字段 - 在ServerList模型中新增LoginAddr、Account、Password字段用于服务器登录配置 - 在Shiny模型中新增VoteCount字段用于记录投票次数 - 在ShopConfig模型中新增ProductID字段作为商品唯一标识 - 移除ShopConfig中不必要的CategoryID、IconURL、时间验证相关字段 - 删除ShopConfig的Validate和时间验证相关方法,简化模型
57 lines
1.9 KiB
Go
57 lines
1.9 KiB
Go
package model
|
|
|
|
import (
|
|
"blazing/cool"
|
|
)
|
|
|
|
const TableNameServerList = "server_list"
|
|
|
|
// 服务器设置天气地图|地图是否显示其他人,设置异色概率|ip
|
|
// ServerList mapped from table <server_list>
|
|
type ServerList struct {
|
|
*cool.Model
|
|
OnlineID uint16 `gorm:"column:online_id;comment:'在线ID';uniqueIndex" json:"online_id"`
|
|
IP string `gorm:"type:string;comment:'服务器IP'" json:"ip"`
|
|
Port uint16 `gorm:"comment:'端口号,通常是小整数'" json:"port"`
|
|
IsOpen bool `gorm:"default:true;not null;comment:'服务器是否开启,默认为开启状态'" json:"is_open"`
|
|
//登录地址
|
|
LoginAddr string `gorm:"type:string;comment:'登录地址'" json:"login_addr"`
|
|
//账号
|
|
Account string `gorm:"type:string;comment:'账号'" json:"account"`
|
|
//密码
|
|
Password string `gorm:"type:string;comment:'密码'" json:"password"`
|
|
CanPort []uint32 `gorm:"type:jsonb;comment:'可连接端口'" json:"can_port"`
|
|
IsVip uint32 `gorm:"default:0;not null;comment:'是否为VIP服务器'" json:"is_vip"`
|
|
//服务器异色概率设定ServerList
|
|
ShinyRate uint8 `gorm:"default:0;comment:'异色概率'" json:"shiny_rate"`
|
|
//服务器天气设定ServerList
|
|
WeatherRate uint8 `gorm:"default:0;comment:'天气概率'" json:"weather_rate"`
|
|
//服务器名称Desc
|
|
Name string `gorm:"comment:'服务器名称'" json:"name"`
|
|
//服务器属主Desc
|
|
Owner uint32 `gorm:"comment:'服务器属主'" json:"owner"`
|
|
Desc string `gorm:"comment:'服务器描述'" json:"desc"`
|
|
}
|
|
|
|
// TableName ServerList's table name
|
|
func (*ServerList) TableName() string {
|
|
return TableNameServerList
|
|
}
|
|
|
|
// GroupName ServerList's table group
|
|
func (*ServerList) GroupName() string {
|
|
return "default"
|
|
}
|
|
|
|
// NewServerList create a new ServerList
|
|
func NewServerList() *ServerList {
|
|
return &ServerList{
|
|
Model: cool.NewModel(),
|
|
}
|
|
}
|
|
|
|
// init 创建表
|
|
func init() {
|
|
cool.CreateTable(&ServerList{})
|
|
}
|