Impl get contacts

This commit is contained in:
Changhua 2023-05-06 22:12:26 +08:00
parent 0e7061f74d
commit 08b153e5b4

View File

@ -43,6 +43,7 @@ class Http(FastAPI):
self.add_api_route("/login", self.is_login, methods=["GET"], summary="获取登录状态")
self.add_api_route("/wxid", self.get_self_wxid, methods=["GET"], summary="获取登录账号 wxid")
self.add_api_route("/msg-types", self.get_msg_types, methods=["GET"], summary="获取消息类型")
self.add_api_route("/contacts", self.get_contacts, methods=["GET"], summary="获取完整通讯录")
def _set_cb(self, cb):
def callback(msg: WxMsg):
@ -133,3 +134,10 @@ class Http(FastAPI):
if ret:
return {"status": 0, "message": "成功", "data": {"types": ret}}
return {"status": -1, "message": "失败"}
def get_contacts(self) -> dict:
"""获取完整通讯录"""
ret = self.wcf.get_contacts()
if ret:
return {"status": 0, "message": "成功", "data": {"contacts": ret}}
return {"status": -1, "message": "失败"}