fix: 修复道具扣除和宠物融合事务处理问题
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-04-14 13:06:28 +08:00
parent ddbfe91d8b
commit c9b5f8569f
11 changed files with 562 additions and 56 deletions

View File

@@ -39,9 +39,7 @@ func (p *Player) AddPetExp(petInfo *model.PetInfo, addExp int64) {
p.Info.ExpPool -= addExp //减去已使用的经验
gainedExp := exp //已获得的经验
for exp >= int64(petInfo.NextLvExp) {
petInfo.Level++
exp -= int64(petInfo.LvExp)
petInfo.Update(true)
}

View File

@@ -419,7 +419,15 @@ func (p *Player) ItemAdd(ItemId, ItemCnt int64) (result bool) {
p.SendPack(t1.Pack(nil)) //准备包由各自发,因为协议不一样
return false
}
p.Service.Item.UPDATE(uint32(ItemId), gconv.Int(ItemCnt))
if err := p.Service.Item.UPDATE(uint32(ItemId), gconv.Int(ItemCnt)); err != nil {
cool.Logger.Error(context.TODO(), "item add update failed", p.Info.UserID, ItemId, ItemCnt, err)
t1 := common.NewTomeeHeader(2601, p.Info.UserID)
t1.Result = uint32(errorcode.ErrorCodes.ErrSystemError200007)
p.SendPack(t1.Pack(nil)) //准备包由各自发,因为协议不一样
return false
}
return true
}