--[[ 公平竞技3V3自己的比赛信息 ]] local TeamFairChampionshipMyMatchInfo = class("TeamFairChampionshipMyMatchInfo") function TeamFairChampionshipMyMatchInfo:initialize() --服务器协议数据,外部只允许访问 self.serverInfo = nil end function TeamFairChampionshipMyMatchInfo:SetMyServerMatchInfo(serverInfo) self.serverInfo = serverInfo end function TeamFairChampionshipMyMatchInfo:UpdateMyBetInfo(battleBetNum, betInfo) self.serverInfo.battleBetNum = battleBetNum local updateBetInfo = nil if betInfo.stageId == MDL.TeamFairChampionship.Stage.Filtration_1 or betInfo.stageId == MDL.TeamFairChampionship.Stage.Filtration_2 then updateBetInfo = self:GetTeamBetInfo(betInfo.stageId, betInfo.matchGroupId, betInfo.betTeamId) else updateBetInfo = self:GetGroupBetInfo(betInfo.stageId, betInfo.matchGroupId, betInfo.groupId) end if not updateBetInfo then table.insert(self.serverInfo.betInfo, betInfo) else updateBetInfo.betTeamId = betInfo.betTeamId updateBetInfo.betNum = betInfo.betNum end end --获取竞猜信息 function TeamFairChampionshipMyMatchInfo:GetTeamBetInfo(betStageId, betMatchGroupId, betTeamId) for __, betInfo in ipairs(self.serverInfo.betInfo) do local isStageEqual = false if betStageId == MDL.TeamFairChampionship.Stage.Filtration_1 or betStageId == MDL.TeamFairChampionship.Stage.Filtration_2 then isStageEqual = betInfo.stageId == MDL.TeamFairChampionship.Stage.Filtration_1 or betInfo.stageId == MDL.TeamFairChampionship.Stage.Filtration_2 else isStageEqual = betInfo.stageId == betStageId end if isStageEqual and betInfo.matchGroupId == betMatchGroupId then if string.isNilOrEmpty(betTeamId) then return betInfo elseif betInfo.betTeamId == betTeamId then return betInfo end end end return nil end function TeamFairChampionshipMyMatchInfo:GetGroupBetInfo(betStageId, betMatchGroupId, betGroupId) for __, betInfo in ipairs(self.serverInfo.betInfo) do local isStageEqual = false if betStageId == MDL.TeamFairChampionship.Stage.Filtration_1 or betStageId == MDL.TeamFairChampionship.Stage.Filtration_2 then isStageEqual = betInfo.stageId == MDL.TeamFairChampionship.Stage.Filtration_1 or betInfo.stageId == MDL.TeamFairChampionship.Stage.Filtration_2 else isStageEqual = betInfo.stageId == betStageId end if isStageEqual and betInfo.matchGroupId == betMatchGroupId then if betGroupId and betGroupId>0 then if betInfo.groupId == betGroupId then return betInfo end else return betInfo end end end return nil end return TeamFairChampionshipMyMatchInfo