diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 1ff0c42..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,63 +0,0 @@
-###############################################################################
-# Set default behavior to automatically normalize line endings.
-###############################################################################
-* text=auto
-
-###############################################################################
-# Set default behavior for command prompt diff.
-#
-# This is need for earlier builds of msysgit that does not have it on by
-# default for csharp files.
-# Note: This is only used by command line
-###############################################################################
-#*.cs diff=csharp
-
-###############################################################################
-# Set the merge driver for project and solution files
-#
-# Merging from the command prompt will add diff markers to the files if there
-# are conflicts (Merging from VS is not affected by the settings below, in VS
-# the diff markers are never inserted). Diff markers may cause the following
-# file extensions to fail to load in VS. An alternative would be to treat
-# these files as binary and thus will always conflict and require user
-# intervention with every merge. To do so, just uncomment the entries below
-###############################################################################
-#*.sln merge=binary
-#*.csproj merge=binary
-#*.vbproj merge=binary
-#*.vcxproj merge=binary
-#*.vcproj merge=binary
-#*.dbproj merge=binary
-#*.fsproj merge=binary
-#*.lsproj merge=binary
-#*.wixproj merge=binary
-#*.modelproj merge=binary
-#*.sqlproj merge=binary
-#*.wwaproj merge=binary
-
-###############################################################################
-# behavior for image files
-#
-# image files are treated as binary by default.
-###############################################################################
-#*.jpg binary
-#*.png binary
-#*.gif binary
-
-###############################################################################
-# diff behavior for common document formats
-#
-# Convert binary document formats to text before diffing them. This feature
-# is only available from the command line. Turn it on by uncommenting the
-# entries below.
-###############################################################################
-#*.doc diff=astextplain
-#*.DOC diff=astextplain
-#*.docx diff=astextplain
-#*.DOCX diff=astextplain
-#*.dot diff=astextplain
-#*.DOT diff=astextplain
-#*.pdf diff=astextplain
-#*.PDF diff=astextplain
-#*.rtf diff=astextplain
-#*.RTF diff=astextplain
diff --git a/.vs/config/applicationhost.config b/.vs/config/applicationhost.config
new file mode 100644
index 0000000..efaeb9e
--- /dev/null
+++ b/.vs/config/applicationhost.config
@@ -0,0 +1,1036 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TrainInfomationProviderService/TrainInfo/Entities/Train.cs b/TrainInfomationProviderService/TrainInfo/Entities/Train.cs
index 5316ec8..7f6d3d5 100644
--- a/TrainInfomationProviderService/TrainInfo/Entities/Train.cs
+++ b/TrainInfomationProviderService/TrainInfo/Entities/Train.cs
@@ -12,6 +12,13 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
{
public class Train : IEquatable
{
+ ///
+ /// 创建 的新实例(Train)
+ ///
+ public Train()
+ {
+ }
+
///
/// ID
///
@@ -21,8 +28,24 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
///
/// 列车编号
///
- [JsonProperty("c")]
- public string Code { get; set; }
+ [JsonIgnore]
+ public string Code
+ {
+ get { return _code ?? (_code = Codes.JoinAsString("/")); }
+ set
+ {
+ if (value.IsNullOrEmpty() || Codes.Contains(value))
+ return;
+
+
+ if (!Codes.Contains(value))
+ Codes.Add(value);
+ _code = null;
+ }
+ }
+
+ [JsonProperty("cl")]
+ public HashSet Codes { get; } = new HashSet(StringComparer.OrdinalIgnoreCase);
///
/// 发站
@@ -44,7 +67,7 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
string _trainHash;
-
+
[JsonIgnore]
public string TrainHash
{
@@ -61,7 +84,7 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
string CalculateTrainHash()
{
- var data= Id + Code + TrainStops.Select(s => s.Code + (s.Arrive == null ? "" : ((int)s.Arrive.Value.TotalSeconds).ToString()) + ">" + (s.Left == null ? "" : ((int)s.Left.Value.TotalSeconds).ToString())).JoinAsString("|");
+ var data = Id + TrainStops.Select(s => s.Code + (s.Arrive == null ? "" : ((int)s.Arrive.Value.TotalSeconds).ToString()) + ">" + (s.Left == null ? "" : ((int)s.Left.Value.TotalSeconds).ToString())).JoinAsString("|");
return data.ToLower().MD5();
}
@@ -96,7 +119,8 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
{
if (string.IsNullOrEmpty(_key))
{
- _key = Id + Code + From + To;
+ //MOD: 仅用ID,不使用车次编号。
+ _key = Id + From + To;
}
return _key;
@@ -132,6 +156,7 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
#endregion
char? _trainClass;
+ string _code;
///
/// 列车等级
diff --git a/TrainInfomationProviderService/TrainInfo/WebDataProvider.cs b/TrainInfomationProviderService/TrainInfo/WebDataProvider.cs
index bae5365..656d1bd 100644
--- a/TrainInfomationProviderService/TrainInfo/WebDataProvider.cs
+++ b/TrainInfomationProviderService/TrainInfo/WebDataProvider.cs
@@ -133,7 +133,7 @@ namespace TrainInfomationProviderService.TrainInfo
indexStorage.TrainInfoStorages.Add(date, curStorage);
}
- var allkeys = curStorage.Trains.Select(s => s.Key).ToHashSet(StringComparer.OrdinalIgnoreCase);
+ var allkeys = curStorage.Trains.ToDictionary(s => s.Key, StringComparer.OrdinalIgnoreCase);
//所有的车次
var alltrains = dateSt.Values.SelectMany(s => s).Select(s =>
{
@@ -145,12 +145,16 @@ namespace TrainInfomationProviderService.TrainInfo
i.Id = s.train_no;
return !string.IsNullOrEmpty(i.From) && !string.IsNullOrEmpty(i.To) ? i : null;
- }).ExceptNull().Where(s => !allkeys.Contains(s.Key)).ToArray();
+ }).ExceptNull().ToArray();
var index = 0;
foreach (var train in alltrains)
{
- if (allkeys.Contains(train.Key))
+ if (allkeys.ContainsKey(train.Key))
+ {
+ //增加车次编号
+ allkeys[train.Key].Code = train.Code;
continue;
+ }
//加载车次停靠站信息
LoadTrainStopInfo(++index, alltrains.Length, date, train);
diff --git a/Web12306/js/ui/chat/chatframe.js b/Web12306/js/ui/chat/chatframe.js
index d9ad7ba..c4a2be6 100644
--- a/Web12306/js/ui/chat/chatframe.js
+++ b/Web12306/js/ui/chat/chatframe.js
@@ -8,20 +8,6 @@
//frames
var servernode = require("./servernode.js");
- servernode.on("roomSelectHide", function () {
- hideChatFrameUI();
- showChatFloatTip();
- });
- servernode.on("chatServerLoaded", function (e, serverList) {
- servers = serverList;
- if (servers)
- showChatFloatTip();
- port.postMessage("getCurrentRoomInfo");
- });
- servernode.on("enterRoot", function (e, room) {
- //进入房间
- sessMgr.ensureLogined(enterroom.bind(room));
- });
//服务器
var servers;
@@ -73,14 +59,29 @@
}
});
- (function ui() {
- $("#chat_float_tip").click(showServerList);
- })();
+ $("#chat_float_tip").click(showServerList);
+
+ //加载服务器节点列表
servernode.loadServers();
setTimeout(function() {
servernode.loadServers();
}, 1000 * 60 * 11);
+ servernode.on("roomSelectHide", function () {
+ hideChatFrameUI();
+ showChatFloatTip();
+ });
+ servernode.on("chatServerLoaded", function (e, serverList) {
+ servers = serverList;
+ if (servers)
+ showChatFloatTip();
+ port.postMessage("getCurrentRoomInfo");
+ });
+ servernode.on("enterRoot", function (e, room) {
+ //进入房间
+ sessMgr.ensureLogined(enterroom.bind(room));
+ });
+
return {
};
diff --git a/Web12306/js/ui/chat/servernode.js b/Web12306/js/ui/chat/servernode.js
index b63ab55..ba16bad 100644
--- a/Web12306/js/ui/chat/servernode.js
+++ b/Web12306/js/ui/chat/servernode.js
@@ -78,7 +78,7 @@
if (server.statusName === "full") {
mp.showMessagePopup("error", "亲,房间已满,换个房间呗~");
- } else if (server.statusName == "closed") {
+ } else if (server.statusName === "closed") {
mp.showMessagePopup("error", "亲,这个房间暂时关闭了,换个房间呗~~");
} else
instance.fireEvent("enterRoot", server);
diff --git a/Web12306/js/ui/widget_datebar.js b/Web12306/js/ui/widget_datebar.js
index aef2e25..1904a9b 100644
--- a/Web12306/js/ui/widget_datebar.js
+++ b/Web12306/js/ui/widget_datebar.js
@@ -76,7 +76,7 @@
name: namestr[d.getDay()],
date: formatDate(d),
disabled: d < today || d > maxdays,
- selected: d.getTime() == today.getTime(),
+ selected: d.getTime() === today.getTime(),
datecode: getDateString(d)
});
}