```
feat(pet): 优化宠物仓库和背包功能的数据库操作 - 使用copier.CopyWithOption替代直接赋值,确保深拷贝操作 - 移除冗余的model导入,简化代码结构 - 重构PetReleaseToWarehouse和PetRetrieveFromWarehouse方法, 直接调用UPdateFree方法更新宠物状态 - 优化TogglePetBagWarehouse方法中的宠物数据更新逻辑 - 添加
This commit is contained in:
@@ -53,8 +53,10 @@ func (h Controller) UsePetItemOutOfFight(data *item.C2S_USE_PET_ITEM_OUT_OF_FIGH
|
||||
oldPetCatchTime := currentPet.CatchTime
|
||||
oldPet := c.Service.Pet.PetInfo_One_Unscoped(currentPet.OldCatchTime)
|
||||
println(c.Info.UserID, "还原", len(c.Info.PetList), currentPet.ID, oldPet.Data.ID)
|
||||
currentPet = &oldPet.Data
|
||||
|
||||
copier.CopyWithOption(currentPet, oldPet.Data, copier.Option{DeepCopy: true})
|
||||
currentPet.CatchTime = oldPetCatchTime
|
||||
println(c.Info.UserID, "还原后", len(c.Info.PetList), currentPet.ID, oldPet.Data.ID)
|
||||
} else {
|
||||
handler := item.PetItemRegistry.GetHandler(data.ItemID)
|
||||
if handler == nil {
|
||||
|
||||
Reference in New Issue
Block a user