from abc import ABC, abstractmethod from typing import Generic, TypeVar from redis.asyncio import Redis from app.api.v1.module_system.auth.schema import AuthSchema T = TypeVar('T') class BaseHandler(ABC, Generic[T]): """通知处理器基类""" @abstractmethod async def handle(self, method: str, content: T, auth: AuthSchema, redis: Redis) -> bool: """ 处理通知内容 Args: method: 通知方法 content: 通知内容 auth: 认证信息 redis: Redis实例,用于存储和获取tenant_id Returns: 处理是否成功 """ pass