Merge pull request #1938 from thsrite/main
This commit is contained in:
commit
408703d4a3
@ -135,6 +135,25 @@ class Subscribe(Base):
|
|||||||
subscribe.delete(db, subscribe.id)
|
subscribe.delete(db, subscribe.id)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
@db_query
|
||||||
|
def list_by_username(db: Session, username: str, state: str = None, mtype: str = None):
|
||||||
|
if mtype:
|
||||||
|
if state:
|
||||||
|
result = db.query(Subscribe).filter(Subscribe.state == state,
|
||||||
|
Subscribe.username == username,
|
||||||
|
Subscribe.type == mtype).all()
|
||||||
|
else:
|
||||||
|
result = db.query(Subscribe).filter(Subscribe.username == username,
|
||||||
|
Subscribe.type == mtype).all()
|
||||||
|
else:
|
||||||
|
if state:
|
||||||
|
result = db.query(Subscribe).filter(Subscribe.state == state,
|
||||||
|
Subscribe.username == username).all()
|
||||||
|
else:
|
||||||
|
result = db.query(Subscribe).filter(Subscribe.username == username).all()
|
||||||
|
return list(result)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@db_query
|
@db_query
|
||||||
def list_by_type(db: Session, mtype: str, days: int):
|
def list_by_type(db: Session, mtype: str, days: int):
|
||||||
|
@ -89,6 +89,18 @@ class SubscribeOper(DbOper):
|
|||||||
subscribe.update(self._db, payload)
|
subscribe.update(self._db, payload)
|
||||||
return subscribe
|
return subscribe
|
||||||
|
|
||||||
|
def list_by_tmdbid(self, tmdbid: int, season: int = None) -> List[Subscribe]:
|
||||||
|
"""
|
||||||
|
获取指定tmdb_id的订阅
|
||||||
|
"""
|
||||||
|
return Subscribe.get_by_tmdbid(self._db, tmdbid=tmdbid, season=season)
|
||||||
|
|
||||||
|
def list_by_username(self, username: str, state: str = None, mtype: str = None) -> List[Subscribe]:
|
||||||
|
"""
|
||||||
|
获取指定用户的订阅
|
||||||
|
"""
|
||||||
|
return Subscribe.list_by_username(self._db, username=username, state=state, mtype=mtype)
|
||||||
|
|
||||||
def list_by_type(self, mtype: str, days: int = 7) -> Subscribe:
|
def list_by_type(self, mtype: str, days: int = 7) -> Subscribe:
|
||||||
"""
|
"""
|
||||||
获取指定类型的订阅
|
获取指定类型的订阅
|
||||||
|
Loading…
x
Reference in New Issue
Block a user