68 lines
2.3 KiB
Go
68 lines
2.3 KiB
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
|
||
"github.com/gogf/gf/v2/os/gtime"
|
||
)
|
||
|
||
const (
|
||
TableNameEgg = "config_egg" // 性别配置表(替换原宠物融合表名)
|
||
)
|
||
|
||
type BaseConfig struct {
|
||
ID uint `gorm:"primaryKey" json:"id"`
|
||
CreateTime *gtime.Time ` gorm:"column:createTime;not null;index,priority:1;autoCreateTime:nano;comment:创建时间" json:"createTime"` // 创建时间
|
||
UpdateTime *gtime.Time `orm:"autoUpdateTime=true" gorm:"column:updateTime;not null;index,priority:1;autoUpdateTime:nano;comment:更新时间" json:"updateTime"` // 更新时间
|
||
DeletedAt *gtime.Time `gorm:"index" json:"deletedAt"`
|
||
IsEnable int32 `gorm:"not null;default:0;comment:'是否启用(1:启用,0:禁用)'" json:"is_enable"` // 保留原有逻辑
|
||
Remark string `gorm:"type:varchar(255);default:'';comment:'性别配置备注(如:默认性别规则)'" json:"remark"` // 调整注释
|
||
}
|
||
|
||
func (m *BaseConfig) TableName() string {
|
||
return "this_table_should_not_exist"
|
||
}
|
||
|
||
// 返回分组名
|
||
func (m *BaseConfig) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
func NewBaseConfig() *BaseConfig {
|
||
return &BaseConfig{}
|
||
}
|
||
|
||
// Egg 性别配置模型(替换原宠物融合配方模型)
|
||
type Egg struct {
|
||
*BaseConfig
|
||
//雌性
|
||
MalePetIDs []int32 `gorm:"type:int[];comment:'雄性宠物ID列表(如:[1001,1002])'" json:"male_pet_ids"`
|
||
//雄性
|
||
FemalePetIDs []int32 `gorm:"type:int[];comment:'雌性宠物ID列表(如:[1001,1002])'" json:"female_pet_ids"`
|
||
//子代指定性别配置表名
|
||
OutputMons []int32 `gorm:"type:int[];not null;comment:'宠物类型ID'" json:"pet_type_id"`
|
||
Probs []int32 `gorm:"type:int[];not null;comment:'对应子代宠物类型的概率(如:[50,50]表示均等概率)'" json:"probs"`
|
||
}
|
||
|
||
// TableName 指定性别配置表名(替换原宠物融合表名)
|
||
func (*Egg) TableName() string {
|
||
return TableNameEgg
|
||
}
|
||
|
||
// GroupName 表分组(保持原逻辑的default分组)
|
||
func (*Egg) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewEgg 创建性别配置实例(替换原NewPetFusion)
|
||
func NewEgg() *Egg {
|
||
return &Egg{
|
||
BaseConfig: NewBaseConfig(),
|
||
}
|
||
}
|
||
|
||
// init 初始化性别配置表结构(替换原宠物融合表初始化)
|
||
func init() {
|
||
cool.CreateTable(&Egg{})
|
||
}
|