Ejemplo n.º 1
0
        public static async Task <IForecastPlanModel> GetForecastData(LotteryType type, Planner planer, int rule)
        {
            var response = await HttpUtil.GetAsync(GetForecastUrl(type, planer, rule));

            try
            {
                if (string.IsNullOrWhiteSpace(response))
                {
                    return(null);
                }

                var result = JsonConvert.DeserializeObject <JinMaForecastPlanModel>(response);
                result.Plan = planer.GetPlan();
                if (result.ForecastData != null && result.ForecastData.Any())
                {
                    var current = result.ForecastData.LastOrDefault();
                    var pn      = current.LastDrawnPeriod % 1000 >= current.LastPeriod
                        ? current.LastPeriod / 1000 * 1000 + current.LastPeriod - 1
                        : current.LastDrawnPeriod;

                    current.LastDrawnPeriod = pn;
                    result.LastDrawnPeriod  = pn;
                }

                return(result);
            }
            catch (Exception ex)
            {
                ExceptionlessUtil.Warn(ex, $"预测数据反序列化失败,内容:{response}");
                return(null);
            }
        }
Ejemplo n.º 2
0
        private static async void Service_DataCollectedError(object sender, CollectErrorEventArgs e)
        {
            await Pk10Context.Clients.Groups(new List <string> {
                e.Rule.ToString(), "AllRules"
            })
            .SendAsync("NoResult", e.Rule.ToStringName());

            ExceptionlessUtil.Warn("目标网站扫水接口异常,请尽快检查恢复");
        }