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 }