mirror of
https://github.com/xiaozhou233/RiverWaterQualityMonitoring.git
synced 2026-12-05 21:15:55 +08:00
重构API路由,添加数据上传和获取功能,整合配置管理
This commit is contained in:
1 parent
0acfc15d48
commit
83b724598a
6 files changed
+142
-73
No files matched your search
@@ -0,0 +1,25 @@
|
||||
from fastapi import APIRouter
|
||||
import config
|
||||
from utils import *
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/data/upload")
|
||||
def data_upload_get(token:str, ph:float, tds:float, turbidity:float):
|
||||
# 验证token
|
||||
if token != config.TOKEN:
|
||||
return {
|
||||
"code" : 403,
|
||||
"status" : "error",
|
||||
"message" : "token error",
|
||||
"time" : timenow()
|
||||
}
|
||||
|
||||
# TODO: Insert data into database
|
||||
|
||||
return {
|
||||
"code" : 200,
|
||||
"status" : "success",
|
||||
"message" : "data upload success",
|
||||
"time" : timenow()
|
||||
}
|
||||
Reference in new issue
Block a user