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