加入了头像信息

This commit is contained in:
liuwei
2025-05-26 15:44:04 +08:00
parent 6687e2c6f6
commit af0e98786b
4 changed files with 350 additions and 6 deletions

View File

@@ -35,6 +35,34 @@ class UserMixin(WechatAPIClientBase):
else:
self.error_handler(json_resp)
async def get_profile_info_ext(self, wxid: str = None) -> dict:
"""获取用户扩展信息。
Args:
wxid (str, optional): 用户wxid. Defaults to None.
Returns:
dict: 用户信息字典
Raises:
UserLoggedOut: 未登录时调用
根据error_handler处理错误
"""
if not self.wxid and not wxid:
raise UserLoggedOut("请先登录")
if not wxid:
wxid = self.wxid
async with aiohttp.ClientSession() as session:
response = await session.post(f'http://{self.ip}:{self.port}/api/User/GetContractProfile?wxid={wxid}')
json_resp = await response.json()
if json_resp.get("Success"):
return json_resp.get("Data").get("userInfoExt")
else:
self.error_handler(json_resp)
async def get_my_qrcode(self, style: int = 0) -> str:
"""获取个人二维码。