```
fix(pet): 修复宠物融合与删除逻辑中的数据访问问题 - 在 PET_FUSION 控制器中注释掉调试代码并修正融合时使用的捕获时间参数 - 优化 player 模块中 Pet_del 方法的切片删除逻辑,避免潜在的数据竞争 - 修复 fight loop 中对手宠物列表的错误引用 - 调整数据库查询条件,将 id 字段从关键字搜索移至精确匹配字段 - 宠物服务中添加插入失败时的重试机制,并默认 free 状态为 1 ```
This commit is contained in:
@@ -15,6 +15,7 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result
|
||||
if !c.UseCoins(1000) {
|
||||
return result, errorcode.ErrorCodes.ErrSystemBusy
|
||||
}
|
||||
// g.Dump(c.Info.PetList)
|
||||
|
||||
//防止同一只
|
||||
if data.Mcatchtime == data.Auxcatchtime {
|
||||
@@ -37,7 +38,7 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result
|
||||
if xmlres.PetMAP[int(Auxpetinfo.ID)].FuseSub == 0 {
|
||||
return result, errorcode.ErrorCodes.ErrPokemonNotFusionReady3
|
||||
}
|
||||
|
||||
//println(len(c.Info.PetList), data.Mcatchtime, data.Auxcatchtime, Mcatchpetinfo.CatchTime, Auxpetinfo.CatchTime)
|
||||
///性格生成
|
||||
var natureId int32 = -1
|
||||
if Auxpetinfo.Nature == Mcatchpetinfo.Nature {
|
||||
@@ -58,8 +59,11 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result
|
||||
r := model.GenPetInfo(resid, int(dv), int(natureId), effect, -1, 1)
|
||||
r.OldCatchTime = Mcatchpetinfo.CatchTime
|
||||
c.Service.Pet.PetAdd(r)
|
||||
c.Pet_del(Auxpetinfo.CatchTime)
|
||||
c.Pet_del(Mcatchpetinfo.CatchTime)
|
||||
println(len(c.Info.PetList), data.Mcatchtime, data.Auxcatchtime, Mcatchpetinfo.CatchTime, Auxpetinfo.CatchTime)
|
||||
c.Pet_del(data.Auxcatchtime)
|
||||
c.Pet_del(data.Mcatchtime)
|
||||
//fmt.Println(len(c.Info.PetList))
|
||||
// g.Dump(c.Info.PetList)
|
||||
//todo材料扣除
|
||||
return &pet.PetFusionInfo{
|
||||
ObtainTime: r.CatchTime,
|
||||
|
||||
Reference in New Issue
Block a user