payment_confirmation.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. from sqlalchemy import Column, BigInteger, Integer, String, Enum, DateTime, func
  2. from app.core.database import Base
  3. class VasPaymentConfirmation(Base):
  4. __tablename__ = "vas_payment_confirm"
  5. __ddl__ = """
  6. CREATE TABLE IF NOT EXISTS `vas_payment_confirm` (
  7. `id` BIGINT NOT NULL AUTO_INCREMENT,
  8. `payment_id` BIGINT NOT NULL,
  9. `amount` INT NOT NULL,
  10. `currency` VARCHAR(10) NOT NULL,
  11. `random_offset` INT NOT NULL,
  12. `user_id` VARCHAR(128) NOT NULL,
  13. `status` ENUM('pending','confirmed','ignored') NOT NULL DEFAULT 'pending',
  14. `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  15. `confirmed_at` DATETIME NULL,
  16. `admin_id` VARCHAR(128) NULL,
  17. `admin_confirmed_at` DATETIME NULL,
  18. PRIMARY KEY (`id`),
  19. KEY `idx_vas_pay_conf_payment` (`payment_id`),
  20. KEY `idx_vas_pay_conf_user` (`user_id`)
  21. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='人工支付确认审核记录表';
  22. """
  23. id = Column(BigInteger, primary_key=True, autoincrement=True)
  24. payment_id = Column(BigInteger, nullable=False)
  25. amount = Column(Integer, nullable=False)
  26. currency = Column(String(10), nullable=False)
  27. random_offset = Column(Integer, nullable=False)
  28. user_id = Column(String(128), nullable=False)
  29. status = Column(Enum("pending","confirmed","ignored"), nullable=False, default="pending")
  30. created_at = Column(DateTime, nullable=False, server_default=func.now())
  31. confirmed_at = Column(DateTime, nullable=True)
  32. admin_id = Column(String(128), nullable=True)
  33. admin_confirmed_at = Column(DateTime, nullable=True)