From ec892aa56f30a6ab2a9bc2010c954bd251e598c3 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 15 Mar 2023 15:08:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E7=AD=89=E7=BA=A7=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B7=A8=E6=9C=8D=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/module.go | 39 +++++++++++++++++++++++++++----- modules/pagoda/api_ranklist.go | 1 - modules/smithy/comp_configure.go | 3 +-- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/modules/hero/module.go b/modules/hero/module.go index 0999779ac..6a0dce208 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -841,9 +841,24 @@ 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 + ) + 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 { @@ -856,9 +871,21 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, _heroMap := map[string]interface{}{ "fulllvenr": _hero.Fulllvenr, } - if err := this.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap); err != nil { - code = pb.ErrorCode_DBError - 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 + } + } + } else { + if err := this.modelHero.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil { // 修改英雄信息 + this.Errorf("err:%v", err) + code = pb.ErrorCode_DBError + return + } } } else { 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