| 1234567891011121314151617181920212223242526 |
- """
- 充值记录模型
- """
- from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Numeric, SmallInteger
- from sqlalchemy.orm import relationship
- from app.database import Base
- class RechargeRecord(Base):
- """充值记录表"""
- __tablename__ = "recharge_records"
- id = Column(Integer, primary_key=True, index=True, comment="主键ID")
- user_id = Column(Integer, ForeignKey("users.id"), nullable=False, index=True, comment="用户ID")
- card_id = Column(Integer, ForeignKey("cards.id"), index=True, comment="使用的卡密ID")
- software_code = Column(String(50), nullable=False, index=True, comment="软件特征码")
- days = Column(Integer, nullable=False, comment="充值天数")
- amount = Column(Numeric(10, 2), comment="充值金额")
- expire_time_before = Column(DateTime, comment="充值前到期时间")
- expire_time_after = Column(DateTime, comment="充值后到期时间")
- is_deleted = Column(SmallInteger, default=0, index=True, comment="是否删除:0-否,1-是")
- created_at = Column(DateTime, index=True, comment="充值时间")
-
- # 关系
- user = relationship("User", back_populates="recharge_records")
- card = relationship("Card", back_populates="recharge_records")
|