Files
railway_cloud/app/models/daily_diff.py

22 lines
853 B
Python

from sqlalchemy import Column, BigInteger, String, Date
from ..core.database import Base
class DailyDiff(Base):
__tablename__ = "daily_diff"
id = Column(BigInteger, primary_key=True, index=True, autoincrement=True)
account_id = Column(BigInteger, nullable=False, comment="账号ID", index=True)
account_name = Column(String(100), comment="账号名称")
check_time = Column(Date, comment="检查时间", index=True)
linecode = Column(String(100), comment="线路编码", index=True)
def to_dict(self):
"""将模型实例转换为字典"""
return {
"id": self.id,
"account_id": self.account_id,
"account_name": self.account_name,
"check_time": self.check_time.strftime("%Y-%m-%d") if self.check_time else None,
"linecode": self.linecode
}