|
@@ -236,10 +236,18 @@ async def member_authority(request:Request,tower_id: str,Authorize: AuthJWT = De
|
|
|
async def optim(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/Water_tower?charset=utf8mb4')
|
|
|
statement = 'SELECT value FROM record_tower WHERE record_tower.key = "hotTemp"'
|
|
|
- x = 0
|
|
|
+ x = 0
|
|
|
y = 0
|
|
|
z = 0
|
|
|
count = 0
|
|
|
+ waterflow = 0
|
|
|
+ fannum = 0
|
|
|
+ savewater = 0
|
|
|
+ fanchange = 0
|
|
|
+ saveelec = 0
|
|
|
+ total = 0
|
|
|
+ flowchange = 0
|
|
|
+
|
|
|
for temp in db.query(statement):
|
|
|
print(temp['value'])
|
|
|
x=temp['value']
|
|
@@ -255,12 +263,38 @@ async def optim(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
for tower in db.query(statement4):
|
|
|
print(tower['value'])
|
|
|
count=tower['value']
|
|
|
+ statement5 = 'SELECT value FROM record_tower WHERE record_tower.key = "waterflow"'
|
|
|
+ for tower in db.query(statement5):
|
|
|
+ waterflow=tower['value']
|
|
|
+ statement6 = 'SELECT value FROM record_tower WHERE record_tower.key = "fannum"'
|
|
|
+ for tower in db.query(statement6):
|
|
|
+ fannum=tower['value']
|
|
|
+ statement7 = 'SELECT value FROM record_tower WHERE record_tower.key = "flowchange"'
|
|
|
+ for tower in db.query(statement7):
|
|
|
+ flowchange=tower['value']
|
|
|
+ statement8 = 'SELECT value FROM record_tower WHERE record_tower.key = "savewater"'
|
|
|
+ for tower in db.query(statement8):
|
|
|
+ savewater=tower['value']
|
|
|
+ statement9 = 'SELECT value FROM record_tower WHERE record_tower.key = "fanchange"'
|
|
|
+ for tower in db.query(statement9):
|
|
|
+ fanchange=tower['value']
|
|
|
+ statement10 = 'SELECT value FROM record_tower WHERE record_tower.key = "saveelec"'
|
|
|
+ for tower in db.query(statement10):
|
|
|
+ saveelec=tower['value']
|
|
|
+ statement11 = 'SELECT value FROM record_tower WHERE record_tower.key = "total"'
|
|
|
+ for tower in db.query(statement11):
|
|
|
+ total=tower['value']
|
|
|
try:
|
|
|
Authorize.jwt_required()
|
|
|
except Exception as e:
|
|
|
print(e)
|
|
|
return RedirectResponse('/login')
|
|
|
- return templates.TemplateResponse(name='optim.html',context={'request': request,"x":x,"y":y,"z":z,"count":count})
|
|
|
+ return templates.TemplateResponse(name='optim.html',context=
|
|
|
+ {
|
|
|
+ 'request': request,"x":x,"y":y,"z":z,"count":count,"waterflow":waterflow
|
|
|
+ ,"fannum":fannum , "flowchange":flowchange , "savewater":savewater
|
|
|
+ , "fanchange":fanchange , "saveelec":saveelec , "total":total
|
|
|
+ })
|
|
|
|
|
|
|
|
|
@app.get('/vibration', response_class=HTMLResponse)
|