recharge_record.py 1.0 KB

123456789101112131415161718192021222324
  1. """
  2. 充值记录模型
  3. """
  4. from datetime import datetime
  5. from app.utils.timezone import beijing_now_naive
  6. from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
  7. from app.database import Base
  8. class RechargeRecord(Base):
  9. """充值记录表"""
  10. __tablename__ = "recharge_records"
  11. id = Column(Integer, primary_key=True, autoincrement=True, comment="主键ID")
  12. user_id = Column(Integer, nullable=False, comment="用户ID")
  13. card_id = Column(Integer, nullable=False, comment="卡密ID")
  14. software_code = Column(String(50), nullable=False, comment="软件特征码")
  15. days = Column(Integer, nullable=False, comment="充值天数")
  16. expire_time_before = Column(DateTime, nullable=True, comment="充值前到期时间")
  17. expire_time_after = Column(DateTime, nullable=True, comment="充值后到期时间")
  18. created_at = Column(DateTime, default=beijing_now_naive, comment="创建时间")
  19. def __repr__(self):
  20. return f"<RechargeRecord(id={self.id}, user_id={self.user_id}, card_id={self.card_id})>"