Files
life-echo/api/app/features/conversation/ws/quota_guard.py

11 lines
442 B
Python
Raw Normal View History

"""WebSocket 配额检查:通过注入 QuotaService不直接 import quota 内部函数。"""
2026-03-19 14:36:14 +08:00
from app.features.quota.service import QuotaService
async def check_ws_quota(
quota_service: QuotaService, user_id: str, subscription_type: str
) -> tuple[bool, str]:
"""检查用户是否还能发送消息。返回 (是否允许, 提示信息)。"""
return await quota_service.check_can_send_message(user_id, subscription_type)