Exemplo n.º 1
0
        private void PushScoutToMq(int index)
        {
            try
            {
                Scout[index].Type = Scout[index].TypeId;
                if (Scout[index].Type == 1013 && (Scout[index].ExtraInfo == 6 ||
                                                  Scout[index].ExtraInfo == 7 ||
                                                  Scout[index].ExtraInfo == 31 ||
                                                  Scout[index].ExtraInfo == 100))
                {
                    DataSave.UpdateMatchCurrentPeriodStart(MatchId);
                    DataSave.UpdateMatchStatus(MatchId, Scout[index].ExtraInfo);
                }

                if (index > 1 && Scout[index].MatchScore != Scout[index - 1].MatchScore)
                {
                    DataSave.UpdateMatcScore(MatchId, Scout[index].MatchScore);
                }

                var tj = new TransJson
                {
                    Success = true,
                    Code    = "1.0",
                    Message = null,
                    Key     = "RMQ_LiveCompetition",
                    Result  = Scout[index]
                };
                //走地動畫
                ToMq("livescout", Scout[index].MatchId.ToString(), JsonConvert.SerializeObject(tj));
                //通知 Clinet 狀態
                var tSportServer = JsonConvert.SerializeObject(Scout[index]);
                ToMq("livescout", "sport.server", tSportServer);

                Log.Info($"賽事編號:{MatchId} 第{index + 1}次走地動畫&通知推送 {tSportServer}");
            }
            catch (Exception ex)
            {
                var tSportServer = JsonConvert.SerializeObject(Scout[index]);
                Log.Info($"賽事編號:{MatchId},第{index + 1}次失敗,失敗原因:{ex.Message}, 失敗原因:{ex.StackTrace}");
            }
        }