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 )