修改
This commit is contained in:
@@ -36,6 +36,7 @@ if _REPO_ROOT not in sys.path:
|
||||
sys.path.insert(0, _REPO_ROOT)
|
||||
from ai_client import ai_generate, ai_review, ai_short_advice
|
||||
from ai_review_lib import build_journal_ai_chart_path, collect_images_for_ai_review
|
||||
from form_submit_lib import check_duplicate_submit, submit_scope_add_key, submit_scope_add_order
|
||||
from journal_chart_lib import (
|
||||
JOURNAL_CHART_DEFAULT_LIMIT,
|
||||
JOURNAL_CHART_DEFAULT_TF1,
|
||||
@@ -5825,6 +5826,14 @@ def add_key():
|
||||
if not symbol:
|
||||
flash("symbol 不能为空")
|
||||
return redirect("/")
|
||||
mt = (d.get("type") or "").strip()
|
||||
direction_pre = (d.get("direction") or "long").strip().lower()
|
||||
dup_msg = check_duplicate_submit(
|
||||
session, submit_scope_add_key(symbol, mt, direction_pre)
|
||||
)
|
||||
if dup_msg:
|
||||
flash(dup_msg)
|
||||
return redirect("/")
|
||||
rank, total = _daily_volume_rank(symbol)
|
||||
if rank is None:
|
||||
flash("日成交量排名读取失败,请稍后重试")
|
||||
@@ -5852,6 +5861,11 @@ def add_order():
|
||||
conn.close()
|
||||
flash("symbol 不能为空")
|
||||
return redirect("/")
|
||||
dup_msg = check_duplicate_submit(session, submit_scope_add_order(symbol, direction))
|
||||
if dup_msg:
|
||||
conn.close()
|
||||
flash(dup_msg)
|
||||
return redirect("/trade")
|
||||
ok, reason = precheck_risk(conn, symbol, direction)
|
||||
if not ok:
|
||||
if "已达最大持仓数" in reason:
|
||||
@@ -7004,7 +7018,9 @@ def api_reviews():
|
||||
return jsonify([row_to_dict(r) for r in rows])
|
||||
|
||||
|
||||
_AI_REVIEW_RENDER_JS = os.path.join(os.path.dirname(BASE_DIR), "static", "ai_review_render.js")
|
||||
_REPO_STATIC_DIR = os.path.join(os.path.dirname(BASE_DIR), "static")
|
||||
_AI_REVIEW_RENDER_JS = os.path.join(_REPO_STATIC_DIR, "ai_review_render.js")
|
||||
_FORM_SUBMIT_GUARD_JS = os.path.join(_REPO_STATIC_DIR, "form_submit_guard.js")
|
||||
|
||||
|
||||
@app.route("/static/ai_review_render.js")
|
||||
@@ -7014,6 +7030,13 @@ def static_ai_review_render_js():
|
||||
return send_file(_AI_REVIEW_RENDER_JS, mimetype="application/javascript; charset=utf-8")
|
||||
|
||||
|
||||
@app.route("/static/form_submit_guard.js")
|
||||
def static_form_submit_guard_js():
|
||||
if not os.path.isfile(_FORM_SUBMIT_GUARD_JS):
|
||||
return Response("not found", status=404, mimetype="text/plain; charset=utf-8")
|
||||
return send_file(_FORM_SUBMIT_GUARD_JS, mimetype="application/javascript; charset=utf-8")
|
||||
|
||||
|
||||
@app.route("/export/review_md/<rid>")
|
||||
@login_required
|
||||
def export_review_md(rid):
|
||||
|
||||
Reference in New Issue
Block a user