fix: CTP登录冷却持久化到数据库,取消页面自动连并刷新JS缓存
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -205,7 +205,9 @@ def require_nav(key: str):
|
||||
|
||||
@app.context_processor
|
||||
def inject_globals():
|
||||
return {"nav_items": get_nav_items(get_setting)}
|
||||
trade_js = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static", "js", "trade.js")
|
||||
asset_v = str(int(os.path.getmtime(trade_js))) if os.path.isfile(trade_js) else "0"
|
||||
return {"nav_items": get_nav_items(get_setting), "asset_v": asset_v}
|
||||
|
||||
|
||||
def _trading_mode() -> str:
|
||||
@@ -1714,9 +1716,16 @@ def settings():
|
||||
|
||||
save_ctp_settings_from_form(request.form, set_setting)
|
||||
try:
|
||||
from vnpy_bridge import get_bridge
|
||||
from vnpy_bridge import get_bridge, _persist_last_error
|
||||
|
||||
get_bridge().mark_disconnected()
|
||||
b = get_bridge()
|
||||
b.mark_disconnected()
|
||||
if (request.form.get("simnow_password") or "").strip() or (
|
||||
request.form.get("ctp_live_password") or ""
|
||||
).strip():
|
||||
b._clear_login_cooldown()
|
||||
b._last_error = ""
|
||||
_persist_last_error("")
|
||||
except Exception:
|
||||
pass
|
||||
flash("CTP 配置已保存,请在持仓监控页重连 CTP")
|
||||
|
||||
Reference in New Issue
Block a user