fix: CTP登录冷却持久化到数据库,取消页面自动连并刷新JS缓存

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 17:01:36 +08:00
parent 9c8b92d2bd
commit 259d9e812d
4 changed files with 80 additions and 17 deletions
+2 -8
View File
@@ -394,7 +394,6 @@
return Promise.resolve({});
}
ctpConnectInflight = true;
updateCtpBadge(false, true);
return fetch('/api/ctp/connect', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -415,6 +414,7 @@
return d;
}
if (d.connecting || st.connecting) {
updateCtpBadge(false, true);
return waitForCtpConnected(70000).then(function (ok) {
if (!ok && d.error) showCtpError(d.error);
else if (!ok && st.last_error) showCtpError(st.last_error);
@@ -1086,13 +1086,7 @@
var st = d.status || {};
syncCtpBadgeFromStatus(st);
if (st.last_error) showCtpError(st.last_error);
if (st.connected) {
pollPositions();
return;
}
if ((st.login_cooldown_sec || 0) > 0) return;
if (isCtpLoginBanError(st.last_error)) return;
if (!st.connecting) requestCtpConnect(false);
if (st.connected) pollPositions();
})
.catch(function () {});
}