refactor(player): 调整宠物删除逻辑顺序

将宠物列表更新操作移到背包更新和删除操作之后,
确保在删除宠物前先完成相关的服务更新操作。
```
This commit is contained in:
2025-12-31 02:17:43 +08:00
parent be70f50939
commit 4fa60266f1

View File

@@ -68,10 +68,10 @@ func (f *baseplayer) FindPet(catchTime uint32) (int, *model.PetInfo, bool) {
func (f *Player) PetDel(catchTime uint32) {
index, olpet, ok := f.FindPet(catchTime)
if ok {
f.Info.PetList = append(f.Info.PetList[:index], f.Info.PetList[index+1:]...)
//先将背包更新
f.Service.Pet.UPdate(*olpet)
f.Service.Pet.Pet_del(catchTime)
f.Info.PetList = append(f.Info.PetList[:index], f.Info.PetList[index+1:]...)
}
}