From 54087998b41bb9832a61143fdd294322e2e5048e Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Fri, 15 Dec 2023 14:23:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A1=A5=E7=BE=8A=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E5=8D=A1=E6=AD=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/parkour/api_racematchcancel.go | 51 +++++++++++--------------- modules/user/api_create.go | 6 +++ 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/modules/parkour/api_racematchcancel.go b/modules/parkour/api_racematchcancel.go index 623712d9c..3a0150fd6 100644 --- a/modules/parkour/api_racematchcancel.go +++ b/modules/parkour/api_racematchcancel.go @@ -28,17 +28,29 @@ func (this *apiComp) RaceMatchCancel(session comm.IUserSession, req *pb.ParkourR return } - if info.State != pb.RaceTeamState_matching { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ReqParameterError, - Title: pb.ErrorCode_ReqParameterError.ToString(), - Message: "no matching!", + if info.State == pb.RaceTeamState_matching { + if req.Rtype == pb.RaceType_ordinary { + if err = this.module.matchTrain.CancelMatch(session.GetUserId()); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + } else { + if err = this.module.matchrank.CancelMatch(session.GetUserId()); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } } - return - } - - if req.Rtype == pb.RaceType_ordinary { - if err = this.module.matchTrain.CancelMatch(session.GetUserId()); err != nil { + if err = this.module.parkourComp.Change(session.GetUserId(), map[string]interface{}{ + "state": pb.RaceTeamState_resting, + }); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, Title: pb.ErrorCode_DBError.ToString(), @@ -46,25 +58,6 @@ func (this *apiComp) RaceMatchCancel(session comm.IUserSession, req *pb.ParkourR } return } - } else { - if err = this.module.matchrank.CancelMatch(session.GetUserId()); err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Title: pb.ErrorCode_DBError.ToString(), - Message: err.Error(), - } - return - } - } - if err = this.module.parkourComp.Change(session.GetUserId(), map[string]interface{}{ - "state": pb.RaceTeamState_resting, - }); err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Title: pb.ErrorCode_DBError.ToString(), - Message: err.Error(), - } - return } session.SendMsg(string(this.module.GetType()), "racematchcancel", &pb.ParkourRaceMatchCancelResp{}) return diff --git a/modules/user/api_create.go b/modules/user/api_create.go index 1c5532878..0aef41ec5 100644 --- a/modules/user/api_create.go +++ b/modules/user/api_create.go @@ -23,6 +23,12 @@ func (this *apiComp) CreateCheck(session comm.IUserSession, req *pb.UserCreateRe // Title: pb.ErrorCode_UserNickSensitive.ToString(), // } // } + if req.Gender == 0 || req.Skin == "" { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_UserNickNameEmpty, + Title: pb.ErrorCode_UserNickNameEmpty.ToString(), + } + } return }