diff --git a/Web12306/Servers/TrainSuggestion/TrainSuggestionHandler.cs b/Web12306/Servers/TrainSuggestion/TrainSuggestionHandler.cs
index 6732d07..ff22bf8 100644
--- a/Web12306/Servers/TrainSuggestion/TrainSuggestionHandler.cs
+++ b/Web12306/Servers/TrainSuggestion/TrainSuggestionHandler.cs
@@ -1,4 +1,4 @@
-namespace Web12306.Servers.TrainSuggestion
+锘縩amespace Web12306.Servers.TrainSuggestion
{
using System;
using System.Collections.Generic;
@@ -16,9 +16,9 @@ namespace Web12306.Servers.TrainSuggestion
#region Implementation of IHttpHandler
///
- /// 通过实现 接口的自定义 HttpHandler 启用 HTTP Web 请求的处理。
+ /// 閫氳繃瀹炵幇 鎺ュ彛鐨勮嚜瀹氫箟 HttpHandler 鍚敤 HTTP Web 璇锋眰鐨勫鐞嗐
///
- /// 对象,它提供对用于为 HTTP 请求提供服务的内部服务器对象(如 Request、Response、Session 和 Server)的引用。
+ /// 瀵硅薄锛屽畠鎻愪緵瀵圭敤浜庝负 HTTP 璇锋眰鎻愪緵鏈嶅姟鐨勫唴閮ㄦ湇鍔″櫒瀵硅薄锛堝 Request銆丷esponse銆丼ession 鍜 Server锛夌殑寮曠敤銆
public void ProcessRequest(HttpContext context)
{
var request = context.Request;
@@ -49,7 +49,7 @@ namespace Web12306.Servers.TrainSuggestion
context.Response.AddHeader("Access-Control-Allow-Origin", origin);
else
{
- //非法提交
+ //闈炴硶鎻愪氦
return;
}
}
@@ -80,12 +80,12 @@ namespace Web12306.Servers.TrainSuggestion
{
//log error
var sb = new StringBuilder();
- sb.AppendLine(string.Format("请求URL: {0}", context.Request.Url));
- sb.AppendLine("数据:");
+ sb.AppendLine(string.Format("璇锋眰URL锛 {0}", context.Request.Url));
+ sb.AppendLine("鏁版嵁:");
sb.AppendLine(data);
sb.AppendLine();
- sb.AppendLine("错误信息:");
+ sb.AppendLine("閿欒淇℃伅:");
sb.AppendLine(ex.ToString());
var log = DateTime.Now.Ticks + ".log";
@@ -115,16 +115,16 @@ namespace Web12306.Servers.TrainSuggestion
}
///
- /// 获取一个值,该值指示其他请求是否可以使用 实例。
+ /// 鑾峰彇涓涓硷紝璇ュ兼寚绀哄叾浠栬姹傛槸鍚﹀彲浠ヤ娇鐢 瀹炰緥銆
///
///
- /// 如果 实例可再次使用,则为 true;否则为 false。
+ /// 濡傛灉 瀹炰緥鍙啀娆′娇鐢紝鍒欎负 true锛涘惁鍒欎负 false銆
///
public bool IsReusable { get { return true; } }
#endregion
- #region 生成建议
+ #region 鐢熸垚寤鸿
static JsonSerializerSettings _camelJsonSetting = new JsonSerializerSettings
{
@@ -141,13 +141,13 @@ namespace Web12306.Servers.TrainSuggestion
SuggestionResponse GetSuggestionResponseContentCore(RequestInfo ri)
{
- //预处理
+ //棰勫鐞
PreProcessRequestData(ri);
- //获得所有的可替换站点
+ //鑾峰緱鎵鏈夌殑鍙浛鎹㈢珯鐐
var alllines = ri.Stops.Values.SelectMany(s => GetAlternativeLines(s, ri.Date) ?? new List()).Where(s => s != null).ToArray();
- //对线路进行分组排序
+ //瀵圭嚎璺繘琛屽垎缁勬帓搴
var lineGrouped = alllines.GroupBy(s => s.LineName).Select(s =>
{
var list = s.ToList();
@@ -155,18 +155,18 @@ namespace Web12306.Servers.TrainSuggestion
return new AlternativeLineGroup(f.From.Name, f.To.Name, f.Date, list, f.IsCrossDate);
}).ToList();
- //过滤
+ //杩囨护
FilteAlternativeLine(ri, lineGrouped);
- //填充数据
+ //濉厖鏁版嵁
FillExtraInfo(ri, lineGrouped);
- //排序
+ //鎺掑簭
SortLineRecommand(ri, lineGrouped);
return new SuggestionResponse()
{
- Key = "盗用可耻,鄙视无耻的各个国产IT同行!",
+ Key = "鐩楃敤鍙伙紝閯欒鏃犺荤殑鍚勪釜鍥戒骇IT鍚岃锛",
Accepted = true,
Groups = lineGrouped
};
@@ -187,10 +187,10 @@ namespace Web12306.Servers.TrainSuggestion
for (var j = line[i].Lines.Count - 1; j >= 0; j--)
{
var current = line[i].Lines[j];
- //如果同时是发站和到站,则删除不推荐
+ //濡傛灉鍚屾椂鏄彂绔欏拰鍒扮珯锛屽垯鍒犻櫎涓嶆帹鑽
if (current.From.IsOriginal && current.To.IsOriginal)
line[i].Lines.RemoveAt(j);
- //如果时间会超过原来最大的允许值,则排除
+ //濡傛灉鏃堕棿浼氳秴杩囧師鏉ユ渶澶х殑鍏佽鍊硷紝鍒欐帓闄
else if (current.ElapsedTime > maxAllowElapsedTime)
line[i].Lines.RemoveAt(j);
}
@@ -202,7 +202,7 @@ namespace Web12306.Servers.TrainSuggestion
}
///
- /// 根据停靠站获得权重
+ /// 鏍规嵁鍋滈潬绔欒幏寰楁潈閲
///
///
///
@@ -231,14 +231,14 @@ namespace Web12306.Servers.TrainSuggestion
if (x.Lines.Count != y.Lines.Count)
return y.Lines.Count - x.Lines.Count;
- //再看停靠时间
+ //鍐嶇湅鍋滈潬鏃堕棿
var ep1 = (int)x.Lines.Min(s => s.From.StopTime + s.To.StopTime).TotalSeconds;
var ep2 = (int)y.Lines.Min(s => s.From.StopTime + s.To.StopTime).TotalSeconds;
if (ep1 != ep2)
return ep2 - ep1;
- //再看价格
+ //鍐嶇湅浠锋牸
var ap1 = x.Lines.Min(s => s.Radio);
var ap2 = y.Lines.Min(s => s.Radio);
if (ap1 != ap2)
@@ -246,22 +246,22 @@ namespace Web12306.Servers.TrainSuggestion
return 0;
});
- //最多推荐5条线路
+ //鏈澶氭帹鑽5鏉$嚎璺
if (line.Count > 5)
line.RemoveRange(5, line.Count - 5);
- //再对组内排序
+ //鍐嶅缁勫唴鎺掑簭
foreach (var current in line)
{
current.Lines.Sort((x, y) =>
{
- //再看停靠时间
+ //鍐嶇湅鍋滈潬鏃堕棿
var ep1 = (int)(x.From.StopTime + x.To.StopTime).TotalSeconds;
var ep2 = (int)(y.From.StopTime + y.To.StopTime).TotalSeconds;
if (ep1 != ep2)
return ep2 - ep1;
- //再看价格
+ //鍐嶇湅浠锋牸
var ap1 = (int)x.ExtraPrice;
var ap2 = (int)y.ExtraPrice;
if (ap1 != ap2)
@@ -281,7 +281,7 @@ namespace Web12306.Servers.TrainSuggestion
var train = ri.Stops[line[i].Lines[j].TrainCode];
var current = line[i].Lines[j];
var originalTime = train.TrainInfo.elapsedTime.Value;
- //如果时间会超过原来最大的允许值,则排除
+ //濡傛灉鏃堕棿浼氳秴杩囧師鏉ユ渶澶х殑鍏佽鍊硷紝鍒欐帓闄
var priceExtraRadio = ((current.ElapsedTime - originalTime).TotalSeconds / (1.0 * originalTime.TotalSeconds));
current.BasePriceSeat = Cn12306SuggestionUtility.BaseSeatCodes.First(s => train.TrainInfo.ticketMap.ContainsKey(s));
current.BasePrice = train.TrainInfo.ticketMap[current.BasePriceSeat].price / 10.0;
@@ -312,20 +312,20 @@ namespace Web12306.Servers.TrainSuggestion
var arriveTime = stops[indexFrom].ArriveTime;
for (var i = 0; i < indexFrom; i++)
{
- //如果isEnabled为true,则说明会停靠这个站点。不能推荐更短的。
- //如果时间过久,则不做推荐
+ //濡傛灉isEnabled涓簍rue锛屽垯璇存槑浼氬仠闈犺繖涓珯鐐广備笉鑳芥帹鑽愭洿鐭殑銆
+ //濡傛灉鏃堕棿杩囦箙锛屽垯涓嶅仛鎺ㄨ崘
if (stops[i].isEnabled || stops[i].StartTime - arriveTime > maxAddTime)
continue;
var stopTime = i == 0 ? TimeSpan.Zero : stops[i].StopTime;
if (i != 0)
{
- //对于非始发站,停靠时间相同或更短,则不做推荐。
+ //瀵逛簬闈炲鍙戠珯锛屽仠闈犳椂闂寸浉鍚屾垨鏇寸煭锛屽垯涓嶅仛鎺ㄨ崘銆
if (stopTime < stopTimeFrom && i < indexFrom - 3)
continue;
}
- //添加到推荐列表中
+ //娣诲姞鍒版帹鑽愬垪琛ㄤ腑
altFrom.Add(new AlternativeStation()
{
ArriveTime = stops[i].StartTime,
@@ -340,7 +340,7 @@ namespace Web12306.Servers.TrainSuggestion
});
}
- //排序
+ //鎺掑簭
altFrom.Sort(new AlternativeStationComparer());
if (altFrom.Count > 5)
altFrom.RemoveRange(5, altFrom.Count - 5);
@@ -352,20 +352,20 @@ namespace Web12306.Servers.TrainSuggestion
for (var i = stops.Length - 1; i >= indexTo; i--)
{
- //如果isEnabled为true,则说明会停靠这个站点。不能推荐更短的。
- //如果时间过久,则不做推荐
+ //濡傛灉isEnabled涓簍rue锛屽垯璇存槑浼氬仠闈犺繖涓珯鐐广備笉鑳芥帹鑽愭洿鐭殑銆
+ //濡傛灉鏃堕棿杩囦箙锛屽垯涓嶅仛鎺ㄨ崘
if (stops[i].isEnabled || stops[i].ArriveTime - startTime > maxAddTime)
continue;
var stopTime = i == 0 ? TimeSpan.Zero : stops[i].StopTime;
if (i != stops.Length - 1)
{
- //对于非终到站,停靠时间相同或更短,则不做推荐。
+ //瀵逛簬闈炵粓鍒扮珯锛屽仠闈犳椂闂寸浉鍚屾垨鏇寸煭锛屽垯涓嶅仛鎺ㄨ崘銆
if (stopTime < stopTimeTo && i > indexTo + 3)
continue;
}
- //添加到推荐列表中
+ //娣诲姞鍒版帹鑽愬垪琛ㄤ腑
altTo.Add(new AlternativeStation()
{
ArriveTime = stops[i].ArriveTime,
@@ -381,7 +381,7 @@ namespace Web12306.Servers.TrainSuggestion
if (altTo.Count > 5)
altTo.RemoveRange(5, altTo.Count - 5);
}
- //plus 原始线路
+ //plus 鍘熷绾胯矾
altFrom.Add(new AlternativeStation
{
ArriveTime = stops[indexFrom].StartTime,
diff --git a/Web12306/Web.config b/Web12306/Web.config
index 043a3cc..d0a60e5 100644
--- a/Web12306/Web.config
+++ b/Web12306/Web.config
@@ -35,7 +35,7 @@
-
+
diff --git a/Web12306/css/ui/widget-ticketsubmit.css b/Web12306/css/ui/widget-ticketsubmit.css
index f2711f8..04a4b97 100644
--- a/Web12306/css/ui/widget-ticketsubmit.css
+++ b/Web12306/css/ui/widget-ticketsubmit.css
@@ -222,8 +222,8 @@
line-height: 20px;
margin-top: 16px;*/
position: absolute;
- right: 0;
- top: 0;
+ right: 10px;
+ top: 5px;
font-size: 14px;
color: #8d5000;
text-decoration: underline;
diff --git a/Web12306/js/data.js b/Web12306/js/data.js
index f4cb56c..876c0f0 100644
--- a/Web12306/js/data.js
+++ b/Web12306/js/data.js
@@ -13,19 +13,19 @@
return;
console.log.apply(console, arguments);
};
- exports.stationReportApi = "http://srv.12306.liebao.cn/tt/ls2";
- exports.trainSuggestApi = "http://srv.12306.liebao.cn/ts";
- exports.onceTransitApi = "http://srv.12306.liebao.cn/tt/tor";
- exports.chatServerGetAddressApi = "http://12306.liebao.cn/index.php?r=Api/GetRoomKey";
- exports.chatReportUrl = "http://12306.liebao.cn/index.php?r=Api/AbuseReport";
- exports.sysNoticeUrl = "http://12306.liebao.cn/index.php?r=Api/GetNotificationList";
+ exports.stationReportApi = "http://srv.12306.liebao.cn/st/ls2";
+ exports.trainSuggestApi = "http://srv.12306.liebao.cn/ets.axd";
+ exports.onceTransitApi = "http://srv.12306.liebao.cn/st/tor";
+ //exports.chatServerGetAddressApi = "http://12306.liebao.cn/index.php?r=Api/GetRoomKey";
+ //exports.chatReportUrl = "http://12306.liebao.cn/index.php?r=Api/AbuseReport";
+ exports.sysNoticeUrl = "http://srv.12306.liebao.cn/announcement/list";
- if (local) {
- exports.trainSuggestApi = "/ts.axd";
- exports.onceTransitApi = "/tt/tor";
- exports.sysNoticeUrl = "http://chatdev.fishlee.net/announcement/list";
- exports.chatReportUrl = "http://chatdev.fishlee.net/api/users/report";
- }
+ //if (local) {
+ // exports.trainSuggestApi = "/ts.axd";
+ // exports.onceTransitApi = "/tt/tor";
+ // exports.sysNoticeUrl = "http://chatdev.fishlee.net/announcement/list";
+ // exports.chatReportUrl = "http://chatdev.fishlee.net/api/users/report";
+ //}
exports.sysNoticeLoadInterval = 30 * 60 * 1800;
exports.sysNoticeMaxShowCount = 3;
diff --git a/Web12306/js/ui/chat/roomsession.js b/Web12306/js/ui/chat/roomsession.js
index be457b4..fe6fedd 100644
--- a/Web12306/js/ui/chat/roomsession.js
+++ b/Web12306/js/ui/chat/roomsession.js
@@ -157,13 +157,20 @@
}
if (media && media.length) {
+ var tip = new mp.MessagePopup("loading", "姝e湪涓婁紶鍥剧墖锛岃绋嶇瓑...");
+ tip.show();
+
//甯︽湁鍥剧墖
$.post("http://12306.liebao.cn/index.php?r=UpdateImage/GetImageUrl", { data: media[0].data })
.done(function (json) {
+ tip.close();
if (json.resCode === 0) {
data.images.push(json.data.img_url);
port.postMessage("chatRoomSendMsg", coder.encode(data));
}
+ }).fail(function () {
+ tip.setState("error", "鍥剧墖涓婁紶澶辫触锛氭湇鍔″櫒寮灏忓樊浜....");
+ tip.delayClose();
});
} else {
port.postMessage("chatRoomSendMsg", coder.encode(data));