BUG修正以及漏洞修复

This commit is contained in:
iFish 2014-09-11 22:19:33 +08:00
parent 403e5d0585
commit 2c145168ac
13 changed files with 85 additions and 19 deletions

View File

@ -130,3 +130,17 @@ select.normal {
box-sizing: border-box;
width: 100%;
}
.button-toolbar {
color: #616161;
height: 26px;
background: linear-gradient(180deg, #f4f4f4, #e9e8e9);
border: 1px solid #d1d1d1;
border-radius: 2px;
cursor: pointer;
}
.button-toolbar:hover {
background: linear-gradient(180deg, #fefefe, #f3f3f3);
border: 1px solid #e1e1e1;
}

View File

@ -54,7 +54,7 @@
</nav>
</header>
<section id="selltime_tip">
<script id="selltime_tip_tpl" type="text/x-dottemplate">
<script id="selltime_tip_tpl" type="text/x-dot-template">
<li>
<p>车票起售时间</p>
</li>
@ -831,6 +831,9 @@
<input type="text" value="" id="" placeholder="在列表中搜索..." />
<i class="fa fa-search"></i>
</div>
<button class="button-toolbar" id="btnRefreshPassOrder">
<i class="fa fa-refresh"></i> 刷新列表
</button>
</div>
<script type="text/x-dot-template">
{{~it:p:i}}
@ -997,7 +1000,7 @@
<time>{{!it.timeStr}}</time>
<section>
{{~it.items:item:idx}}
<div style="color:{{!item.color}};">{{=item.text}}</div>
<div style="color:{{!item.color}};">{{!item.text}}</div>
{{~}}
</section>
</section>

View File

@ -128,6 +128,10 @@
console.log("unable to restore parameter: " + e);
}
}
//fix passenger issue
profile.currentProfile.passengers = _.filter(profile.currentProfile.passengers || [], function(p) {
return p.passenger_name || false;
});
that.current = profile;
if (dispname) {

View File

@ -125,7 +125,7 @@
} else if (json.data.isRelogin) {
def.reject({ msg: "登录状态异常,请重新登录。" });
} else if (json.data.op_2 === "true") {
def.reject({ msg: "排队人数过多,不允许提交订单。排队人数=" + json.data.countT });
def.reject({ msg: "排队人数过多,12306禁止提交订单。" });
} else {
def.resolve({ success: true });
}
@ -322,7 +322,7 @@
} else if (json.data.isRelogin) {
def.reject({ msg: "登录状态异常,请重新登录。" });
} else if (json.data.op_2 === "true") {
def.reject({ msg: "排队人数过多,不允许提交订单。排队人数=" + json.data.countT });
def.reject({ msg: "排队人数过多,12306禁止提交订单。" });
} else {
submitOrder();
}

View File

@ -150,6 +150,11 @@
exports.queryTicket = function (from, to, date, student, noProcess, noAction) {
var def = new $.Deferred();
var queryCount = 0;
def.fail(function () {
exports.events.fireEvent("requestFailed");
});
var sendQueryRequest = function () {
var p = {
@ -164,14 +169,20 @@
queryTicketUrl = this.model.c_url;
sendQueryRequest();
} else if (!this.model.status) {
var error = (this.modal.messages || ["查询失败"]).join("");
var error = (this.model.messages || ["查询失败"]).join("");
def.reject(error);
} else {
var data = transferData(date, this.model, noProcess, noAction);
def.resolveWith(data);
}
}, function () {
def.reject("网络错误");
if (queryCount++ < 5) {
def.notify("无法访问12306正在第 " + queryCount + " 次重试...");
setTimeout(sendQueryRequest, 2000);
} else {
def.reject("重试次数过多,请重新点击查询按钮");
}
});
};
var fetchTicketUrl = function () {

View File

@ -17,6 +17,7 @@
var isInQuery = false;
var startQueryLimit = data.startTrainStationSuggestQueryLimit;
var isSuggestLoopDisabled = false;
var isSuggestReported = false;
var _w = window;
function TSS() {
@ -76,7 +77,6 @@
//如果服务器出现错误,则等待十秒后再恢复状态
}, 10000);
});
port.track(data.trackTypes.LOAD_SUGGESTION, [cp.fromCode, cp.fromText, cp.toCode, cp.toText, cp.depDate, cp.studentTicket + '']);
};
var preprocessServerResponse = function (serverSuggestion) {
serverSuggestion = serverSuggestion && serverSuggestion.groups;
@ -110,6 +110,7 @@
if (!serverSuggestion)
return;
var loaded = [];
var loadTrain = function () {
@ -154,6 +155,12 @@
};
loadTrain();
if (!isSuggestReported) {
isSuggestReported = true;
port.track(data.trackTypes.LOAD_SUGGESTION, [cp.fromCode, cp.fromText, cp.toCode, cp.toText, cp.depDate, cp.studentTicket + '']);
}
};
var checkSuggestion = function (suggestData) {
suggestion = suggestData;
@ -178,6 +185,7 @@
trainStops = null;
alltrains = null;
lastQuerySuggest = null;
isSuggestReported = false;
};
this.checkTrainSuggestion = function () {
var suggestKey = cp.fromCode + cp.toCode + cp.depDate + ((cp.selectedTrain || []).join("|")) + ((cp.selectedSeatType || []).join("|"));
@ -232,6 +240,7 @@
clearQueryResultCache: function () {
ctx.TSS.clearQueryResultCache();
ctx.isSuggestLoopDisabled = false;
isSuggestReported = false;
},
findTrain: function (secstr) {
for (var line in suggestion) {

View File

@ -218,7 +218,7 @@
initEditor();
editor.find(".chat-editor-container").keyup(function (e) {
if (e.keyCode === 13) {
if (e.keyCode === 13 && sendBtn.is(":enabled")) {
sendBtn.click();
}
});

View File

@ -120,9 +120,11 @@
var refreshCount = 0;
//var currentSelectedDate;
var currentDateLoopIndex = -1;
var isAutoRefreshBlock = false;
var init = function () {
query.events.on("processTrains", function (e, d) {
isAutoRefreshBlock = false;
processTrains(d);
if (inAutoRefresh)
trainSuggest.setQueryResult(d, refreshCount);
@ -137,13 +139,20 @@
}
}
}).on("requestFailed", function () {
isAutoRefreshBlock = false;
//失败?不做任何处理
if (inAutoRefresh) {
that.start();
}
});
that.on("performAutoSubmit", function (e, d) {
that.dispatchEvent("requireSubmitOrder", d);
});
};
this.start = function () {
if (isAutoRefreshBlock) {
return;
}
if (!inAutoRefresh) {
//currentSelectedDate = sessMgr.currentProfile.depDate;
refreshCount = 0;
@ -182,9 +191,10 @@
}
inAutoRefresh = true;
if (!countdownTime)
if (countdownTime <= 1)
countdownTime = currentProfile.autoRefreshDelay;
refreshTimer = setInterval(that.countdown, 100);
if (!refreshTimer)
refreshTimer = setInterval(that.countdown, 100);
refreshInfoP.eq(2).hide();
refreshInfoP.eq(1).show();
that.showCountDownInfo();
@ -192,7 +202,7 @@
this.stop = function () {
if (!inAutoRefresh)
return;
isAutoRefreshBlock = false;
inAutoRefresh = false;
refreshTimer && (clearInterval(refreshTimer), refreshTimer = null);
refreshElapseTimer && (clearInterval(refreshElapseTimer), refreshElapseTimer = null);
@ -249,7 +259,7 @@
$("#date_loop_editor>span:eq(" + currentDateLoopIndex + ")").addClass("selected");
}
}
isAutoRefreshBlock = true;
that.fireEvent("requestQueryTicket");
}
};

View File

@ -29,22 +29,26 @@
widget.showFloatDialog($("#float-passenger-selector"));
//加载联系人?
that.reloadList();
};
this.reloadList = function() {
var list = $("section.float-passenger-selector-list ul");
list.empty().addClass("loading");
$("#float-passenger-selector .float-passenger-selector-selected ul").empty();
selectedPassenger = [];
sessMgr.getPassengers(function (paslist) {
sessMgr.getPassengers(function(paslist) {
allPassengers = paslist;
list.removeClass("loading");
list.html(listTpl(_.filter(paslist, function (p) {
return !stu || p.passenger_type === '3';
list.html(listTpl(_.filter(paslist, function(p) {
return !isStu || p.passenger_type === '3';
}), extTplData));
}).fail(function (msg) {
}).fail(function(msg) {
mp.showMessagePopup("error", "无法加载联系人:" + msg);
list.removeClass("loading");
list.html("<li>无法加载联系人:" + msg + "</li>");
});
};
this.hide = function () {
@ -162,6 +166,12 @@
that.fireEvent("passengerSelected");
widget.hideFloatDialog($("#float-passenger-selector"));
});
//刷新
$("#btnRefreshPassOrder").click(function() {
sessMgr.reloadPassengers();
that.reloadList();
});
};
PassengerSelectionUI.prototype = Object.create(EO);
PassengerSelectionUI.constructor = EO;

View File

@ -87,6 +87,8 @@
tip.setState("error", msg || "查票失败...");
tip.delayClose();
__.fireEvent("onloadfailed", extArg);
}).progress(function (msg) {
tip.setState("loading", msg);
});
};
var getOriginalDepInfo = function (code) {

View File

@ -153,7 +153,7 @@
btns.unshift({
text: "安装猎豹浏览器",
type: "primary",
callback: function () {
callback: function (opt, btn) {
window.open("http://dl.liebao.cn/coop/KSBrowser_12306.exe");
return false;
}
@ -162,7 +162,9 @@
btns.unshift({
text: "安装扩展",
type: "primary",
callback: function () {
callback: function (opt, btn) {
btn.html("正在安装...");
btn.removeClass("button-primary").addClass("button-default");
window.open("http://12306.fishlee.net/crx");
return false;
}

View File

@ -57,7 +57,7 @@
}
if (this.callback) {
btn.click(function () {
return this.apply(template, [options]);
return this.apply(template, [options, btn]);
}.bind(this.callback));
}
if (options.closeOnAction || this.cancel) {

View File

@ -70,6 +70,7 @@
showAlarmSetUi(this);
}).fail(function () {
tip.setState("error", "查询失败,请重试");
tip.delayClose();
});
};
var parseSellTime = function (point) {