base_handler.py 658 B

1234567891011121314151617181920212223242526272829
  1. from abc import ABC, abstractmethod
  2. from typing import Generic, TypeVar
  3. from redis.asyncio import Redis
  4. from app.api.v1.module_system.auth.schema import AuthSchema
  5. T = TypeVar('T')
  6. class BaseHandler(ABC, Generic[T]):
  7. """通知处理器基类"""
  8. @abstractmethod
  9. async def handle(self, method: str, content: T, auth: AuthSchema, redis: Redis) -> bool:
  10. """
  11. 处理通知内容
  12. Args:
  13. method: 通知方法
  14. content: 通知内容
  15. auth: 认证信息
  16. redis: Redis实例,用于存储和获取tenant_id
  17. Returns:
  18. 处理是否成功
  19. """
  20. pass