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,