- 修复了未设置订阅站点时无法编辑订阅的问题
- 历史记录支持过滤状态
This commit is contained in:
parent
8f4f4cc004
commit
dcf1985361
@ -42,16 +42,25 @@ def delete_download_history(history_in: schemas.DownloadHistory,
|
|||||||
def transfer_history(title: str = None,
|
def transfer_history(title: str = None,
|
||||||
page: int = 1,
|
page: int = 1,
|
||||||
count: int = 30,
|
count: int = 30,
|
||||||
|
status: bool = None,
|
||||||
db: Session = Depends(get_db),
|
db: Session = Depends(get_db),
|
||||||
_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
_: schemas.TokenPayload = Depends(verify_token)) -> Any:
|
||||||
"""
|
"""
|
||||||
查询转移历史记录
|
查询转移历史记录
|
||||||
"""
|
"""
|
||||||
|
if title == "失败":
|
||||||
|
title = None
|
||||||
|
status = False
|
||||||
|
elif title == "成功":
|
||||||
|
title = None
|
||||||
|
status = True
|
||||||
|
|
||||||
if title:
|
if title:
|
||||||
total = TransferHistory.count_by_title(db, title)
|
total = TransferHistory.count_by_title(db, title=title, status=status)
|
||||||
result = TransferHistory.list_by_title(db, title, page, count)
|
result = TransferHistory.list_by_title(db, title=title, page=page,
|
||||||
|
count=count, status=status)
|
||||||
else:
|
else:
|
||||||
result = TransferHistory.list_by_page(db, page, count)
|
result = TransferHistory.list_by_page(db, page=page, count=count, status=status)
|
||||||
total = TransferHistory.count(db)
|
total = TransferHistory.count(db)
|
||||||
|
|
||||||
return schemas.Response(success=True,
|
return schemas.Response(success=True,
|
||||||
|
@ -48,17 +48,28 @@ class TransferHistory(Base):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@db_query
|
@db_query
|
||||||
def list_by_title(db: Session, title: str, page: int = 1, count: int = 30):
|
def list_by_title(db: Session, title: str, page: int = 1, count: int = 30, status: bool = None):
|
||||||
result = db.query(TransferHistory).filter(TransferHistory.title.like(f'%{title}%')).order_by(
|
if status is not None:
|
||||||
TransferHistory.date.desc()).offset((page - 1) * count).limit(
|
result = db.query(TransferHistory).filter(TransferHistory.title.like(f'%{title}%'),
|
||||||
count).all()
|
TransferHistory.status == status).order_by(
|
||||||
|
TransferHistory.date.desc()).offset((page - 1) * count).limit(
|
||||||
|
count).all()
|
||||||
|
else:
|
||||||
|
result = db.query(TransferHistory).filter(TransferHistory.title.like(f'%{title}%')).order_by(
|
||||||
|
TransferHistory.date.desc()).offset((page - 1) * count).limit(
|
||||||
|
count).all()
|
||||||
return list(result)
|
return list(result)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@db_query
|
@db_query
|
||||||
def list_by_page(db: Session, page: int = 1, count: int = 30):
|
def list_by_page(db: Session, page: int = 1, count: int = 30, status: bool = None):
|
||||||
result = db.query(TransferHistory).order_by(TransferHistory.date.desc()).offset((page - 1) * count).limit(
|
if status is not None:
|
||||||
count).all()
|
result = db.query(TransferHistory).filter(TransferHistory.status == status).order_by(
|
||||||
|
TransferHistory.date.desc()).offset((page - 1) * count).limit(
|
||||||
|
count).all()
|
||||||
|
else:
|
||||||
|
result = db.query(TransferHistory).order_by(TransferHistory.date.desc()).offset((page - 1) * count).limit(
|
||||||
|
count).all()
|
||||||
return list(result)
|
return list(result)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -97,8 +108,12 @@ class TransferHistory(Base):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@db_query
|
@db_query
|
||||||
def count_by_title(db: Session, title: str):
|
def count_by_title(db: Session, title: str, status: bool = None):
|
||||||
return db.query(func.count(TransferHistory.id)).filter(TransferHistory.title.like(f'%{title}%')).first()[0]
|
if status is not None:
|
||||||
|
return db.query(func.count(TransferHistory.id)).filter(TransferHistory.title.like(f'%{title}%'),
|
||||||
|
TransferHistory.status == status).first()[0]
|
||||||
|
else:
|
||||||
|
return db.query(func.count(TransferHistory.id)).filter(TransferHistory.title.like(f'%{title}%')).first()[0]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@db_query
|
@db_query
|
||||||
|
@ -1 +1 @@
|
|||||||
APP_VERSION = 'v1.5.3'
|
APP_VERSION = 'v1.5.4'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user