Commit 2a8891f8 by root

添加了一些路由和处理函数。

parent 209c564a
import random
import uvicorn import uvicorn
from fastapi import FastAPI, Body from fastapi import FastAPI, Body
...@@ -15,6 +17,52 @@ async def type_1(req: dict = Body()): ...@@ -15,6 +17,52 @@ async def type_1(req: dict = Body()):
return "success" return "success"
@app.post("/type_2/")
async def type_1(req: dict = Body()):
print(req)
return {"code": 0}
@app.post("/type_3/")
async def type_1(req: dict = Body()):
print(req)
return {"status": 200, "msg": "", "data": ""}
@app.post("/type_4/")
async def type_1(req: dict = Body()):
print(req)
return {"msg": "", "code": 0}
@app.post("/type_5/")
async def type_1(req: dict = Body()):
print(req)
return {"code": 0, "message": "success"}
@app.post("/type_6/")
async def type_1(req: dict = Body()):
print(req)
return {"code": 0, "msg": "ok"}
@app.post("/type_random/")
async def type_1(req: dict = Body()):
result = [
"success",
{"code": 0},
{"status": 200, "msg": "", "data": ""},
{"msg": "", "code": 0},
{"code": 0, "message": "success"},
{"code": 0, "msg": "ok"},
{"code": 1, "msg": "no query results for model [app\\services\\ordermachine\\model\\deliveryorderkfwmodel].",
"data": []},
{"msg": "重复回调", "code": 1}
]
return random.choice(result)
if __name__ == '__main__': if __name__ == '__main__':
uvicorn.run( uvicorn.run(
app="main:app", app="main:app",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment