feat:模块健康检查
This commit is contained in:
@@ -20,6 +20,15 @@ class WechatModule(_ModuleBase):
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
def test(self) -> Tuple[bool, str]:
|
||||
"""
|
||||
测试模块连接性
|
||||
"""
|
||||
state = self.wechat.get_state()
|
||||
if state:
|
||||
return True, ""
|
||||
return False, "获取微信token失败"
|
||||
|
||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||
return "MESSAGER", "wechat"
|
||||
|
||||
|
@@ -47,6 +47,12 @@ class WeChat:
|
||||
if self._corpid and self._appsecret and self._appid:
|
||||
self.__get_access_token()
|
||||
|
||||
def get_state(self):
|
||||
"""
|
||||
获取状态
|
||||
"""
|
||||
return True if self.__get_access_token else False
|
||||
|
||||
@retry(Exception, logger=logger)
|
||||
def __get_access_token(self, force=False):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user