fix: 12维报告资金流/行业数据源修复
- capital_flow_cache读到旧id=194(8-10)改WHERE id=1(现在33只) - batch_reassess行业回退stock_sectors_em(5061覆盖全) 根因: 写入固定id=1但读取ORDER BY id DESC拿到旧行
This commit is contained in:
@@ -191,7 +191,7 @@ def build_prompt(data):
|
||||
try:
|
||||
import sqlite3 as _sq, json as _j
|
||||
_db = _sq.connect("/home/hmo/MoFin/data/mofin.db")
|
||||
_fr = _db.execute("SELECT cache_json FROM capital_flow_cache ORDER BY id DESC LIMIT 1").fetchone()
|
||||
_fr = _db.execute("SELECT cache_json FROM capital_flow_cache WHERE id=1 ORDER BY updated_at DESC LIMIT 1").fetchone()
|
||||
if _fr and _fr[0]:
|
||||
_fc = _j.loads(_fr[0])
|
||||
_stocks = _fc.get("stocks", {})
|
||||
|
||||
@@ -2382,5 +2382,5 @@ def write_capital_flow_cache(conn, data: dict):
|
||||
|
||||
def read_capital_flow_cache(conn) -> dict:
|
||||
import json
|
||||
r = conn.execute("SELECT cache_json FROM capital_flow_cache ORDER BY id DESC LIMIT 1").fetchone()
|
||||
r = conn.execute("SELECT cache_json FROM capital_flow_cache WHERE id=1 ORDER BY updated_at DESC LIMIT 1").fetchone()
|
||||
return json.loads(r['cache_json']) if r else {}
|
||||
|
||||
Reference in New Issue
Block a user