From a6287def20563802e1698c2f150eb3b0ba623b59 Mon Sep 17 00:00:00 2001 From: iFish Date: Tue, 2 Dec 2014 14:24:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=83=A8=E5=88=86BUG?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=90=AF=E5=8A=A8=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8D=95=E6=8D=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TrainInfomationProviderService/Program.cs | 12 +++++++++++- .../TrainInfo/Entities/TrainInfoStorage.cs | 2 +- .../Web/Controllers/TransitController.cs | 10 ++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/TrainInfomationProviderService/Program.cs b/TrainInfomationProviderService/Program.cs index bfe4850..d2c8a62 100644 --- a/TrainInfomationProviderService/Program.cs +++ b/TrainInfomationProviderService/Program.cs @@ -30,7 +30,17 @@ namespace TrainInfomationProviderService public static void WebLoader() { RouteTable.Routes.MapRoute("traintransit", "tt/{action}/{id}", new { area = "", controller = "Transit", id = UrlParameter.Optional }, new { action = "(keepalive|ls|ss|tor|dt)" }, new[] { "TrainInfomationProviderService.Web" }); - Task.Run(() => Main(new string[0])); + Task.Run(() => + { + try + { + Main(new string[0]); + } + catch (Exception ex) + { + File.WriteAllText(HostingEnvironment.MapPath("~/err.log"), ex.ToString()); + } + }); var keepAliveUrl = ConfigurationManager.AppSettings["12306_keepaliveurl"]; if (!string.IsNullOrEmpty(keepAliveUrl)) diff --git a/TrainInfomationProviderService/TrainInfo/Entities/TrainInfoStorage.cs b/TrainInfomationProviderService/TrainInfo/Entities/TrainInfoStorage.cs index 6997f46..cc74992 100644 --- a/TrainInfomationProviderService/TrainInfo/Entities/TrainInfoStorage.cs +++ b/TrainInfomationProviderService/TrainInfo/Entities/TrainInfoStorage.cs @@ -65,7 +65,7 @@ namespace TrainInfomationProviderService.TrainInfo.Entities //load data var store = TrainInfoManager.Instance.DataStore.TrainData; - Trains = HashStore.Select(s => store[s]).ToList(); + Trains = HashStore.Select(s => store.GetValue(s)).ExceptNull().ToList(); TrainsCodeMap = Trains.GroupBy(s => s.Code).ToDictionary(s => s.Key, s => { var arr = s.ToArray(); diff --git a/TrainInfomationProviderService/Web/Controllers/TransitController.cs b/TrainInfomationProviderService/Web/Controllers/TransitController.cs index 2caf31d..9a44915 100644 --- a/TrainInfomationProviderService/Web/Controllers/TransitController.cs +++ b/TrainInfomationProviderService/Web/Controllers/TransitController.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text; using System.Web.Mvc; using FSLib.MvcWeb; using Newtonsoft.Json; @@ -29,6 +30,15 @@ namespace TrainInfomationProviderService.Web.Controllers #endregion + [ActionName("ls2")] + public ActionResult LogSameStation2(string data) + { + if (string.IsNullOrEmpty(data)) + return null; + + return LogSameStation(Encoding.UTF8.GetString(Convert.FromBase64String(data))); + } + [ActionName("ls")] public ActionResult LogSameStation(string data) {