diff --git a/modules/dispatch/model_dispatch.go b/modules/dispatch/model_dispatch.go index 69442d20a..12f6adca2 100644 --- a/modules/dispatch/model_dispatch.go +++ b/modules/dispatch/model_dispatch.go @@ -306,12 +306,15 @@ func (this *modelDispatch) validHeroCond(uid string, taskId int32, heroId string case 1: //校验英雄的基础条件 if hero.Lv >= v.Param { ok1 = true - return } + } + } + + for _, v := range gd.Taskreqex { + switch v.Key { case 2: //校验英雄的额外要求 if hero.Star >= v.Param { ok2 = true - return } } } diff --git a/modules/hero/module.go b/modules/hero/module.go index 0999779ac..0efb2818b 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -841,30 +841,60 @@ func (this *Hero) InRange(heroRecord *pb.DBHeroRecord, strPool []string, update } func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, fulllvenr int32) (code pb.ErrorCode) { - _hero, code := this.GetHeroByObjID(session.GetUserId(), heroOid) - if code != pb.ErrorCode_Success { - return + var ( + _hero *pb.DBHero + model *db.DBModel + err error + _heroMap map[string]interface{} + _changeHero []*pb.DBHero // 变化的英雄 + ) + 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(), heroOid, _hero); err != nil { + this.Errorf("err:%v", err) + return + } + } + } else { + _hero, code = this.GetHeroByObjID(session.GetUserId(), heroOid) + if code != pb.ErrorCode_Success { + 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 { + this.Errorf("err:%v", err) + code = pb.ErrorCode_DBError + return + } } - if err := this.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap); err != nil { + } else { + if err := this.modelHero.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil { // 修改英雄信息 + this.Errorf("err:%v", err) code = pb.ErrorCode_DBError return } - - } else { - code = pb.ErrorCode_HeroIsRegister // 英雄已经注册过 - return } + _changeHero = append(_changeHero, _hero) + session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: _changeHero}) return } diff --git a/modules/pagoda/api_ranklist.go b/modules/pagoda/api_ranklist.go index f2cc8a92d..5ae070b1b 100644 --- a/modules/pagoda/api_ranklist.go +++ b/modules/pagoda/api_ranklist.go @@ -46,7 +46,6 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListR _dataList := rd.Val() for _, v := range _dataList { //conn_, err := db.Cross() - dbModel := db.NewDBModel(comm.TableSeasonRecord, 0, conn) result := &pb.DBPagodaRecord{} if err = dbModel.GetListObj(session.GetUserId(), v, result); err == nil { diff --git a/modules/smithy/comp_configure.go b/modules/smithy/comp_configure.go index 07797a477..5b13cf373 100644 --- a/modules/smithy/comp_configure.go +++ b/modules/smithy/comp_configure.go @@ -92,7 +92,7 @@ func (this *configureComp) CheckSmithyFirstReelConfigData(etype int32, id int32) if v, err := this.GetConfigure(game_smithyreel); err == nil { if configure, ok := v.(*cfg.GameNewSmithy); ok { for _, v := range configure.GetDataList() { - if v.Type == etype { + if v.Type == etype{ if v.Id == id { return true } else { @@ -100,7 +100,6 @@ func (this *configureComp) CheckSmithyFirstReelConfigData(etype int32, id int32) } } } - return true } } return false