public bool CheckWinNumbers(ISportAnteCode[] antecodeList, ISportResult[] winNumberList, out string errMsg) { PreconditionAssert.IsTrue((winNumberList != null && winNumberList.Length > 0), "必须传入比赛结果"); //if (winNumberList.Length != winNumberList.GroupBy(a => a.GetMatchId(GameCode)).Count()) //{ // errMsg = "比赛场次重复"; // return false; //} foreach (var code in winNumberList) { var ante = antecodeList.FirstOrDefault(a => a.MatchId == code.GetMatchId(GameCode)); if (ante != null) { var orderAnalyzer = AnalyzerFactory.GetSportAnteCodeChecker(GameCode, GameType); if (!orderAnalyzer.CheckWinNumber(code, ante.GameType, out errMsg)) { return(false); } } } errMsg = ""; return(true); }
public bool CheckAntecode(ISportAnteCode[] antecodeList, out string errMsg) { // 前置验证 - 彩种、玩法、投注号码 PreconditionAssert.IsNotEmptyString(GameCode, "检查投注号码格式前,必须设置彩种"); PreconditionAssert.IsNotEmptyString(GameType, "检查投注号码格式前,必须设置玩法"); PreconditionAssert.IsTrue((antecodeList != null && antecodeList.Length > 0), "必须传入投注号码"); //if (antecodeList.Length != antecodeList.GroupBy(a => a.MatchId).Count()) //{ // errMsg = "选择的比赛场次重复"; // return false; //} if (antecodeList.Length != antecodeList.GroupBy(a => new { MatchId = a.MatchId, GameType = a.GameType }).Count()) { errMsg = "选择的比赛场次重复"; return(false); } if (antecodeList.Length < BaseCount) { errMsg = "选择的比赛不够,当前串关方式至少需要 " + BaseCount + "场比赛"; return(false); } TuoNumbers = antecodeList.Where(a => !a.IsDan).ToArray(); DanNumbers = antecodeList.Where(a => a.IsDan).ToArray(); if (DanNumbers.Length > BaseCount) { errMsg = "胆码太多,当前串关方式最多允许 " + BaseCount + "个胆码"; return(false); } foreach (var code in antecodeList) { var type = string.IsNullOrEmpty(code.GameType) ? GameType : code.GameType; var orderAnalyzer = AnalyzerFactory.GetSportAnteCodeChecker(GameCode, type); if (!orderAnalyzer.CheckAntecodeNumber(code, out errMsg)) { return(false); } } errMsg = ""; return(true); }