diff --git a/logic/controller/fight_boss.go b/logic/controller/fight_boss.go index 38ecff3c2..5e0011344 100644 --- a/logic/controller/fight_boss.go +++ b/logic/controller/fight_boss.go @@ -47,7 +47,9 @@ func processMonID(bm string) string { // 挑战地图boss func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { - + if !c.CanFight() { + return nil, errorcode.ErrorCodes.ErrSystemError + } var mo *model.PetInfo moinfo := &model.PlayerInfo{} @@ -144,7 +146,9 @@ func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, c *pla // 战斗野怪 func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { - + if !c.CanFight() { + return nil, errorcode.ErrorCodes.ErrSystemError + } refpet := c.OgreInfo.Data[data.Number] if refpet.Id == 0 { @@ -167,33 +171,36 @@ func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundIn c.Fightinfo.Mode = info.BattleMode.MULTI_MODE //多人模式 fight.NewFight(c, ai, func(foi *info.FightOverInfo) { - c.Done.Exec(model.MilestoneMode.Moster, []uint32{c.Info.MapID, moinfo.PetList[0].ID, uint32(foi.Reason)}, func(results *model.MilestoneEX) uint32 { - if foi.Reason == 0 && foi.WinnerId == c.Info.UserID { - exp := uint32(xmlres.PetMAP[int(mo.ID)].YieldingExp) * mo.Level / 7 - items := &info.S2C_GET_BOSS_MONSTER{ - //EV: 45, - EXP: exp * 2, - } - if refpet.Item != 0 { + c.Done.Exec(model.MilestoneMode.Moster, []uint32{c.Info.MapID, moinfo.PetList[0].ID, uint32(foi.Reason)}, nil) + if foi.Reason == 0 && foi.WinnerId == c.Info.UserID { - items.ItemList = c.ItemAdd(model.ItemInfo{ - ItemId: refpet.Item, - ItemCnt: uint32(grand.Intn(2) + 1), - }) - - } - evs := gconv.Uint32s(strings.Split(xmlres.PetMAP[int(mo.ID)].YieldingEV, " ")) - items.EV = lo.Sum(evs) - c.Info.EVPool += lo.Sum(evs) //给予累计学习力 - foi.Winpet.AddEV(evs) - - c.Info.ExpPool += exp * 4 - c.AddPetExp(foi.Winpet, uint32(exp)*2) - c.SendPackCmd(8004, items) + if !c.CanGetExp() { + return } - return 0 + exp := uint32(xmlres.PetMAP[int(mo.ID)].YieldingExp) * mo.Level / 7 + items := &info.S2C_GET_BOSS_MONSTER{ + //EV: 45, + EXP: exp * 2, + } + if refpet.Item != 0 { + + items.ItemList = c.ItemAdd(model.ItemInfo{ + ItemId: refpet.Item, + ItemCnt: uint32(grand.Intn(2) + 1), + }) + + } + + evs := gconv.Uint32s(strings.Split(xmlres.PetMAP[int(mo.ID)].YieldingEV, " ")) + items.EV = lo.Sum(evs) + c.Info.EVPool += lo.Sum(evs) //给予累计学习力 + foi.Winpet.AddEV(evs) + + c.Info.ExpPool += exp * 4 + c.AddPetExp(foi.Winpet, uint32(exp)*2) + c.SendPackCmd(8004, items) + } - }) }) return nil, -1 diff --git a/logic/controller/fight_pvp_withplayer.go b/logic/controller/fight_pvp_withplayer.go index e0ccbf6d5..1e9060a91 100644 --- a/logic/controller/fight_pvp_withplayer.go +++ b/logic/controller/fight_pvp_withplayer.go @@ -23,6 +23,10 @@ func (h Controller) OnPlayerHandleFightInvite(data *fight.HandleFightInviteInbou } + if !c.CanFight() { + return nil, errorcode.ErrorCodes.ErrSystemError + } + //c.Fightinfo.Status = info.BattleMode.FIGHT_WITH_NPC resp := &info.S2C_NOTE_HANDLE_FIGHT_INVITE{ diff --git a/logic/service/fight/action.go b/logic/service/fight/action.go index 6d1bdd738..cdede44df 100644 --- a/logic/service/fight/action.go +++ b/logic/service/fight/action.go @@ -70,7 +70,8 @@ func (f *FightC) ChangePet(c common.PlayerI, id uint32) { c.SendPackCmd(2407, &ret.Reason) InitAttackValue := *selfinput.AttackValue oldpet := selfinput.CurrentPet - f.Switch = append(f.Switch, ret) + f.Switch[c.GetInfo().UserID] = ret + selfinput.InitAttackValue() //切换精灵消除能力提升 //这时候精灵已经切换过了,可以直接给新精灵加效果 diff --git a/logic/service/fight/effect/effect_112.go b/logic/service/fight/effect/effect_112.go index b931e71f6..4c8e8229c 100644 --- a/logic/service/fight/effect/effect_112.go +++ b/logic/service/fight/effect/effect_112.go @@ -37,5 +37,6 @@ func (e *Effect112) OnSkill() bool { Type: info.DamageType.Fixed, Damage: decimal.Min(decimal.NewFromInt(n), e.Ctx().Opp.CurrentPet.GetHP().Sub(decimal.NewFromInt(1))), }) + e.Ctx().Our.CurrentPet.NotAlive = true return true } diff --git a/logic/service/fight/effect/effect_59.go b/logic/service/fight/effect/effect_59.go index 3e3c1a9b1..edb72aba1 100644 --- a/logic/service/fight/effect/effect_59.go +++ b/logic/service/fight/effect/effect_59.go @@ -39,6 +39,7 @@ func (e *Effect59) OnSkill() bool { Type: info.DamageType.Fixed, Damage: decimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)), }) + e.Ctx().Our.CurrentPet.NotAlive = true return true } func (e *Effect59) Switch(in *input.Input, at info.AttackValue, oldpet *info.BattlePetEntity) bool { diff --git a/logic/service/fight/effect/effect_71.go b/logic/service/fight/effect/effect_71.go index 43f17a1ab..663a203ee 100644 --- a/logic/service/fight/effect/effect_71.go +++ b/logic/service/fight/effect/effect_71.go @@ -40,6 +40,7 @@ func (e *Effect71) OnSkill() bool { Type: info.DamageType.Fixed, Damage: decimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)), }) + e.Ctx().Our.CurrentPet.NotAlive = true return true } func (e *Effect71) Switch(in *input.Input, at info.AttackValue, oldpet *info.BattlePetEntity) bool { diff --git a/logic/service/fight/effect/effect_72.go b/logic/service/fight/effect/effect_72.go index 88d7f8714..bac7375fa 100644 --- a/logic/service/fight/effect/effect_72.go +++ b/logic/service/fight/effect/effect_72.go @@ -29,6 +29,7 @@ func (e *Effect72) OnSkill() bool { Type: info.DamageType.True, Damage: decimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.Hp)), }) + e.Ctx().Our.CurrentPet.NotAlive = true } return true diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index a2c95dc6d..b5b8cb3ae 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -289,14 +289,17 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) { return true }) - //技能使用后 - attacker.Exec(func(t input.Effect) bool { //技能使用后的我方效果 - t.Ctx().SkillEntity = currentskill + if !attacker.CurrentPet.NotAlive { + //技能使用后 + attacker.Exec(func(t input.Effect) bool { //技能使用后的我方效果 + t.Ctx().SkillEntity = currentskill - t.Action_end() + t.Action_end() + + return true + }) + } - return true - }) fmt.Println(i, // "玩家技能:", oldskill.(*info.SkillEntity).ID, "玩家技能伤害:", attacker.SumDamage, @@ -371,6 +374,9 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) { }) ff.GenInfo() }) + // if f.closefight { + // return + // } ret := info.AttackValueS{ @@ -389,7 +395,7 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) { } }) - f.Switch = []*action.ActiveSwitchAction{} + f.Switch = make(map[uint32]*action.ActiveSwitchAction) f.Broadcast(func(ff *input.Input) { ff.Player.SendPackCmd(2505, &ret) }) diff --git a/logic/service/fight/input.go b/logic/service/fight/input.go index cbc2a80b1..ac4472a5f 100644 --- a/logic/service/fight/input.go +++ b/logic/service/fight/input.go @@ -32,7 +32,7 @@ type FightC struct { ownerID uint32 // 战斗发起者ID Our *input.Input //始终等于房主ID Opp *input.Input //对手ID - Switch []*action.ActiveSwitchAction + Switch map[uint32]*action.ActiveSwitchAction startl sync.Once rand *rand.Rand StartTime time.Time @@ -227,7 +227,7 @@ func NewFight(p1, p2 common.PlayerI, fn func(*info.FightOverInfo)) (*FightC, err f := &FightC{} f.ownerID = p1.GetInfo().UserID // 1. 构建战斗开始信息(整理双方初始宠物信息) - + f.Switch = make(map[uint32]*action.ActiveSwitchAction) f.callback = fn //战斗结束的回调 f.quit = make(chan struct{}) f.over = make(chan struct{}) diff --git a/logic/service/fight/input/input.go b/logic/service/fight/input/input.go index ac8cae106..f0b62dae2 100644 --- a/logic/service/fight/input/input.go +++ b/logic/service/fight/input/input.go @@ -64,7 +64,7 @@ func (our *Input) SortPet() { // 线性遍历一次,分类收集 for _, s := range our.AllPet { - if s.HP > 0 { + if s.Info.Hp > 0 { for _, e1 := range s.Info.EffectInfo { t := Geteffect(EffectType.NewSel, e1.EID) if t != nil { diff --git a/logic/service/fight/loop.go b/logic/service/fight/loop.go index 8dcced1d8..cd7e0081a 100644 --- a/logic/service/fight/loop.go +++ b/logic/service/fight/loop.go @@ -130,9 +130,12 @@ func (f *FightC) collectPlayerActions(ourID, oppID uint32) map[uint32]action.Bat // 被动切换处理(不计入本回合) if as, ok := paction.(*action.ActiveSwitchAction); ok { if f.GetInputByAction(as, false).CanChange { - f.GetInputByAction(as, false).CanChange = false + continue } + } else { + f.GetInputByAction(paction, false).CanChange = false + } // AI自动技能 diff --git a/logic/service/player/pet.go b/logic/service/player/pet.go index c3ddd7966..b846bab79 100644 --- a/logic/service/player/pet.go +++ b/logic/service/player/pet.go @@ -38,8 +38,10 @@ func (p *Player) AddPetExp(petinfo *model.PetInfo, addExp uint32) { petinfo.Exp = Exp // 重新计算面板 if originalLevel != petinfo.Level { + if petinfo.Level <= 100 { + petinfo.CalculatePetPane() + } - petinfo.CalculatePetPane() petinfo.Cure() } diff --git a/modules/blazing/controller/admin/pet_fusion_controller.go b/modules/blazing/controller/admin/pet_fusion_controller.go new file mode 100644 index 000000000..5ec26f556 --- /dev/null +++ b/modules/blazing/controller/admin/pet_fusion_controller.go @@ -0,0 +1,24 @@ +package admin + +import ( + "blazing/cool" + "blazing/modules/blazing/service" +) + +// PetFusionController 宠物融合配方主表Admin控制器(对应/admin/pet/fusion路由) +type PetFusionController struct { + *cool.Controller +} + +func init() { + // 初始化控制器,配置路由前缀、支持的API、绑定Service + var petFusionController = &PetFusionController{ + &cool.Controller{ + Prefix: "/admin/pet/fusion", // 路由前缀(按模块分类:宠物-融合配方) + Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"}, // 支持的基础CRUD接口 + Service: service.NewPetFusionService(), // 绑定主表Service + }, + } + // 注册控制器到框架 + cool.RegisterController(petFusionController) +} diff --git a/modules/blazing/controller/admin/pet_fusion_material_controller.go b/modules/blazing/controller/admin/pet_fusion_material_controller.go new file mode 100644 index 000000000..0956f0aa5 --- /dev/null +++ b/modules/blazing/controller/admin/pet_fusion_material_controller.go @@ -0,0 +1,24 @@ +package admin + +import ( + "blazing/cool" + "blazing/modules/blazing/service" +) + +// PetFusionMaterialController 宠物融合材料子表Admin控制器(对应/admin/pet/fusion/material路由) +type PetFusionMaterialController struct { + *cool.Controller +} + +func init() { + // 初始化控制器,配置路由前缀、支持的API、绑定Service + var petFusionMaterialController = &PetFusionMaterialController{ + &cool.Controller{ + Prefix: "/admin/pet/fusionmaterial", // 路由前缀(主表路由+子表名,层级清晰) + Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"}, // 支持的基础CRUD接口 + Service: service.NewPetFusionMaterialService(), // 绑定子表Service + }, + } + // 注册控制器到框架 + cool.RegisterController(petFusionMaterialController) +} diff --git a/modules/blazing/controller/admin/login.go b/modules/blazing/controller/app/login.go similarity index 94% rename from modules/blazing/controller/admin/login.go rename to modules/blazing/controller/app/login.go index 9c96110cc..55fd0643a 100644 --- a/modules/blazing/controller/admin/login.go +++ b/modules/blazing/controller/app/login.go @@ -1,85 +1,85 @@ -package admin - -import ( - "blazing/common/data/share" - "blazing/cool" - baseservice "blazing/modules/base/service" - "blazing/modules/blazing/service" - - "context" - "fmt" - - "github.com/gogf/gf/v2/frame/g" -) - -type SessionReq struct { - g.Meta `path:"/getSessionByAuth" method:"GET"` - Email string `json:"email" v:"required|email"` - Password string `json:"password" v:"required"` -} -type SessionRes struct { - Msg string `json:"msg"` - Code int `json:"code"` - Session string `json:"session"` -} - -type BlazingController struct { - *cool.Controller -} - -var biazing_service = service.NewLoginServiceService() - -func init() { - var blazing_controller = &BlazingController{ - &cool.Controller{ - Prefix: "/seer/game", - Api: []string{}, - Service: biazing_service, - }, - } - // 注册路由 - cool.RegisterController(blazing_controller) -} -func (c *BlazingController) GetSession(ctx context.Context, req *SessionReq) (res *SessionRes, err error) { - - res = &SessionRes{ - Msg: "success", - Code: 200, - Session: ""} - if err := g.Validator().Data(req).Run(ctx); err != nil { - fmt.Println(err) - res.Code = 400 - res.Msg = err.Error() - - } - res1, err := baseservice.NewBaseSysUserService().GetSession(req.Email, req.Password) - - if err != nil || res1 == nil { - res.Code = 400 - res.Msg = err.Error() - return - } - - accountID := res1.ID - retsid, sid, err := biazing_service.GetSessionId(accountID) - if err != nil { - res.Code = 400 - res.Msg = err.Error() - - } - - res.Session = retsid - - if err := share.ShareManager.SaveSession(sid, uint32(accountID)); err != nil { - res.Code = 400 - res.Msg = err.Error() - } - - return -} - -type MockReq struct { - g.Meta `path:"/mock" method:"GET"` - Email string `json:"email" v:"required|email"` - Password string `json:"password" v:"required"` -} +package app + +import ( + "blazing/common/data/share" + "blazing/cool" + baseservice "blazing/modules/base/service" + "blazing/modules/blazing/service" + + "context" + "fmt" + + "github.com/gogf/gf/v2/frame/g" +) + +type SessionReq struct { + g.Meta `path:"/getSessionByAuth" method:"GET"` + Email string `json:"email" v:"required|email"` + Password string `json:"password" v:"required"` +} +type SessionRes struct { + Msg string `json:"msg"` + Code int `json:"code"` + Session string `json:"session"` +} + +type BlazingController struct { + *cool.Controller +} + +var biazing_service = service.NewLoginServiceService() + +func init() { + var blazing_controller = &BlazingController{ + &cool.Controller{ + Prefix: "/seer/game", + Api: []string{}, + Service: biazing_service, + }, + } + // 注册路由 + cool.RegisterController(blazing_controller) +} +func (c *BlazingController) GetSession(ctx context.Context, req *SessionReq) (res *SessionRes, err error) { + + res = &SessionRes{ + Msg: "success", + Code: 200, + Session: ""} + if err := g.Validator().Data(req).Run(ctx); err != nil { + fmt.Println(err) + res.Code = 400 + res.Msg = err.Error() + + } + res1, err := baseservice.NewBaseSysUserService().GetSession(req.Email, req.Password) + + if err != nil || res1 == nil { + res.Code = 400 + res.Msg = err.Error() + return + } + + accountID := res1.ID + retsid, sid, err := biazing_service.GetSessionId(accountID) + if err != nil { + res.Code = 400 + res.Msg = err.Error() + + } + + res.Session = retsid + + if err := share.ShareManager.SaveSession(sid, uint32(accountID)); err != nil { + res.Code = 400 + res.Msg = err.Error() + } + + return +} + +type MockReq struct { + g.Meta `path:"/mock" method:"GET"` + Email string `json:"email" v:"required|email"` + Password string `json:"password" v:"required"` +} diff --git a/modules/blazing/controller/controller.go b/modules/blazing/controller/controller.go index 0dd1c8ee5..505e1c400 100644 --- a/modules/blazing/controller/controller.go +++ b/modules/blazing/controller/controller.go @@ -2,4 +2,5 @@ package controller import ( _ "blazing/modules/blazing/controller/admin" + _ "blazing/modules/blazing/controller/app" ) diff --git a/modules/blazing/model/PetFusion.go b/modules/blazing/model/PetFusion.go deleted file mode 100644 index d74c1a03c..000000000 --- a/modules/blazing/model/PetFusion.go +++ /dev/null @@ -1,57 +0,0 @@ -package model - -import ( - "blazing/cool" -) - -const ( - TableNamePetFusion = "pet_fusion" // 宠物融合配方表(主宠-副宠-材料-概率-融合结果) -) - -// PetFusion 宠物融合配方模型(对应尼尔+闪皮+材料1-4=卡鲁/闪尼等融合规则) -type PetFusion struct { - *cool.Model // 嵌入通用Model(包含ID/创建时间/更新时间等通用字段) - - MainPetID int32 `gorm:"not null;comment:'主宠物ID(如:尼尔)'" json:"main_pet_id"` - SubPetID int32 `gorm:"not null;comment:'副宠物ID(如:闪皮)'" json:"sub_pet_id"` - // Material1 int32 `gorm:"not null;default:0;comment:'融合材料1ID(无则填0)'" json:"material1"` - // Material2 int32 `gorm:"not null;default:0;comment:'融合材料2ID(无则填0)'" json:"material2"` - // Material3 int32 `gorm:"not null;default:0;comment:'融合材料3ID(无则填0)'" json:"material3"` - // Material4 int32 `gorm:"not null;default:0;comment:'融合材料4ID(无则填0)'" json:"material4"` - Probability float32 `gorm:"not null;comment:'融合成功率(百分比,如80代表80%)'" json:"probability"` - ResultPetID int32 `gorm:"not null;comment:'融合结果宠物ID(如:卡鲁、闪尼)'" json:"result_pet_id"` - Remark string `gorm:"type:varchar(255);default:'';comment:'融合配方备注(如:尼尔+闪皮=闪尼)'" json:"remark"` - IsEnable int32 `gorm:"not null;default:1;comment:'是否启用(1:启用,0:禁用)'" json:"is_enable"` - // 新增:是否默认配方(核心逻辑:所有匹配配方都不满足时,随机选择默认配方) - IsDefault int32 `gorm:"not null;default:0;comment:'是否默认配方(1:默认配方,0:非默认;所有配方不匹配时随机选默认配方)'" json:"is_default"` -} - -// PetFusionEX 宠物融合配方扩展模型(如需前端展示多维度数据时使用,如ID转名称等) -type PetFusionEX struct { - PetFusion - MainPetName string `json:"main_pet_name"` // 主宠名称(前端展示用) - SubPetName string `json:"sub_pet_name"` // 副宠名称(前端展示用) - ResultPetName string `json:"result_pet_name"` // 结果宠名称(前端展示用) -} - -// TableName 指定PetFusion对应的数据库表名 -func (*PetFusion) TableName() string { - return TableNamePetFusion -} - -// GroupName 指定表所属的分组(保持和MonsterRefresh一致) -func (*PetFusion) GroupName() string { - return "default" -} - -// NewPetFusion 创建一个新的PetFusion实例(初始化通用Model) -func NewPetFusion() *PetFusion { - return &PetFusion{ - Model: cool.NewModel(), - } -} - -// init 初始化表结构(程序启动时自动创建/同步表) -func init() { - cool.CreateTable(&PetFusion{}) -} diff --git a/modules/blazing/model/pet_fusion.go b/modules/blazing/model/pet_fusion.go new file mode 100644 index 000000000..40df25e7e --- /dev/null +++ b/modules/blazing/model/pet_fusion.go @@ -0,0 +1,47 @@ +package model + +import ( + "blazing/cool" +) + +const ( + TableNamePetFusion = "pet_fusion" // 宠物融合配方表(主表) +) + +// PetFusion 宠物融合配方主模型(核心配方规则) +type PetFusion struct { + *cool.Model // 嵌入通用Model(ID/创建时间/更新时间等) + + MainPetID int32 `gorm:"not null;comment:'主宠物ID(如:尼尔)'" json:"main_pet_id"` + SubPetID int32 `gorm:"not null;comment:'副宠物ID(如:闪皮)'" json:"sub_pet_id"` + Probability float32 `gorm:"not null;comment:'融合成功率(百分比,如80代表80%)'" json:"probability"` + ResultPetID int32 `gorm:"not null;comment:'融合结果宠物ID(如:卡鲁、闪尼)'" json:"result_pet_id"` + Remark string `gorm:"type:varchar(255);default:'';comment:'融合配方备注(如:尼尔+闪皮=闪尼)'" json:"remark"` + IsEnable int32 `gorm:"not null;default:1;comment:'是否启用(1:启用,0:禁用)'" json:"is_enable"` + IsDefault int32 `gorm:"not null;default:0;comment:'是否默认配方(1:默认配方,0:非默认;所有配方不匹配时随机选默认配方)'" json:"is_default"` + + // 关联:一个配方对应多个材料(gorm 一对多关联,查询时可预加载) + //Materials []*PetFusionMaterial `gorm:"foreignKey:PetFusionID;references:ID" json:"materials,omitempty"` +} + +// TableName 指定主表名 +func (*PetFusion) TableName() string { + return TableNamePetFusion +} + +// GroupName 表分组(与原逻辑一致) +func (*PetFusion) GroupName() string { + return "default" +} + +// NewPetFusion 创建主表实例 +func NewPetFusion() *PetFusion { + return &PetFusion{ + Model: cool.NewModel(), + } +} + +// init 初始化主表结构 +func init() { + cool.CreateTable(&PetFusion{}) +} diff --git a/modules/blazing/model/pet_fusion_material.go b/modules/blazing/model/pet_fusion_material.go new file mode 100644 index 000000000..d25bc9c90 --- /dev/null +++ b/modules/blazing/model/pet_fusion_material.go @@ -0,0 +1,48 @@ +package model + +import "blazing/cool" + +const ( + TableNamePetFusionMaterial = "pet_fusion_material" // 宠物融合材料表(子表) +) + +// PetFusionMaterial 融合材料模型(与配方主表一对一关联) +type PetFusionMaterial struct { + *cool.Model // 嵌入通用Model(ID/创建时间/更新时间等) + + // 4个材料ID(对应XML ItemGroup的Idx=1-4,无材料填0) + Material1 int64 `gorm:"not null;comment:'材料1ID(如400030)'" json:"material1"` + Material2 int64 `gorm:"not null;comment:'材料2ID(如400030)'" json:"material2"` + Material3 int64 `gorm:"not null;comment:'材料3ID(如400028)'" json:"material3"` + Material4 int64 `gorm:"not null;comment:'材料4ID(如400030)'" json:"material4"` + + // 4个特性ID(对应XML MaterialGroup的特性索引,4-4对应) + Trait1Idx int32 `gorm:"not null;comment:'特性1索引(如1008)'" json:"trait1_idx"` + Trait2Idx int32 `gorm:"not null;comment:'特性2索引(如1018)'" json:"trait2_idx"` + Trait3Idx int32 `gorm:"not null;comment:'特性3索引(如1023)'" json:"trait3_idx"` + Trait4Idx int32 `gorm:"not null;comment:'特性4索引(如1031)'" json:"trait4_idx"` + + IsEnable int32 `gorm:"not null;default:1;comment:'是否启用该组合(1:启用,0:禁用)'" json:"is_enable"` +} + +// TableName 指定子表名 +func (*PetFusionMaterial) TableName() string { + return TableNamePetFusionMaterial +} + +// GroupName 表分组(与主表一致) +func (*PetFusionMaterial) GroupName() string { + return "default" +} + +// NewPetFusionMaterial 创建材料实例 +func NewPetFusionMaterial() *PetFusionMaterial { + return &PetFusionMaterial{ + Model: cool.NewModel(), + } +} + +// init 初始化子表结构 +func init() { + cool.CreateTable(&PetFusionMaterial{}) +} diff --git a/modules/blazing/service/pet_fusion_material_service.go b/modules/blazing/service/pet_fusion_material_service.go new file mode 100644 index 000000000..d73817c9c --- /dev/null +++ b/modules/blazing/service/pet_fusion_material_service.go @@ -0,0 +1,20 @@ +package service + +import ( + "blazing/cool" + "blazing/modules/blazing/model" +) + +// PetFusionMaterialService 宠物融合材料子表Service(对应pet_fusion_material表) +type PetFusionMaterialService struct { + *cool.Service // 嵌入通用Service(继承基础CRUD方法) +} + +// NewPetFusionMaterialService 创建PetFusionMaterialService实例 +func NewPetFusionMaterialService() *PetFusionMaterialService { + return &PetFusionMaterialService{ + &cool.Service{ + Model: model.NewPetFusionMaterial(), // 绑定PetFusionMaterial模型(默认参数占位) + }, + } +} diff --git a/modules/blazing/service/pet_fusion_service.go b/modules/blazing/service/pet_fusion_service.go new file mode 100644 index 000000000..ce6d8425c --- /dev/null +++ b/modules/blazing/service/pet_fusion_service.go @@ -0,0 +1,20 @@ +package service + +import ( + "blazing/cool" + "blazing/modules/blazing/model" +) + +// PetFusionService 宠物融合配方主表Service(对应pet_fusion表) +type PetFusionService struct { + *cool.Service // 嵌入通用Service(继承基础CRUD方法) +} + +// NewPetFusionService 创建PetFusionService实例 +func NewPetFusionService() *PetFusionService { + return &PetFusionService{ + &cool.Service{ + Model: model.NewPetFusion(), // 绑定PetFusion模型 + }, + } +}