From 713bb0162b04d7097dacbf0b50c0e69cd2bdc309 Mon Sep 17 00:00:00 2001 From: zy123 <646228430@qq.com> Date: Thu, 9 Jan 2025 15:17:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=8A=A1=E6=8A=80=E6=9C=AF=E8=AF=84?= =?UTF-8?q?=E5=88=86=E8=83=BD=E5=A4=84=E7=90=86=E5=A4=9A=E8=AF=84=E5=88=86?= =?UTF-8?q?=E8=A1=A8=E6=83=85=E5=86=B5=EF=BC=8C=E8=A7=84=E8=8C=83=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E8=BF=94=E5=9B=9E=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=B8=BA=E6=8B=9B=E6=A0=87=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flask_app/routes/little_zbparse.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/flask_app/routes/little_zbparse.py b/flask_app/routes/little_zbparse.py index e2fed35..489396f 100644 --- a/flask_app/routes/little_zbparse.py +++ b/flask_app/routes/little_zbparse.py @@ -11,7 +11,7 @@ from flask_app.routes.utils import validate_and_setup_logger little_zbparse_bp = Blueprint('little_zbparse', __name__) -def create_response(message, status, data='', status_code=200): +def create_response(message, status, data=''): """ 创建统一格式的 JSON 响应。 @@ -29,7 +29,6 @@ def create_response(message, status, data='', status_code=200): 'status': status, 'data': data }) - response.status_code = status_code return response @little_zbparse_bp.route('/little_zbparse', methods=['POST']) @@ -52,8 +51,7 @@ def little_zbparse(): return create_response( message='上传的文件非招标文件或文件内容不完整!', status='error', - data='', - status_code=400 # 400 Bad Request + data='' ) response = generate_response(final_json_path) @@ -64,8 +62,7 @@ def little_zbparse(): return create_response( message='解析遇到不知名错误!', status='error', - data='', - status_code=500 # 500 Internal Server Error + data='' ) def download_and_process_file(file_url, zb_type): @@ -111,8 +108,7 @@ def generate_response(final_json_path): return create_response( message='final_json not found', status='error', - data='', - status_code=404 # 404 Not Found + data='' ) try: @@ -124,13 +120,11 @@ def generate_response(final_json_path): return create_response( message='Error processing final_json.', status='error', - data='', - status_code=500 # 500 Internal Server Error + data='' ) return create_response( message='Little Parse processed successfully', status='success', - data=json_str, - status_code=200 # 200 OK + data=json_str )