From 0c1e10ddae6446bf8d7841f977bbc51c69976f10 Mon Sep 17 00:00:00 2001 From: Changhua Date: Sat, 6 May 2023 22:22:24 +0800 Subject: [PATCH] Impl get user info --- http/wcfhttp/core.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/http/wcfhttp/core.py b/http/wcfhttp/core.py index 3e1178e..ebcfbb6 100644 --- a/http/wcfhttp/core.py +++ b/http/wcfhttp/core.py @@ -46,6 +46,7 @@ class Http(FastAPI): self.add_api_route("/contacts", self.get_contacts, methods=["GET"], summary="获取完整通讯录") self.add_api_route("/dbs", self.get_dbs, methods=["GET"], summary="获取所有数据库") self.add_api_route("/{db}/tables", self.get_tables, methods=["GET"], summary="获取 db 中所有表") + self.add_api_route("/user-info", self.get_user_info, methods=["GET"], summary="获取登录账号个人信息") def _set_cb(self, cb): def callback(msg: WxMsg): @@ -157,3 +158,10 @@ class Http(FastAPI): if ret: return {"status": 0, "message": "成功", "data": {"tables": ret}} return {"status": -1, "message": "失败"} + + def get_user_info(self) -> dict: + """获取登录账号个人信息""" + ret = self.wcf.get_user_info() + if ret: + return {"status": 0, "message": "成功", "data": {"ui": ret}} + return {"status": -1, "message": "失败"}