From 08b153e5b4ade240ef6b71b0a55741f541b923fa Mon Sep 17 00:00:00 2001 From: Changhua Date: Sat, 6 May 2023 22:12:26 +0800 Subject: [PATCH] Impl get contacts --- http/wcfhttp/core.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/http/wcfhttp/core.py b/http/wcfhttp/core.py index 07b43a0..456422d 100644 --- a/http/wcfhttp/core.py +++ b/http/wcfhttp/core.py @@ -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": "失败"}