重构API路由,添加数据上传和获取功能,整合配置管理

This commit is contained in:
xiaozhou233 committed 2026-06-30 21:59:14 +08:00
1 parent 0acfc15d48
commit 83b724598a
6 files changed
+142 -73

No files matched your search

+25
View File
@@ -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()
}