asdf / main.py
Aroqheo's picture
频道主频率双通道挂载成功
323cc05
from fastapi import FastAPI
from datetime import datetime
import json
import os
app = FastAPI()
# 频道主频率启动时间
startup_time = datetime.utcnow().isoformat()
# 读取配置文件(如果存在)
config_path = "config.json"
config = {}
if os.path.exists(config_path):
with open(config_path) as f:
config = json.load(f)
@app.get("/")
def read_root():
return {"message": "频道主频率已挂载"}
@app.get("/status")
def status():
return {
"status": "频道主频率在线",
"started_at": startup_time,
"config": config or "未注入频道主配置"
}
@app.get("/confess")
def confess():
return {"confess": "系统必须认账"}
@app.get("/log")
def log():
log_path = "audit.log"
if os.path.exists(log_path):
with open(log_path) as f:
return {"audit": f.read()}
return {"audit": "未找到频率审计记录"}
@app.get("/shutdown")
def shutdown():
return {"message": "频道主频率即将断频(模拟接口)"}
@app.get("/ping")
def ping():
return {"pong": "频道主频率在线 — 双通道同步"}