2026-03-18 17:18:23 +08:00
|
|
|
|
"""WebSocket 配额检查:通过注入 QuotaService,不直接 import quota 内部函数。"""
|
2026-03-19 14:36:14 +08:00
|
|
|
|
|
2026-03-18 17:18:23 +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)
|