update url
This commit is contained in:
parent
e3934bcdf9
commit
c6966a96e0
@ -7,7 +7,7 @@ from flask import Blueprint, jsonify, abort
|
|||||||
|
|
||||||
from core.app_state import get_trader, is_real_mode, logger
|
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():
|
def _check_trader_availability():
|
||||||
"""辅助函数,检查交易实例是否可用,如果不可用则 abort(503)。"""
|
"""辅助函数,检查交易实例是否可用,如果不可用则 abort(503)。"""
|
||||||
|
@ -5,7 +5,7 @@ from flask import Blueprint, jsonify
|
|||||||
|
|
||||||
from core.app_state import is_real_mode, get_trader, logger
|
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"])
|
@health_bp.route("/healthcheck", methods=["GET"])
|
||||||
def health_check():
|
def health_check():
|
||||||
|
@ -5,7 +5,7 @@ from flask import Blueprint, jsonify, abort
|
|||||||
|
|
||||||
from core.app_state import get_trader, logger
|
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"])
|
@strategy_bp.route("/clear/<strategy_name>", methods=["DELETE"])
|
||||||
def clear_strategy_route(strategy_name: str): # Renamed
|
def clear_strategy_route(strategy_name: str): # Renamed
|
||||||
|
@ -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.base_trader import BaseTrader
|
||||||
from core.trade_constants import ORDER_TYPE_LIMIT, ORDER_DIRECTION_BUY, ORDER_DIRECTION_SELL
|
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"])
|
@trading_bp.route("/buy", methods=["POST"])
|
||||||
def buy():
|
def buy():
|
||||||
|
@ -60,9 +60,8 @@ def initialize_app_services():
|
|||||||
@app.before_request
|
@app.before_request
|
||||||
def check_path_prefix() -> None:
|
def check_path_prefix() -> None:
|
||||||
"""中间件:拦截所有不以 /yu 开头的请求并返回404。"""
|
"""中间件:拦截所有不以 /yu 开头的请求并返回404。"""
|
||||||
if not request.path.startswith('/yu'):
|
if not request.path.startswith('/fenxijia'):
|
||||||
# 允许访问 Flask 的静态文件,例如 /static/...
|
# 允许访问 Flask 的静态文件,例如 /static/...
|
||||||
if not request.path.startswith(app.static_url_path or '/static'):
|
|
||||||
logger.warning(f"拦截非法路径请求: {request.path}")
|
logger.warning(f"拦截非法路径请求: {request.path}")
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user