855 协议版本-调整完毕内容

This commit is contained in:
liuwei
2025-04-30 14:48:38 +08:00
parent 14c469fddc
commit 25487c4e1b
2 changed files with 15 additions and 6 deletions

View File

@@ -45,6 +45,19 @@ class DashboardServer:
self.plugin_manager = robot_instance.plugin_manager
self.plugin_registry = robot_instance.plugin_registry
self.client: WechatAPIClient = robot_instance.ipad_bot
# 设置用户信息
self.user_data = {
# "wx_id": user_data.get("wxid", ""),
# "nickname": user_data.get("nickName", "未知用户"),
# "avatar": user_data.get("smallHeadImgUrl", "logo.png"), # 使用小头像URL
# "mobile": user_data.get("mobile", ""),
# "home": f"{user_data.get('province', '')}-{user_data.get('city', '')}" # 组合省市信息
"wxid": robot_instance.wx_id,
"nickName": robot_instance.nickname,
"smallHeadImgUrl": robot_instance.head_image,
"mobile": robot_instance.phone
}
self.LOG.info("使用Robot实例的对象进行初始化")
else:
self.LOG.error("未提供Robot实例Dashboard无法正常工作")
@@ -177,14 +190,9 @@ class DashboardServer:
return {"success": False, "message": "实例不可用"}
# 获取当前登录的微信ID
resp = self.client.get_profile(self.client.wxid)
self.LOG.info(f"get_current_user_info:{resp}")
if not resp or resp.get("ret") != 200:
self.LOG.error(f"获取用户信息失败: {resp}")
return {"success": False, "message": "获取用户信息失败"}
# 从新的resp格式中获取用户信息
user_data = resp.get("data", {})
user_data = self.user_data
if not user_data:
return {"success": False, "message": "未获取到用户数据"}

View File

@@ -165,6 +165,7 @@ class Robot(Job):
self.nickname = self.ipad_bot.nickname
self.alias = self.ipad_bot.alias
self.phone = self.ipad_bot.phone
self.head_image = profile.get("BigHeadImgUrl").get("string")
self.LOG.info(
f"wechat_ipad登录账号信息: wxid: {self.wxid} 昵称: {self.nickname} 微信号: {self.alias} 手机号: {self.phone}")