Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev

This commit is contained in:
meixiongfeng 2022-09-29 14:24:44 +08:00
commit f5d13ea80e
2 changed files with 3 additions and 1 deletions

View File

@ -105,12 +105,13 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
code = pb.ErrorCode_HeroMaxLv code = pb.ErrorCode_HeroMaxLv
return return
} }
curLv := _hero.Lv
// 执行升级逻辑 // 执行升级逻辑
newhero, code := this.module.modelHero.AddCardExp(session.GetUserId(), _hero, addExp) // 加经验 newhero, code := this.module.modelHero.AddCardExp(session.GetUserId(), _hero, addExp) // 加经验
if code != pb.ErrorCode_Success { if code != pb.ErrorCode_Success {
return return
} }
iLvUp = _hero.Lv - curLv
// 消耗金币 // 消耗金币
code = this.module.ModuleUser.AddAttributeValue(session, comm.ResGold, -costGold, true) code = this.module.ModuleUser.AddAttributeValue(session, comm.ResGold, -costGold, true)
if code != pb.ErrorCode_Success { // 金币不足 if code != pb.ErrorCode_Success { // 金币不足

View File

@ -530,6 +530,7 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe
curExp += exp // 先把经验加上 curExp += exp // 先把经验加上
for { // 死循环判断一键升级 for { // 死循环判断一键升级
if len(_data.Heroexp) == 0 { if len(_data.Heroexp) == 0 {
curExp = 0
break break
} }
maxExp = _data.Heroexp[0].N maxExp = _data.Heroexp[0].N