feat(config): 重构配置结构并添加服务器列表支持 - 重命名PortBL字段为GameOnlineID,改进命名语义 - 添加ServerList结构体用于管理服务器配置 - 移除七牛云配置相关字段 - 更新ID生成器使用GameOnlineID参数 fix(server): 调整服务器启动参数和VIP逻辑 - 将启动参数从-port改为-id,统一参数命名 - 更新服务器启动逻辑,基于GameOnlineID获取服务器信息 - 为VIP服务器启用调试模式 - 优化端口可用性检查逻辑 refactor(model): 统一模型基类结构 - 将各模型中的*cool.Model嵌入改为Base基类 - 移除soul.go
47 lines
1.8 KiB
Go
47 lines
1.8 KiB
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
// 表名常量定义:金豆消费记录表
|
||
const (
|
||
TableNameGoldBeanConsume = "gold_bean_consume_record" // 金豆消费记录表(记录用户金豆消耗的明细、类型、关联业务等信息)
|
||
)
|
||
|
||
// 通过金豆消费时间来确认金豆物品的购买重置周期
|
||
// GoldBeanConsume 金豆消费核心模型(与数据库表字段一一对应,存储消费明细)
|
||
type GoldBeanConsume struct {
|
||
Base
|
||
|
||
UID uint32 `gorm:"not null;default:0;index;comment:'玩家唯一ID,关联玩家表主键'" json:"uid" description:"玩家ID"`
|
||
ConsumeNum uint32 `gorm:"not null;default:0;comment:'金豆消费数量(非负数)'" json:"consume_num" description:"消费金豆数量"`
|
||
BizID uint32 `gorm:"not null;default:0;comment:'关联业务ID(如道具ID/扭蛋池ID,无则填0)'" json:"biz_id" description:"关联业务ID"`
|
||
BeforeBalance uint32 `gorm:"not null;default:0;comment:'消费前金豆余额'" json:"before_balance" description:"消费前余额"`
|
||
}
|
||
|
||
// -------------------------- 核心配套方法 --------------------------
|
||
|
||
// TableName 指定GoldBeanConsume对应的数据库表名(遵循项目规范)
|
||
func (*GoldBeanConsume) TableName() string {
|
||
return TableNameGoldBeanConsume
|
||
}
|
||
|
||
// GroupName 指定表所属分组(与其他精灵/玩家相关表保持一致)
|
||
func (*GoldBeanConsume) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewGoldBeanConsume 创建金豆消费记录实例(初始化通用Model及默认值)
|
||
func NewGoldBeanConsume() *GoldBeanConsume {
|
||
return &GoldBeanConsume{
|
||
Base: *NewBase(),
|
||
}
|
||
}
|
||
|
||
// -------------------------- 表结构自动同步 --------------------------
|
||
func init() {
|
||
// 程序启动时自动创建/同步金豆消费记录表
|
||
cool.CreateTable(&GoldBeanConsume{})
|
||
}
|