增加daily_diff 增删查业务

This commit is contained in:
2026-01-07 11:10:41 +08:00
parent 904bf9a6c4
commit 37e4d5b2e0
5 changed files with 353 additions and 0 deletions

21
app/models/daily_diff.py Normal file
View File

@@ -0,0 +1,21 @@
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
}