From ae58f1c98b5b3628155d7785bae0ff011cdb9a4d Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Mon, 3 Jul 2023 14:20:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=AD=A6=E5=AE=98=E9=81=93?= =?UTF-8?q?=E5=85=B7=E4=BD=BF=E7=94=A8=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/practice/api_practice.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/practice/api_practice.go b/modules/practice/api_practice.go index 1776ea812..3305ca5b5 100644 --- a/modules/practice/api_practice.go +++ b/modules/practice/api_practice.go @@ -122,6 +122,19 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic return } + if !utils.IsToday(room.Knapsack[req.Teacher].Lastusetime) { + room.Knapsack[req.Teacher].Usenum = 0 + } + + if room.Knapsack[req.Teacher].Usenum >= tconfigure.Limitation { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + Message: fmt.Sprintf("the teacher:%s use to Limit", req.Teacher), + } + return + } + room.Knapsack[req.Teacher].Usenum++ if tconfigure.Race != heroconf.Race { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ReqParameterError, @@ -164,6 +177,21 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic } return } + + if !utils.IsToday(room.Knapsack[req.Prop].Lastusetime) { + room.Knapsack[req.Teacher].Usenum = 0 + } + + if room.Knapsack[req.Prop].Usenum >= tconfigure.Limitation { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + Message: fmt.Sprintf("the prop:%s use to Limit", req.Prop), + } + return + } + room.Knapsack[req.Prop].Usenum++ + if pconfigure.Race != heroconf.Race { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ReqParameterError,