feat(config): 重构配置结构并添加服务器列表支持 - 重命名PortBL字段为GameOnlineID,改进命名语义 - 添加ServerList结构体用于管理服务器配置 - 移除七牛云配置相关字段 - 更新ID生成器使用GameOnlineID参数 fix(server): 调整服务器启动参数和VIP逻辑 - 将启动参数从-port改为-id,统一参数命名 - 更新服务器启动逻辑,基于GameOnlineID获取服务器信息 - 为VIP服务器启用调试模式 - 优化端口可用性检查逻辑 refactor(model): 统一模型基类结构 - 将各模型中的*cool.Model嵌入改为Base基类 - 移除soul.go
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package model
|
|
|
|
import (
|
|
"blazing/cool"
|
|
)
|
|
|
|
// 表名常量
|
|
const TableNamePlayerTitle = "player_title"
|
|
|
|
// PlayerTitle 对应数据库表 <player_title>
|
|
type Title struct {
|
|
Base
|
|
PlayerID uint64 `gorm:"not null;index:idx_player_title_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
|
TitleID uint32 `gorm:"not null;comment:'称号ID'" json:"title_id"`
|
|
//可用称号
|
|
AvailableTitle []uint32 `gorm:"type:json; comment:'可用称号'" json:"available_title"`
|
|
}
|
|
|
|
// TitleInfo 用于前端返回的称号信息
|
|
type TitleInfo struct {
|
|
TitleId uint32 `json:"titleId"` // 称号ID
|
|
LeftTime uint32 `json:"leftTime"` // 剩余时间(秒),永久称号可设为 0
|
|
ItemLevel uint32 `json:"itemLevel"` // 称号等级,可固定为 0
|
|
IsActive bool `json:"isActive"` // 是否当前使用
|
|
}
|
|
|
|
// TableName 返回表名
|
|
func (*Title) TableName() string {
|
|
return TableNamePlayerTitle
|
|
}
|
|
|
|
// GroupName 返回表组名
|
|
func (*Title) GroupName() string {
|
|
return "default"
|
|
}
|
|
|
|
// NewPlayerTitle 创建一个新的称号记录
|
|
func NewPlayerTitle() *Title {
|
|
return &Title{
|
|
Base: *NewBase(),
|
|
}
|
|
}
|
|
|
|
// init 程序启动时自动创建表
|
|
func init() {
|
|
cool.CreateTable(&Title{})
|
|
}
|