From 3d1a49d85f72b210df3b10c34d72a7884712c7ab Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 29 Sep 2022 14:24:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8D=95=E6=AC=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E7=9A=84=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/api_strengthenUplv.go | 3 ++- modules/hero/model_hero.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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