feat: mo_data.py unified read layer (DB-first, JSON fallback) + cash_log table + batch JSON→DB migration (16 files)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
"""修复decisions.json中所有决策的trigger字段(由regenerate_all负责填充)"""
|
||||
|
||||
import json, sys, os
|
||||
from mo_data import read_portfolio, read_decisions, read_watchlist
|
||||
|
||||
DECISIONS_PATH = "/home/hmo/web-dashboard/data/decisions.json"
|
||||
DECISIONS_BAK = DECISIONS_PATH + ".bak"
|
||||
@@ -42,7 +43,7 @@ for d in dec.get("decisions", []):
|
||||
# 备份
|
||||
os.makedirs(os.path.dirname(DECISIONS_BAK), exist_ok=True)
|
||||
with open(DECISIONS_BAK, 'w') as f:
|
||||
json.dump(json.load(open(DECISIONS_PATH)), f, indent=2, ensure_ascii=False)
|
||||
json.dump(mo_data.read_decisions(), f, indent=2, ensure_ascii=False)
|
||||
|
||||
with open(DECISIONS_PATH, 'w') as f:
|
||||
json.dump(dec, f, indent=2, ensure_ascii=False)
|
||||
|
||||
Reference in New Issue
Block a user