diff --git a/Router/DailyRouter.py b/Router/DailyRouter.py index 791df3f..9690954 100644 --- a/Router/DailyRouter.py +++ b/Router/DailyRouter.py @@ -109,6 +109,6 @@ def daily_export(req: QueryParams, db: Session = Depends(get_db)): file_name = f"{time.strftime('%Y%m%d%H%M%S')}.xlsx" file_path = f"{temp_path}/{file_name}" pd.DataFrame(daily_items).to_excel(file_path, index=False) - return {"url": file_path} + return {"url": "/"+file_path} # return FileResponse( # path=file_path, headers={'Content-Disposition': f'attachment; filename="{file_name}"'}, filename=file_name) diff --git a/Router/UserRouter.py b/Router/UserRouter.py index e199cc2..550d41f 100644 --- a/Router/UserRouter.py +++ b/Router/UserRouter.py @@ -154,7 +154,7 @@ def refresh_token(token_data: TokenData = Depends(token_data_depend), db: Sessio return {'token': token} -@router.post("/get_user_by_department", tags=["用户接口"], summary=["根据部门列表获取用户信息"], +@router.post("/get_user_by_department", tags=["用户接口"], summary="根据部门列表获取用户信息", response_model=UserSchemas.GetUserByDepartmentRes) def get_user_by_department(body: UserSchemas.GetUserByDepartmentReq, token_data: TokenData = Depends(token_data_depend), db: Session = Depends(get_db)): @@ -189,7 +189,6 @@ def get_user_can_watch_department(token_data: TokenData = Depends(token_data_dep if token_data.manage_departments: for item in token_data.manage_departments.split(","): can_watch_department.add(int(item)) - print(can_watch_department, "can_watch_department") can_watch_department_list = [department_dict[item] for item in can_watch_department] return {'item_list': can_watch_department_list, "count": len(can_watch_department_list)} diff --git a/Utils/SqlAlchemyUtils.py b/Utils/SqlAlchemyUtils.py index 10fed72..eb072b9 100644 --- a/Utils/SqlAlchemyUtils.py +++ b/Utils/SqlAlchemyUtils.py @@ -14,7 +14,7 @@ db = 'daily' def get_engine(): engine = create_engine( - f"mysql+pymysql://{user}:{password}@{host}/{db}?charset=utf8mb4") + f"mysql+pymysql://{user}:{password}@{host}/{db}?charset=utf8mb4",pool_recycle=3600*4) return engine