diff --git a/modules/hero/module.go b/modules/hero/module.go index 2ef250c36..4445cf4a0 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -299,11 +299,12 @@ func (this *Hero) AddHeroExp(session comm.IUserSession, heroObjID string, exp in _hero *pb.DBHero _changeHero []*pb.DBHero // 变化的英雄 ) - _hero = &pb.DBHero{} + if heroObjID == "" { return } if this.IsCross() { + _hero = &pb.DBHero{} if model, err := this.GetDBModuleByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { if err := model.GetListObj(session.GetUserId(), heroObjID, _hero); err != nil { this.Errorf("err:%v", err) @@ -341,6 +342,7 @@ func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongf ) if this.IsCross() { + _hero = &pb.DBHero{} if model, err = this.GetDBModuleByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { if err := model.GetListObj(session.GetUserId(), heroObjID, _hero); err != nil { this.Errorf("err:%v", err)