- 添加FastAPI应用基础结构,包括主入口、路由和模型定义
- 实现Webhook接收端点(/webhook/{namespace})和健康检查(/health)
- 添加管理后台路由和模板,支持端点、目标、渠道和模板管理
- 包含SQLite数据库模型定义和初始化逻辑
- 添加日志记录和统计服务
- 包含Dockerfile和配置示例文件
- 添加项目文档,包括设计、流程图和验收标准
23 lines
802 B
Python
23 lines
802 B
Python
import os
|
|
import json
|
|
from app.config import load_config
|
|
from app.models import IncomingPayload, IncomingOrderInfo
|
|
from app.services.relay import route_targets
|
|
from app.services.notify import render_message
|
|
|
|
def main():
|
|
cfg = load_config()
|
|
path = os.path.abspath(r"e:\2025Code\python\webhock\123.josn")
|
|
with open(path, "r", encoding="utf-8") as f:
|
|
data = json.load(f)
|
|
if isinstance(data.get("trans_order_info"), dict):
|
|
data["trans_order_info"] = IncomingOrderInfo(**data["trans_order_info"]) # type: ignore
|
|
payload = IncomingPayload(**data)
|
|
targets = route_targets(cfg, payload.remark or "")
|
|
msg = render_message(cfg, payload)
|
|
print("targets:", [t.get("name") for t in targets])
|
|
print("message:", msg["text"])
|
|
|
|
if __name__ == "__main__":
|
|
main()
|