11 lines
442 B
Python
11 lines
442 B
Python
"""WebSocket 配额检查:通过注入 QuotaService,不直接 import quota 内部函数。"""
|
||
|
||
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)
|