card_his.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. """
  2. 卡密历史记录模型
  3. """
  4. from sqlalchemy import Column, Integer, String, DateTime, Numeric, SmallInteger
  5. from app.database import Base
  6. class CardHis(Base):
  7. """卡密表历史记录"""
  8. __tablename__ = "cards_his"
  9. his_id = Column(Integer, primary_key=True, autoincrement=True, comment="历史记录主键ID")
  10. id = Column(Integer, nullable=False, comment="原表主键ID")
  11. card_code = Column(String(32), nullable=False, comment="卡密代码")
  12. software_code = Column(String(50), nullable=False, comment="软件特征码")
  13. days = Column(Integer, nullable=False, comment="天数")
  14. discount = Column(Numeric(5, 2), default=1.00, comment="折扣")
  15. user_id = Column(Integer, comment="激活用户ID")
  16. activated_at = Column(DateTime, comment="激活时间")
  17. expire_time = Column(DateTime, comment="到期时间")
  18. status = Column(SmallInteger, default=0, comment="状态:0-未激活,1-已激活,2-已过期")
  19. is_gift = Column(SmallInteger, default=0, comment="是否赠送卡密:0-收费,1-赠送")
  20. is_extracted = Column(SmallInteger, default=0, comment="是否已提取:0-未提取,1-已提取")
  21. special_close = Column(SmallInteger, default=0, comment="特殊关闭:0-关闭,1-打开")
  22. issue_price = Column(Numeric(10, 2), nullable=True, comment="发放价格")
  23. issued_to = Column(String(200), nullable=True, comment="发放给谁(文本)")
  24. issue_remark = Column(String(500), nullable=True, comment="发放备注")
  25. issued_at = Column(DateTime, comment="发放时间")
  26. issued_admin_id = Column(Integer, comment="发放管理员ID")
  27. remark = Column(String(500), nullable=True, comment="备注")
  28. is_deleted = Column(SmallInteger, default=0, comment="是否删除:0-否,1-是")
  29. is_revoked = Column(SmallInteger, default=0, comment="是否已注销:0-否,1-是")
  30. revoked_at = Column(DateTime, nullable=True, comment="注销时间")
  31. revoked_reason = Column(String(500), nullable=True, comment="注销原因")
  32. revoked_admin_id = Column(Integer, nullable=True, comment="注销管理员ID")
  33. created_at = Column(DateTime, comment="创建时间")
  34. updated_at = Column(DateTime, comment="更新时间")
  35. his_created_at = Column(DateTime, comment="历史记录创建时间")
  36. his_operation = Column(String(10), nullable=False, comment="操作类型:INSERT/UPDATE/DELETE")