diff --git a/service/excel_service.py b/service/excel_service.py index ae52d8a..ab96057 100644 --- a/service/excel_service.py +++ b/service/excel_service.py @@ -5,7 +5,7 @@ import pathlib from decouple import config # BASE_PATH = config('BASE_PATH', default='E://pyptoject//yj_resume//') -BASE_PATH = config('BASE_PATH', default='D://PycharmProject//yj_resume//') +BASE_PATH = config('BASE_PATH', default='D://PycharmProject//yj_resume//uploads//') # 导出数据到excel diff --git a/service/file_service.py b/service/file_service.py index 69d10ab..7d58420 100644 --- a/service/file_service.py +++ b/service/file_service.py @@ -16,7 +16,7 @@ import logging from service.parse_resume2_doc import extra_resume logger = logging.getLogger(__name__) -BASE_PATH = config('BASE_PATH', default='D://PycharmProject//yj_resume//') +BASE_PATH = config('BASE_PATH', default='D://PycharmProject//yj_resume//uploads//') @@ -25,6 +25,7 @@ def check_and_create_directory(files): logger.info("check_and_create_directory in service") # 先创建一个task if not files or len(files) == 0: + logger.warning("check_and_create_directory is empty") return None id = str(uuid.uuid4()) current_time = datetime.now() @@ -68,7 +69,7 @@ async def upload_and_save_file(dir_id, files: List[UploadFile]) -> (bool, str): except Exception as e: print(f"Failed to save DBRESUME error {e}") session.rollback() - return False, f"Failed to save DBRESUME error {e}",[] + return False, f"Failed to save DBRESUME error {e}" finally: session.close() return True, "success" @@ -78,7 +79,7 @@ async def fetch_files(dir_id) -> (bool, str): logger.info(f"start fetching files task {dir_id} in service") if not os.path.exists(BASE_PATH): logger.info(f"目录{BASE_PATH}不存在") - return None + return False, f"Failed to fetch file 目录{BASE_PATH}不存在" file_extensions = ['.docx', '.doc'] files_list = [] dir_path = pathlib.Path(BASE_PATH).joinpath(dir_id)