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

feat(game): 宠物融合系统添加物品消耗异常处理

- 在宠物融合过程中添加物品扣除失败的错误检查
- 当物品不足时返回ErrInsufficientItems错误码

fix(pet): 宠物仓库管理功能增加数据库操作错误处理

- 在宠物释放到仓库和从仓库取出时验证数据库更新结果
- 添加宠物背包切换功能的错误检查机制

feat(fight):
This commit is contained in:
昔念
2026-03-19 14:50:11 +08:00
parent e2ac5a6325
commit b558f46d7a
10 changed files with 142 additions and 63 deletions

View File

@@ -85,7 +85,9 @@ func (h Controller) PetReleaseToWarehouse(
return nil, errorcode.ErrorCodes.ErrCannotReleaseNonWarehouse
}
player.Service.Pet.UPdateFree(data.CatchTime, 1)
if !player.Service.Pet.UPdateFree(data.CatchTime, 1) {
return nil, errorcode.ErrorCodes.ErrSystemError
}
return nil, err
}
@@ -96,7 +98,10 @@ func (h Controller) PetRetrieveFromWarehouse(
//如果背包没找到,再放入背包
if _, _, ok := player.FindPet(data.CatchTime); !ok {
player.Service.Pet.UPdateFree(data.CatchTime, 0)
if !player.Service.Pet.UPdateFree(data.CatchTime, 0) {
return nil, errorcode.ErrorCodes.ErrSystemError
}
}
return nil, 0
@@ -127,7 +132,10 @@ func (h Controller) TogglePetBagWarehouse(
if index < 0 || index >= len(player.Info.PetList) {
return result, errorcode.ErrorCodes.ErrPokemonIDMismatch
}
player.Service.Pet.UPdate(*pet)
err := player.Service.Pet.UPdate(*pet)
if err != nil {
return result, errorcode.ErrorCodes.ErrSystemError
}
player.Info.PetList = append(player.Info.PetList[:index], player.Info.PetList[index+1:]...)
}