diff --git a/RwTicketAssistantV2/app/background.js b/RwTicketAssistantV2/app/background.js
index 175d597..04ffa42 100644
--- a/RwTicketAssistantV2/app/background.js
+++ b/RwTicketAssistantV2/app/background.js
@@ -730,6 +730,38 @@ window.cbl = function (u, h) {
}
};
+ var ajaxWrapper = function (url, host) {
+ var def = new $.Deferred();
+
+ chrome.tabs.httpRequest(url, "User-Agent: MSIE 9.0\r\nHost: " + host, 3000, function (result) {
+ var resp = null;
+ try {
+ resp = JSON.parse(result);
+ } catch (e) {
+
+ }
+ if (!resp) {
+ def.reject(0, 'unknown error.');
+ return;
+ }
+ var a = resp[0];
+ var b = resp[1];
+ var c = resp[2];
+ if (!a) {
+ if (b === 10001) {
+ //timeout
+ def.reject(0, 'timeout');
+ } else {
+ def.reject(b, c);
+ }
+ } else {
+ def.resolve(c, b);
+ }
+ });
+
+ return def.promise();
+ };
+
var testServer = function (server, callback) {
server = server[0];
server.host = server.host || "kyfw.12306.cn";
@@ -737,15 +769,8 @@ window.cbl = function (u, h) {
var url = "https://" + server.ip + "/otn/";
var time = new Date();
- $.ajax(url, {
- timeout: 4000,
- method: "GET",
- headers: {
- "Host": server.host
- },
- dataType: "text"
- }).done(function (text) {
- if (text.indexOf("客运服务") !== -1)
+ ajaxWrapper(url, server.host).done(function (text) {
+ if (!text || text.indexOf("客运服务") !== -1)
server.speed = new Date() - time;
else {
server.speed = -2;
@@ -972,12 +997,7 @@ window.cbl = function (u, h) {
return;
}
//测试是否有代理服务器
- $.ajax("https://" + localDns['kyfw.12306.cn'][0] + "/otn/", {
- method: "GET",
- headers: {
- Host: "kyfw.12306.cn"
- }
- }).done(function () {
+ ajaxWrapper("https://" + localDns['kyfw.12306.cn'][0] + "/otn/", "kyfw.12306.cn").done(function () {
checkAndStart();
}).fail(function () {
valid = -1;
@@ -1339,6 +1359,7 @@ window.cbl = function (u, h) {
var socket = null;
var that = this;
var heratBeatTimer = null;
+ var roomId;
var sendHeartBeat = function () {
if (socket && socket.readyState === 1) {
@@ -1348,6 +1369,7 @@ window.cbl = function (u, h) {
var connect = function (room) {
currentRoom = room;
var url = currentRoom.url;
+ roomId = room.id;
if (socket !== null && socket.url !== url)
disconnect();
@@ -1357,6 +1379,7 @@ window.cbl = function (u, h) {
socket.onclose = function () {
socket = null;
postMessageToPort({ action: "chatRoomDisconnected" });
+ $.post("http://12306.liebao.cn/index.php?r=Api/GetRoomOnlineNum", { roomId: roomId });
};
socket.onopen = function () {
postMessageToPort({ action: "chatRoomConnected" });
@@ -1364,6 +1387,9 @@ window.cbl = function (u, h) {
if (currentRoom.heartbeat && !heratBeatTimer) {
heratBeatTimer = setInterval(sendHeartBeat, currentRoom.heartbeat);
};
+
+ //trigger
+ $.post("http://12306.liebao.cn/index.php?r=Api/GetRoomOnlineNum", { roomId: roomId });
};
socket.onmessage = function (e) {
var tmsg = e.data;
diff --git a/RwTicketAssistantV2/app/manifest.json b/RwTicketAssistantV2/app/manifest.json
index ce1746e..db68bbf 100644
--- a/RwTicketAssistantV2/app/manifest.json
+++ b/RwTicketAssistantV2/app/manifest.json
@@ -56,7 +56,7 @@
"description": "12306订票助手 v6: 帮您订票的小助手 by 木鱼,全力为您的车票购买献计献策!",
"key": "7k6gnXVACvUPU2DfslJgSrWJTHqIg5uwd+Kgl/5zSg==",
"name": "12306订票助手V6/猎豹抢票党",
- "version": "6.3.0",
+ "version": "7.0.0",
"manifest_version": 2,
"icons": {
"16": "icons/icon_16.png",
diff --git a/Web12306/CrxHandler.cs b/Web12306/CrxHandler.cs
new file mode 100644
index 0000000..81101c0
--- /dev/null
+++ b/Web12306/CrxHandler.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace Web12306
+{
+ public class CrxHandler:IHttpHandler
+ {
+ #region Implementation of IHttpHandler
+
+ ///
+ /// 通过实现 接口的自定义 HttpHandler 启用 HTTP Web 请求的处理。
+ ///
+ /// 对象,它提供对用于为 HTTP 请求提供服务的内部服务器对象(如 Request、Response、Session 和 Server)的引用。
+ public void ProcessRequest(HttpContext context)
+ {
+ var request = context.Request;
+ var response = context.Response;
+
+ response.Redirect("http://www.fishlee.net/service/download/383");
+ }
+
+ ///
+ /// 获取一个值,该值指示其他请求是否可以使用 实例。
+ ///
+ ///
+ /// 如果 实例可再次使用,则为 true;否则为 false。
+ ///
+ public bool IsReusable {
+ get { return false; }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Web12306/Properties/AssemblyInfo.cs b/Web12306/Properties/AssemblyInfo.cs
index 97dc5a2..a92f117 100644
--- a/Web12306/Properties/AssemblyInfo.cs
+++ b/Web12306/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// 你可以指定所有值,也可以让修订版本和内部版本号采用默认值,
// 方法是按如下所示使用 "*":
-[assembly: AssemblyVersion("1.0.14244.60")]
+[assembly: AssemblyVersion("1.0.15002.62")]
[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Web12306/TrainSuggestion.cs b/Web12306/TrainSuggestion.cs
index 7e7a8f8..198bba7 100644
--- a/Web12306/TrainSuggestion.cs
+++ b/Web12306/TrainSuggestion.cs
@@ -652,6 +652,12 @@ namespace Web12306
public DateTime Date { get; set; }
+ [JsonProperty("tt")]
+ public string[] SelectedTrain { get; set; }
+
+ [JsonProperty("ts")]
+ public string[] SelectedSeats { get; set; }
+
public Dictionary Stops { get; set; }
///
@@ -665,6 +671,15 @@ namespace Web12306
if (Stops.Values.Any(s => (s.TrainInfo.code == s.TrainInfo.from.code && s.TrainInfo.to.code == s.TrainInfo.end.code) || s.TrainInfo.available < 0))
return true;
+ //add 2014年9月4日 - 检测非法席别
+ if (SelectedSeats == null)
+ return true;
+ if (SelectedSeats.Length > 0)
+ {
+ if (Stops.Values.Any(s => !SelectedSeats.Any(x => s.TrainInfo.ticketMap.ContainsKey(x[0]))))
+ return true;
+ }
+
return false;
}
diff --git a/Web12306/Web12306.csproj b/Web12306/Web12306.csproj
index d4a8ce7..b6f039c 100644
--- a/Web12306/Web12306.csproj
+++ b/Web12306/Web12306.csproj
@@ -128,6 +128,7 @@
+
Global.asax
@@ -165,7 +166,6 @@
-
diff --git a/Web12306/css/index.css b/Web12306/css/index.css
index 98fb1b3..989095d 100644
--- a/Web12306/css/index.css
+++ b/Web12306/css/index.css
@@ -103,6 +103,8 @@
#wx_sell_notification p.code span {
color: red;
+ font-weight: bold;
+ text-transform: uppercase;
}
#wx_sell_notification span.hand {
diff --git a/Web12306/index.html b/Web12306/index.html
index e590491..8005ac0 100644
--- a/Web12306/index.html
+++ b/Web12306/index.html
@@ -436,7 +436,7 @@
关闭
- 购票提示
+
@@ -1112,5 +1112,13 @@
+