'Add
This commit is contained in:
7
main.py
7
main.py
@@ -16,6 +16,7 @@ import threading
|
||||
from multiprocessing import Value
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
import random
|
||||
import logging
|
||||
|
||||
JUNCTION = 0
|
||||
RESERVOIR = 1
|
||||
@@ -38,6 +39,10 @@ if not os.path.exists(tmpDir):
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
# 配置日志记录器
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# 配置 CORS 中间件
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
@@ -1409,7 +1414,7 @@ async def fastapi_get_network_coords(network: str) -> list[str] | None:
|
||||
@app.get("/getmajornodecoords/")
|
||||
async def fastapi_get_major_node_coords(network: str, diameter: int) -> list[str] | None:
|
||||
coords = get_major_node_coords(network, diameter)
|
||||
print(coords)
|
||||
logger.info("get_major_node_coords: %s", coords)
|
||||
result = []
|
||||
for node_id, coord in coords.items():
|
||||
result.append(f"{node_id}:{coord['type']}:{coord['x']}:{coord['y']}")
|
||||
|
||||
Reference in New Issue
Block a user