英雄可以取消注册

This commit is contained in:
meixiongfeng 2023-03-15 15:15:16 +08:00
parent e7d3d0ca7a
commit 72bb00422e

View File

@ -845,6 +845,7 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string,
_hero *pb.DBHero
model *db.DBModel
err error
_heroMap map[string]interface{}
)
if this.IsCross() {
_hero = &pb.DBHero{}
@ -860,18 +861,22 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string,
return
}
}
if _hero.Fulllvenr == 0 {
_heroMap = make(map[string]interface{})
if fulllvenr == 0 && _hero.Fulllvenr != 0 {
_heroMap["fulllvenr"] = 0
} else if _hero.Fulllvenr == 0 && fulllvenr != 0 {
// 校验有没有满级
if _hero.Lv < this.configure.GetHeroMaxLv(_hero.Star) {
code = pb.ErrorCode_HeroLvNoEnough // 必须满级
return
}
_hero.Fulllvenr = fulllvenr
_heroMap := map[string]interface{}{
"fulllvenr": _hero.Fulllvenr,
}
_heroMap["fulllvenr"] = _hero.Fulllvenr
} else {
code = pb.ErrorCode_HeroIsRegister
return
}
if this.IsCross() {
if model != nil {
if err := model.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil {
@ -887,11 +892,6 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string,
return
}
}
} else {
code = pb.ErrorCode_HeroIsRegister // 英雄已经注册过
return
}
return
}