This commit is contained in:
DingZQ
2022-09-02 09:38:01 +08:00
parent 6c6bd50c67
commit 0479a7e3ca

14
main.py
View File

@@ -50,6 +50,12 @@ async def fastapi_have_project(network: str):
@app.post("/createproject/")
async def fastapi_create_project(network: str):
create_project(network)
print(network)
return network
@app.post("/openproject/")
async def fastapi_open_project(network: str):
open_project(network)
print(network)
@@ -70,8 +76,8 @@ async def fastapi_delete_project(network: str):
async def fastapi_get_nodes(network: str):
nodeCount = get_count(network, NODE_COUNT)
nodes = []
for i in range(0, nodeCount.value + 1):
node_id = get_node_id(network, i)
for i in range(nodeCount.value):
node_id = get_node_id(network, i + 1)
if node_id.error_code == 0:
nodes.append(node_id.value)
@@ -128,8 +134,8 @@ async def fastapi_set_node_coord(network: str, node: str, x: int, y: int):
async def fastapi_get_links(network: str):
linkCount = get_count(network, LINK_COUNT)
links = []
for i in range(1, linkCount.value + 1):
link_id = get_link_id(network, i)
for i in range(linkCount.value):
link_id = get_link_id(network, i + 1)
if link_id.error_code == 0:
links.append(link_id.value)