add 站点图标缓存
This commit is contained in:
@ -23,7 +23,6 @@ class Base:
|
||||
for key, value in payload.items():
|
||||
setattr(self, key, value)
|
||||
db.commit()
|
||||
db.refresh(self)
|
||||
|
||||
@classmethod
|
||||
def delete(cls, db, rid):
|
||||
|
@ -35,18 +35,3 @@ class Site(Base):
|
||||
@staticmethod
|
||||
def get_actives(db: Session):
|
||||
return db.query(Site).filter(Site.is_active == 1).all()
|
||||
|
||||
|
||||
class SiteIcon(Base):
|
||||
"""
|
||||
站点图标表
|
||||
"""
|
||||
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
|
||||
name = Column(String, nullable=False)
|
||||
domain = Column(String, index=True)
|
||||
url = Column(String, nullable=False)
|
||||
base64 = Column(String)
|
||||
|
||||
@staticmethod
|
||||
def get_by_domain(db: Session, domain: str):
|
||||
return db.query(SiteIcon).filter(SiteIcon.domain == domain).first()
|
||||
|
19
app/db/models/siteicon.py
Normal file
19
app/db/models/siteicon.py
Normal file
@ -0,0 +1,19 @@
|
||||
from sqlalchemy import Column, Integer, String, Sequence
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.db.models import Base
|
||||
|
||||
|
||||
class SiteIcon(Base):
|
||||
"""
|
||||
站点图标表
|
||||
"""
|
||||
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
|
||||
name = Column(String, nullable=False)
|
||||
domain = Column(String, index=True)
|
||||
url = Column(String, nullable=False)
|
||||
base64 = Column(String)
|
||||
|
||||
@staticmethod
|
||||
def get_by_domain(db: Session, domain: str):
|
||||
return db.query(SiteIcon).filter(SiteIcon.domain == domain).first()
|
Reference in New Issue
Block a user