Enhance backend functionality and frontend UI
- Updated main.py to include authentication for brand, model, and OTA routers. - Added new OTA schemas in schemas.py for version management. - Enhanced model retrieval with sorting options in models.py. - Improved model update functionality to support multipart/form-data uploads. - Updated frontend layout and styles for a more modern look, including new font integration. - Implemented login route and authentication checks in router/index.js. - Added sorting capabilities in model table and improved file handling in model view. - Updated requirements.txt to include PyJWT for token management.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Boolean, SmallInteger, Text
|
||||
from database import Base
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Ota(Base):
|
||||
"""OTA 升级版本模型"""
|
||||
__tablename__ = "ota"
|
||||
__table_args__ = {"comment": "OTA 升级版本"}
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True, comment="ID")
|
||||
verCode = Column(Integer, nullable=False, comment="版本号(整数)")
|
||||
verName = Column(String(20), nullable=False, comment="版本名称")
|
||||
url = Column(String(255), nullable=False, comment="升级包 URL")
|
||||
md5 = Column(String(32), nullable=False, comment="升级包 MD5")
|
||||
force = Column(SmallInteger, nullable=False, default=0, comment="是否强升;0-否")
|
||||
desc = Column(String(255), nullable=True, comment="描述")
|
||||
model = Column(String(100), nullable=True, comment="对应的设备型号")
|
||||
hw = Column(Integer, nullable=False, default=0, comment="硬件版本号")
|
||||
target = Column(SmallInteger, nullable=False, default=0, comment="是否定向,1-是,0-否;否表示面向所有用户")
|
||||
beta = Column(SmallInteger, nullable=False, default=0, comment="是否灰度,1-是,0-否")
|
||||
pawVerCode = Column(Integer, nullable=False, default=0, comment="配对版本号")
|
||||
pawVerName = Column(String(20), nullable=False, default='', comment="配对版本名称")
|
||||
pawUrl = Column(String(255), nullable=False, default='', comment="配对版本 URL")
|
||||
pawMd5 = Column(String(32), nullable=False, default='', comment="配对版本 MD5")
|
||||
startTime = Column(DateTime, nullable=True, comment="升级开始时间")
|
||||
endTime = Column(DateTime, nullable=True, comment="升级结束时间")
|
||||
status = Column(SmallInteger, nullable=False, default=1, comment="是否可用")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Ota(id={self.id}, verCode={self.verCode}, verName='{self.verName}')>"
|
||||
|
||||
def to_dict(self):
|
||||
"""Convert to dictionary"""
|
||||
return {
|
||||
"id": self.id,
|
||||
"verCode": self.verCode,
|
||||
"verName": self.verName,
|
||||
"url": self.url,
|
||||
"md5": self.md5,
|
||||
"force": self.force,
|
||||
"desc": self.desc,
|
||||
"model": self.model,
|
||||
"hw": self.hw,
|
||||
"target": self.target,
|
||||
"beta": self.beta,
|
||||
"pawVerCode": self.pawVerCode,
|
||||
"pawVerName": self.pawVerName,
|
||||
"pawUrl": self.pawUrl,
|
||||
"pawMd5": self.pawMd5,
|
||||
"startTime": self.startTime.isoformat() if self.startTime else None,
|
||||
"endTime": self.endTime.isoformat() if self.endTime else None,
|
||||
"status": self.status
|
||||
}
|
||||
Reference in New Issue
Block a user