Example #1
0
 private void PushOddsToRiskMan(int index)
 {
     try
     {
         var message = $"賽事編號:{MatchId},第{index + 1}次賠率資料傳送";
         SendRisk.DoOddsBatch(message, JsonConvert.SerializeObject(RiskOddsDataList[index]));
         Log.Info(message + $", Data => {JsonConvert.SerializeObject(RiskOddsDataList[index])}");
     }
     catch (Exception ex)
     {
         var lodData = JsonConvert.SerializeObject(Odds[index]);
         Log.Info($"賽事編號:{MatchId},第{index + 1}次失敗,失敗原因:{ex.Message},失敗原因:{ex.StackTrace}");
     }
 }
Example #2
0
        private void PushOddsToRiskMan(int index)
        {
            try
            {
                if (index + 1 > RiskOddsDataList.Count)
                {
                    Log.Info($"賽事編號:{MatchId},第{index + 1}次賠率資料送完");
                    //賠率送完即結算
                    DataSave.DoSettle(MatchId, 1); //全場
                    DataSave.DoSettle(MatchId, 2); //半場
                    //DataSave.SwitchOddsActive(MatchId);
                    CacheTool.MatchRemove(MatchId);
                    return;
                }
                var message = $"賽事編號:{MatchId},第{index + 1}次賠率資料傳送";
                SendRisk.DoOddsBatch(message, JsonConvert.SerializeObject(RiskOddsDataList[index]));

                Log.Info(message + $", Data => {JsonConvert.SerializeObject(RiskOddsDataList[index])}");

                int timer = 0;
                if (index <= RiskOddsDataList.Count - 1)
                {
                    timer = avgTimeForOddsRisk;
                }
                else
                {
                    timer = modTimeForOddsRisk;
                }

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