1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-08 17:57:42 +08:00
parent 2edd1ba852
commit ffe3ff18bf
25 changed files with 180 additions and 117 deletions

View File

@@ -4,49 +4,43 @@ import (
"blazing/cool"
)
// 表名常量定义egg配置表
const (
TableNameeggConfig = "config_pet_egg" // egg配置表(记录egg编号、可兑换次数、奖励配置等核心信息
TableNameEgg = "config_egg" // 性别配置表(替换原宠物融合表名
)
// EggConfig egg核心配置模型含可兑换次数满足查询`where 可兑换次数 != 0`需求
type EggConfig struct {
*cool.Model
// Egg 性别配置模型(替换原宠物融合配方模型
type Egg struct {
*cool.Model // 保留通用ModelID/创建时间/更新时间等)
//雄性
MalePet int32 `gorm:"not null;comment:'雄性宠物ID'" json:"male_pet"`
MalePetIDs []int32 `gorm:"type:int[];comment:'雄性宠物ID列表[1001,1002]'" json:"male_pet_ids"`
//雌性
FemalePet int32 `gorm:"not null;comment:'雌性宠物ID'" json:"female_pet"`
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"`
// 生成的精灵ID及对应概率
GeneratedPetIDs []GeneratedPetID `gorm:"type:jsonb;comment:'生成的精灵ID及概率配置'" json:"generated_pet_ids"`
Remark string `gorm:"size:512;default:'';comment:'egg备注'" json:"remark" description:"备注信息"`
//ItemGift []*ItemGift `gorm:"-" orm:"with:item_id=id"`
}
type GeneratedPetID struct {
PetID int32 `json:"pet_id" comment:"生成的精灵ID"`
Prob float64 `json:"prob" comment:"该精灵生成概率"`
IsEnable int32 `gorm:"not null;default:1;comment:'是否启用1:启用0:禁用)'" json:"is_enable"` // 保留原有逻辑
Remark string `gorm:"type:varchar(255);default:'';comment:'性别配置备注(如:默认性别规则)'" json:"remark"` // 调整注释
}
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
func (*EggConfig) TableName() string {
return TableNameeggConfig
// TableName 指定性别配置表名(替换原宠物融合表名)
func (*Egg) TableName() string {
return TableNameEgg
}
func (*EggConfig) GroupName() string {
// GroupName 表分组保持原逻辑的default分组
func (*Egg) GroupName() string {
return "default"
}
func NeweggConfig() *EggConfig {
return &EggConfig{
// NewEgg 创建性别配置实例替换原NewPetFusion
func NewEgg() *Egg {
return &Egg{
Model: cool.NewModel(),
}
}
// -------------------------- 表结构自动同步 --------------------------
// init 初始化性别配置表结构(替换原宠物融合表初始化)
func init() {
cool.CreateTable(&EggConfig{})
cool.CreateTable(&Egg{})
}

View File

@@ -1,6 +1,7 @@
package model
import (
"blazing/common/data"
"blazing/cool"
)
@@ -14,7 +15,7 @@ type ColorfulSkin struct {
*cool.Model
// 核心必填字段
Color string `gorm:"not null;default:'';comment:'炫彩皮肤颜色(唯一标识每条配置)'" json:"color" description:"炫彩皮肤颜色"`
Color data.GlowFilter `gorm:"type:jsonb;not null;;comment:'炫彩皮肤颜色(唯一标识每条配置)'" json:"color" description:"炫彩皮肤颜色"`
IsEnabled uint32 `gorm:"not null;default:1;comment:'是否启用0-禁用 1-启用)'" json:"is_enabled" description:"是否启用"`
Author string `gorm:"not null;size:64;default:'';comment:'炫彩皮肤配置作者(创建人/配置者名称)'" json:"author" description:"作者"`
@@ -42,15 +43,6 @@ func (*ColorfulSkin) GroupName() string {
func NewColorfulSkin() *ColorfulSkin {
return &ColorfulSkin{
Model: cool.NewModel(),
Color: "",
IsEnabled: 1,
Author: "",
RefreshCount: 0,
UsageCount: 0,
BindElfIds: []uint32{},
Remark: "",
}
}