- 拆包 fengxiang/:config/client/store/notify/monitor/admin/tts,统一入口 order_monitor.py - 服务器形态:Docker 常驻,Cookie 由本机登录后 POST 上传并热加载,不再依赖桌面弹窗 - 修复:首次启动重推历史订单、speak() 阻塞主循环、夜间 sleep 10h 不可中断 - 修复:test_push.py 残留 miservice 依赖(小爱已移除)、run_monitor.bat 写死盘符 - 配置化:webhook/shopId 移出源码(环境变量 > config.yaml > 默认值) - 可观测:滚动文件日志 + /healthz + Docker HEALTHCHECK + 告警冷却 - 飞书通道保留配置位,默认关闭(原 token 已失效 code=19001) - 新增 22 项单元测试(不联网)
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""丰享订单监控 v5 —— 统一入口(本地 Windows / 服务器容器共用)。
|
|
|
|
用法:
|
|
python order_monitor.py # 读 ./config.yaml(或 FX_CONFIG 指定)
|
|
FX_CONFIG=/app/config.yaml python order_monitor.py
|
|
|
|
环境变量见 config.example.yaml 注释。
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
import os
|
|
import sys
|
|
|
|
from fengxiang import __version__
|
|
from fengxiang.config import load_config
|
|
from fengxiang.logger import setup_logging
|
|
from fengxiang.monitor import Monitor
|
|
|
|
|
|
def main() -> int:
|
|
cfg_path = os.environ.get("FX_CONFIG") or "config.yaml"
|
|
if not os.path.exists(cfg_path):
|
|
print(f"[提示] 未找到配置文件 {cfg_path},使用内置默认值 + 环境变量", file=sys.stderr)
|
|
|
|
cfg = load_config(cfg_path)
|
|
setup_logging(cfg.paths.logs, cfg.log.level, cfg.log.max_bytes, cfg.log.backup_count)
|
|
log = logging.getLogger("fengxiang")
|
|
|
|
if not cfg.notify.channels:
|
|
log.error("没有任何可用的推送通道,请配置 notify.wecom.webhook 或 FX_WECOM_WEBHOOK")
|
|
|
|
log.info("版本 %s | Python %s", __version__, sys.version.split()[0])
|
|
Monitor(cfg).run()
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|