update url

This commit is contained in:
zhiyong 2025-05-23 17:59:02 +08:00
parent e3934bcdf9
commit c6966a96e0
5 changed files with 7 additions and 8 deletions

View File

@ -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)。"""

View File

@ -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():

View File

@ -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/<strategy_name>", methods=["DELETE"])
def clear_strategy_route(strategy_name: str): # Renamed

View File

@ -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():

View File

@ -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)