software.py 1.2 KB

12345678910111213141516171819202122232425
  1. """
  2. 软件产品模型
  3. """
  4. from datetime import datetime
  5. from app.utils.timezone import beijing_now_naive
  6. from sqlalchemy import Column, Integer, String, Text, DateTime, Boolean, Numeric
  7. from app.database import Base
  8. class Software(Base):
  9. """软件产品表"""
  10. __tablename__ = "software"
  11. id = Column(Integer, primary_key=True, autoincrement=True, comment="主键ID")
  12. code = Column(String(50), unique=True, nullable=False, comment="软件特征码(如: buff-xp-steam-sh)")
  13. name = Column(String(100), nullable=False, comment="软件名称")
  14. daily_price = Column(Numeric(10, 2), default=0, comment="每天价格基数")
  15. description = Column(Text, nullable=True, comment="软件描述")
  16. is_active = Column(Boolean, default=True, comment="是否启用: 1-启用, 0-禁用")
  17. is_deleted = Column(Boolean, default=False, comment="是否删除: 0-否, 1-是")
  18. created_at = Column(DateTime, default=beijing_now_naive, comment="创建时间")
  19. updated_at = Column(DateTime, default=beijing_now_naive, onupdate=beijing_now_naive, comment="更新时间")
  20. def __repr__(self):
  21. return f"<Software(id={self.id}, code='{self.code}', name='{self.name}')>"