修复补羊匹配卡死问题

This commit is contained in:
liwei1dao 2023-12-15 14:23:00 +08:00
parent 3401f524e8
commit 54087998b4
2 changed files with 28 additions and 29 deletions

View File

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

View File

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