用户信息显示优化

This commit is contained in:
liuwei
2025-04-14 17:53:10 +08:00
parent a77536d3df
commit e2a3177692
2 changed files with 7 additions and 16 deletions

View File

@@ -182,25 +182,16 @@ class DashboardServer:
# 获取用户详细信息
user_info = self.wcf.get_user_info()
self.logger.info(f"获取用户信息:: {user_info}")
# 获取头像
avatar_path = None
try:
avatar_path = self.wcf.get_avatar(wx_id)
except Exception as e:
self.logger.warning(f"获取用户头像失败: {e}")
self.logger.info(f"获取用户信息:{user_info}")
return {
"success": True,
"data": {
"wx_id": wx_id,
"nickname": user_info.get("nickname", "未知用户"),
"avatar": avatar_path,
"signature": user_info.get("signature", ""),
"gender": user_info.get("gender", 0),
"country": user_info.get("country", ""),
"province": user_info.get("province", ""),
"city": user_info.get("city", "")
"wx_id": user_info.get("wxid", wx_id),
"nickname": user_info.get("name", "未知用户"),
"avatar": "logo.png", # 使用默认LOGO
"mobile": user_info.get("mobile", ""),
"home": user_info.get("home", "")
}
}
except Exception as e: