|
@@ -24,12 +24,12 @@ router = APIRouter()
|
|
|
|
|
|
|
|
|
@router.post('/get_township_rain')
|
|
|
-async def mine(request: Request,body = Depends(remove_xss_json),db: Session = Depends(get_db)):
|
|
|
+async def mine(request: Request,db: Session = Depends(get_db)):
|
|
|
try:
|
|
|
body = await request.json()
|
|
|
rn = body.get('rn')
|
|
|
result = get_rain_township(db,rn)
|
|
|
- print(result)
|
|
|
+ #print(result)
|
|
|
return {
|
|
|
"code": 200,
|
|
|
"msg": "成功",
|
|
@@ -41,7 +41,7 @@ async def mine(request: Request,body = Depends(remove_xss_json),db: Session = De
|
|
|
traceback.print_exc()
|
|
|
raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
|
|
|
|
|
-@router.post('/get_township_rain_text')
|
|
|
+@router.post('/township_rain_warrning')
|
|
|
async def mine(request: Request,body = Depends(remove_xss_json),db: Session = Depends(get_db)):
|
|
|
try:
|
|
|
body = await request.json()
|
|
@@ -54,7 +54,7 @@ async def mine(request: Request,body = Depends(remove_xss_json),db: Session = De
|
|
|
one_hour_rain = 6
|
|
|
one_hour_more_50 = 0
|
|
|
three_hour_more_50 = 0
|
|
|
- max_time = get_max_time(db)
|
|
|
+ max_time = get_rain_max_time(db)
|
|
|
result = ''
|
|
|
raining_township = 0
|
|
|
for i in range(len(one_hour)):
|
|
@@ -86,13 +86,13 @@ async def mine(request: Request,body = Depends(remove_xss_json),db: Session = De
|
|
|
当前3小时降雨量大于100毫米的镇街 {}个;
|
|
|
'''.format(max_time,one_hour_rain,max_rain_township,max_rain_value,one_hour_more_50,three_hour_more_50)
|
|
|
|
|
|
- print(result)
|
|
|
+ #print(result)
|
|
|
|
|
|
return {
|
|
|
"code": 200,
|
|
|
"msg": "成功",
|
|
|
"data":
|
|
|
- result
|
|
|
+ {"result":result}
|
|
|
}
|
|
|
except Exception as e:
|
|
|
db.rollback()
|