参数校验

This commit is contained in:
meixiongfeng 2022-09-06 20:20:38 +08:00
parent 3f5c6ba3ab
commit 66ff038d4e

View File

@ -9,7 +9,7 @@ import (
//参数校验
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.MainlineChallengeReq) (code pb.ErrorCode) {
if req.MainlineId == 0 {
if req.MainlineId == 0 || req.ChapterObj == "" || req.Leadpos >= 5 || len(req.Teamids) > 5 || req.Leadpos < 0 {
code = pb.ErrorCode_ReqParameterError
return
}
@ -58,6 +58,9 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle
Teamids: req.Teamids,
Mformat: node.FormatList,
})
if code != pb.ErrorCode_Success {
return
}
session.SendMsg(string(this.module.GetType()), MainlineChallengeResp, &pb.MainlineChallengeResp{Info: &pb.BattleInfo{
Id: record.Id,
Btype: record.Btype,