fix plugin install
This commit is contained in:
39
app/db/models/sitestatistic.py
Normal file
39
app/db/models/sitestatistic.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
from sqlalchemy import Boolean, Column, Integer, String, Sequence
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
|
from app.db import db_query, db_update, Base
|
||||||
|
|
||||||
|
|
||||||
|
class SiteStatistic(Base):
|
||||||
|
"""
|
||||||
|
站点统计表
|
||||||
|
"""
|
||||||
|
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
|
||||||
|
# 域名Key
|
||||||
|
domain = Column(String, index=True)
|
||||||
|
# 站点名
|
||||||
|
name = Column(String, nullable=False)
|
||||||
|
# 成功次数
|
||||||
|
success = Column(Integer)
|
||||||
|
# 失败次数
|
||||||
|
fail = Column(Integer)
|
||||||
|
# 平均耗时 秒
|
||||||
|
seconds = Column(Integer)
|
||||||
|
# 耗时记录 Json
|
||||||
|
note = Column(String)
|
||||||
|
# 最后一次访问状态 0-成功 1-失败
|
||||||
|
lst_state = Column(Integer)
|
||||||
|
# 最后访问时间
|
||||||
|
lst_mod_date = Column(String, default=datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
@db_query
|
||||||
|
def get_by_domain(db: Session, domain: str):
|
||||||
|
return db.query(SiteStatistic).filter(SiteStatistic.domain == domain).first()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
@db_update
|
||||||
|
def reset(db: Session):
|
||||||
|
db.query(SiteStatistic).delete()
|
@ -130,7 +130,7 @@ class PluginHelper(metaclass=Singleton):
|
|||||||
"""
|
"""
|
||||||
获取插件的文件列表
|
获取插件的文件列表
|
||||||
"""
|
"""
|
||||||
file_api = f"https://api.github.com/repos/{user}/{repo}/contents/plugins/{_p.lower()}"
|
file_api = f"https://api.github.com/repos/{user}/{repo}/contents/plugins/{_p}"
|
||||||
r = RequestUtils(proxies=settings.PROXY, headers=settings.GITHUB_HEADERS, timeout=30).get_res(file_api)
|
r = RequestUtils(proxies=settings.PROXY, headers=settings.GITHUB_HEADERS, timeout=30).get_res(file_api)
|
||||||
if r is None:
|
if r is None:
|
||||||
return None, "连接仓库失败"
|
return None, "连接仓库失败"
|
||||||
|
Reference in New Issue
Block a user