教习使用限制

This commit is contained in:
liwei 2023-07-03 11:22:55 +08:00
parent 777151fe36
commit c5a605c3df

View File

@ -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
}