from datetime import datetime from sqlalchemy import JSON, DateTime, String, Text, Boolean from sqlalchemy.orm import Mapped, mapped_column from app.core.base_model import PaymentModelMixin, TenantMixin class AlipayNotifyLogModel(PaymentModelMixin): """支付宝通知日志模型""" __tablename__ = "pay_alipay_notify_log" __table_args__ = {"comment": "支付宝通知日志表"} notify_id: Mapped[str | None] = mapped_column( String(50), nullable=False, comment="通知ID" ) msg_method: Mapped[str] = mapped_column( String(100), nullable=False, comment="消息接口名称" ) notify_type: Mapped[str | None] = mapped_column( String(100), comment="通知类型" ) message: Mapped[dict] = mapped_column( JSON, nullable=False, comment="完整的消息数据" ) verify_result: Mapped[bool] = mapped_column( Boolean, nullable=False, comment="验签结果" ) process_result: Mapped[bool | None] = mapped_column( Boolean, comment="处理结果" ) error: Mapped[str | None] = mapped_column( Text, comment="错误信息" ) received_at: Mapped[datetime] = mapped_column( DateTime, default=datetime.now, nullable=False, comment="接收时间" )