fix api
This commit is contained in:
@ -60,6 +60,20 @@ class _PluginBase(metaclass=ABCMeta):
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_api(self) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
获取插件API
|
||||
[{
|
||||
"path": "/xx",
|
||||
"endpoint": self.xxx,
|
||||
"methods": ["GET", "POST"],
|
||||
"summary": "API名称",
|
||||
"description": "API说明"
|
||||
}]
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def stop_service(self):
|
||||
"""
|
||||
|
@ -25,6 +25,7 @@ from app.schemas.types import EventType
|
||||
|
||||
|
||||
class AutoSignIn(_PluginBase):
|
||||
|
||||
# 插件名称
|
||||
plugin_name = "站点自动签到"
|
||||
# 插件描述
|
||||
@ -78,6 +79,24 @@ class AutoSignIn(_PluginBase):
|
||||
"data": {}
|
||||
}]
|
||||
|
||||
def get_api(self) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
获取插件API
|
||||
[{
|
||||
"path": "/xx",
|
||||
"endpoint": self.xxx,
|
||||
"methods": ["GET", "POST"],
|
||||
"summary": "API说明"
|
||||
}]
|
||||
"""
|
||||
return [{
|
||||
"path": "/signin_by_domain",
|
||||
"endpoint": self.signin_by_domain,
|
||||
"methods": ["GET"],
|
||||
"summary": "站点签到",
|
||||
"description": "使用站点域名签到站点",
|
||||
}]
|
||||
|
||||
@eventmanager.register(EventType.SiteSignin)
|
||||
def sign_in(self, event: Event = None):
|
||||
"""
|
||||
|
@ -77,6 +77,24 @@ class SiteStatistic(_PluginBase):
|
||||
"data": {}
|
||||
}]
|
||||
|
||||
def get_api(self) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
获取插件API
|
||||
[{
|
||||
"path": "/xx",
|
||||
"endpoint": self.xxx,
|
||||
"methods": ["GET", "POST"],
|
||||
"summary": "API说明"
|
||||
}]
|
||||
"""
|
||||
return [{
|
||||
"path": "/refresh_by_domain",
|
||||
"endpoint": self.refresh_by_domain,
|
||||
"methods": ["GET"],
|
||||
"summary": "刷新站点数据",
|
||||
"description": "刷新对应域名的站点数据",
|
||||
}]
|
||||
|
||||
def stop_service(self):
|
||||
pass
|
||||
|
||||
|
Reference in New Issue
Block a user