From c5a605c3dffc03d6fa60e10661cc043dbe4e6990 Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Mon, 3 Jul 2023 11:22:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=99=E4=B9=A0=E4=BD=BF=E7=94=A8=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/practice/api_practice.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/modules/practice/api_practice.go b/modules/practice/api_practice.go index d1d8ae828..443b06c32 100644 --- a/modules/practice/api_practice.go +++ b/modules/practice/api_practice.go @@ -1,6 +1,7 @@ package practice import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" "go_dreamfactory/sys/configure" @@ -20,6 +21,7 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic var ( err error room *pb.DBPracticeRoom + hero *pb.DBHero pillar *pb.DBPracticePillar pillarconfigure *cfg.GamePandamasMzData tconfigure *cfg.GamePandamasJxData @@ -35,6 +37,22 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic } return } + if hero, err = this.module.ModuleHero.QueryCrossHeroinfo(req.Hero); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: fmt.Sprintf("no found hero:%s", req.Hero), + } + return + } + if tconfigure, err = this.module.configure.getGamePandamasJx(req.Teacher); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + Message: err.Error(), + } + return + } switch req.Index { case 1: @@ -100,6 +118,14 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic } return } + if tconfigure.BanHero == hero.HeroID { //禁止使用 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + Message: fmt.Sprintf("teacher:%s and hero:%s no can together", req.Teacher, hero.HeroID), + } + return + } extra += tconfigure.Duration pillar.Teacher = req.Teacher }