diff --git a/modules/hero/api_strengthenUplv.go b/modules/hero/api_strengthenUplv.go index cafcb4110..a6ee3e3cd 100644 --- a/modules/hero/api_strengthenUplv.go +++ b/modules/hero/api_strengthenUplv.go @@ -105,12 +105,13 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren code = pb.ErrorCode_HeroMaxLv return } - + curLv := _hero.Lv // 执行升级逻辑 newhero, code := this.module.modelHero.AddCardExp(session.GetUserId(), _hero, addExp) // 加经验 if code != pb.ErrorCode_Success { return } + iLvUp = _hero.Lv - curLv // 消耗金币 code = this.module.ModuleUser.AddAttributeValue(session, comm.ResGold, -costGold, true) if code != pb.ErrorCode_Success { // 金币不足 diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 31696cdb8..22a5389e9 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -530,6 +530,7 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe curExp += exp // 先把经验加上 for { // 死循环判断一键升级 if len(_data.Heroexp) == 0 { + curExp = 0 break } maxExp = _data.Heroexp[0].N