diff --git a/src/routes/account_routes.py b/src/routes/account_routes.py index 6330a58..cb254ea 100644 --- a/src/routes/account_routes.py +++ b/src/routes/account_routes.py @@ -7,7 +7,7 @@ from flask import Blueprint, jsonify, abort from core.app_state import get_trader, is_real_mode, logger -account_bp = Blueprint('account_routes', __name__, url_prefix='/yu') +account_bp = Blueprint('account_routes', __name__, url_prefix='/fenxijia') def _check_trader_availability(): """辅助函数,检查交易实例是否可用,如果不可用则 abort(503)。""" diff --git a/src/routes/health_routes.py b/src/routes/health_routes.py index 4c65081..c8e1abf 100644 --- a/src/routes/health_routes.py +++ b/src/routes/health_routes.py @@ -5,7 +5,7 @@ from flask import Blueprint, jsonify from core.app_state import is_real_mode, get_trader, logger -health_bp = Blueprint('health_routes', __name__, url_prefix='/yu') +health_bp = Blueprint('health_routes', __name__, url_prefix='/fenxijia') @health_bp.route("/healthcheck", methods=["GET"]) def health_check(): diff --git a/src/routes/strategy_routes.py b/src/routes/strategy_routes.py index adb8fb1..5e5681b 100644 --- a/src/routes/strategy_routes.py +++ b/src/routes/strategy_routes.py @@ -5,7 +5,7 @@ from flask import Blueprint, jsonify, abort from core.app_state import get_trader, logger -strategy_bp = Blueprint('strategy_routes', __name__, url_prefix='/yu') +strategy_bp = Blueprint('strategy_routes', __name__, url_prefix='/fenxijia') @strategy_bp.route("/clear/", methods=["DELETE"]) def clear_strategy_route(strategy_name: str): # Renamed diff --git a/src/routes/trading_routes.py b/src/routes/trading_routes.py index bc3f2d2..6c21cc8 100644 --- a/src/routes/trading_routes.py +++ b/src/routes/trading_routes.py @@ -7,7 +7,7 @@ from core.app_state import get_trader, get_real_trader_manager, is_real_mode, lo from core.base_trader import BaseTrader from core.trade_constants import ORDER_TYPE_LIMIT, ORDER_DIRECTION_BUY, ORDER_DIRECTION_SELL -trading_bp = Blueprint('trading_routes', __name__, url_prefix='/yu') +trading_bp = Blueprint('trading_routes', __name__, url_prefix='/fenxijia') @trading_bp.route("/buy", methods=["POST"]) def buy(): diff --git a/src/trade_server.py b/src/trade_server.py index 64d873d..340b5c2 100644 --- a/src/trade_server.py +++ b/src/trade_server.py @@ -60,11 +60,10 @@ def initialize_app_services(): @app.before_request def check_path_prefix() -> None: """中间件:拦截所有不以 /yu 开头的请求并返回404。""" - if not request.path.startswith('/yu'): + if not request.path.startswith('/fenxijia'): # 允许访问 Flask 的静态文件,例如 /static/... - if not request.path.startswith(app.static_url_path or '/static'): - logger.warning(f"拦截非法路径请求: {request.path}") - abort(404) + logger.warning(f"拦截非法路径请求: {request.path}") + abort(404) # 注册蓝图 app.register_blueprint(health_bp)