Files
bl/modules/config/model/config_egg.go
昔念 05d427cbea
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
1
2026-02-14 11:51:34 +08:00

65 lines
1.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"blazing/cool"
)
const (
TableNameEgg = "config_egg" // 性别配置表(替换原宠物融合表名)
)
type BaseConfig struct {
*cool.Model // 保留通用ModelID/创建时间/更新时间等)
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{
Model: cool.NewModel(),
}
}
// 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{})
}