Browse Source

更新 'main.py'

nemo0526 3 years ago
parent
commit
4e8f25443b
1 changed files with 7 additions and 1 deletions
  1. 7 1
      main.py

+ 7 - 1
main.py

@@ -185,12 +185,18 @@ async def optim(request: Request, Authorize: AuthJWT = Depends()):
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/Water_tower?charset=utf8mb4')
     table=db['record_tower']
     temp = table.find_one(key = 'hotTemp')
+     statement2 = 'SELECT  value FROM record_tower WHERE record_tower.key = "coldTempData2"'
+    for temp2 in db.query(statement2):
+        print(temp2['value'])
+    statement3 = 'SELECT  value FROM record_tower WHERE record_tower.key = "wetTemp"'
+    for temp3 in db.query(statement3):
+        print(temp3['value'])
     try:
         Authorize.jwt_required()
     except Exception as e:
         print(e)
         return RedirectResponse('/login')
-    return templates.TemplateResponse(name='optim.html',context={'request': request,"temp":temp})
+    return templates.TemplateResponse(name='optim.html',context={'request': request,"temp":temp,"temp2":temp2,"temp3":temp3})
 
 
 @app.get('/vibration', response_class=HTMLResponse)