Exemplo n.º 1
0
        private void PushOddstToSportServer(int index)
        {
            try
            {
                Odds[index].Status = 1;
                var ot = new OperationRequest
                {
                    OperationCode = (int)OperationCode.MainService,
                    ActionCode    = (int)MainServiceActionCode.BroadcastOdds,
                    Parameters    = new Dictionary <byte, object> {
                        { 1, Odds[index] }
                    }
                };
                var lodData = JsonConvert.SerializeObject(Odds[index]);
                Log.Info($"賽事編號:{MatchId},第{index + 1}次發送賠率資料:{lodData}");

                var pevMsgNr = (index == 0) ? 0 : Odds[index - 1].MsgNr;
                if (Odds[index].MsgNr > pevMsgNr || pevMsgNr == 0)
                {
                    DataSave.SwitchOddsActive(Odds[index].MatchId, /*Odds[index].OddsId,*/ Odds[index].MsgNr);
                    DataSave.UpdateMatchCurrentPeriodStart(Odds[index].MatchId);
                }
            }
            catch (Exception ex)
            {
                var lodData = JsonConvert.SerializeObject(Odds[index]);
                Log.Info($"賽事編號:{MatchId},第{index + 1}次失敗,失敗原因:{ex.Message},失敗原因:{ex.StackTrace}");
            }
        }
Exemplo n.º 2
0
        private void PushProcess(int oIndex, int sIndex)
        {
            try
            {
                if (oIndex + 1 > Odds.Length)
                {
                    Log.Info($"賽事編號:{MatchId} 第{sIndex + 1}次走地資料送完");
                    Log.Info($"賽事編號:{MatchId},第{oIndex + 1}次賠率資料送完");
                    DataSave.SwitchOddsActive(MatchId);
                    //賠率送完即結算
                    DataSave.DoSettle(MatchId, 1); //全場
                    DataSave.DoSettle(MatchId, 2); //半場
                    CacheTool.MatchRemove(MatchId);
                    return;
                }

                if (sIndex == 0 || oIndex == modIndex || (oIndex - modIndex) % avgIndex == 0)
                {
                    PushScoutToMq(sIndex);
                }

                PushOddstToSportServer(oIndex);
            }
            catch (Exception ex)
            {
                Log.Info($"賽事編號:{MatchId},第{oIndex + 1}次oIndex失敗,失敗原因:{ex.Message},失敗原因:{ex.StackTrace}");
            }
        }
Exemplo n.º 3
0
        private void PushOddstToSportServer(int index)
        {
            try
            {
                if (index + 1 > Odds.Length)
                {
                    Log.Info($"賽事編號:{MatchId},第{index + 1}次賠率資料送完");
                    DataSave.SwitchOddsActive(MatchId);
                    CacheTool.MatchRemove(MatchId);
                    return;
                }

                Odds[index].Status = 1;
                var ot = new OperationRequest
                {
                    OperationCode = (int)OperationCode.MainService,
                    ActionCode    = (int)MainServiceActionCode.BroadcastOdds,
                    Parameters    = new Dictionary <byte, object> {
                        { 1, Odds[index] }
                    }
                };
                var lodData = JsonConvert.SerializeObject(Odds[index]);
                Log.Info($"賽事編號:{MatchId},第{index + 1}次發送賠率資料:{lodData}");

                var pevMsgNr = (index == 0) ? 0 : Odds[index - 1].MsgNr;
                if (Odds[index].MsgNr > pevMsgNr || pevMsgNr == 0)
                {
                    DataSave.SwitchOddsActive(Odds[index].MatchId, /*Odds[index].OddsId,*/ Odds[index].MsgNr);
                    DataSave.UpdateMatchCurrentPeriodStart(Odds[index].MatchId);
                }

                int timer = 0;
                if (index <= Odds.Length - 1)
                {
                    timer = avgTimeForOdds;
                }
                else
                {
                    timer = modTimeForOdds;
                }

                Nami.Delay(timer).Do(() =>
                {
                    PushOddstToSportServer(index + 1);
                });
            }
            catch (Exception ex)
            {
                var lodData = JsonConvert.SerializeObject(Odds[index]);
                Log.Info($"賽事編號:{MatchId},第{index + 1}次失敗,失敗原因:{ex.Message},失敗原因:{ex.StackTrace}");
            }
        }