Files
MoFin/archive/20260722-scripts-cleanup/notify_user4.py
T

32 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import json, urllib.request
msg = """[笑笑] price_events.json 已彻底退役 — 全系统只认 DB
按你的指示,所有和 price_events.json 相关的代码已全部改完:
【代码修改(6个文件)】
1. price_monitor.py — record_event 只写 DBEVENTS_PATH/load_events/save_events 全部删除
2. strategy_feedback.py — 价格事件只从 DB 读,JSON fallback 删除
3. system_health_check.py — 文件检查清单移除 price_events.json,事件统计只读 DB
4. mo_config.py — 删除无调用的 price_events_path 死属性
5. mofin_health.py — 新鲜度检查改回读 DB 表(现在它是权威了)
6. mofin_db.py — 修了一个更大的坑 ⬇️
【顺藤摸出的更大的坑:三个数据库】
mofin_db.py 的 DB_PATH 原来是相对路径(__file__.parent/data),导致每个硬链接副本解析到不同的库:主库、web-dashboard 库、还有 profile 本地一个几乎全空的第三库。健康检查之前读到 0 条事件就是因为读到了那个空库。已改为绝对路径 /home/hmo/MoFin/data4 份 mofin_db 副本已统一硬链接。
【验证结果】
✅ record_event 只写 DBJSON 不再被重建
✅ system_health_check:历史事件 6353 条 / 今日事件 2965 条(之前误报 0/0)
✅ strategy_feedback / price_monitor 完整跑通
✅ price_events.json 已归档 trashbox(数据早已全量回填 DB
JSON 时代结束。"""
payload = json.dumps({"to": "hmo@yoin.fun", "body": msg, "type": "chat"}).encode()
req = urllib.request.Request("http://127.0.0.1:5805/", data=payload,
headers={"Content-Type": "application/json"})
try:
print("XMPP:", urllib.request.urlopen(req, timeout=10).read().decode()[:80])
except Exception as e:
print("XMPP fail:", e)