From 4decd8c6e7ef96154128757424f6b7c9bee46b26 Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Fri, 6 Sep 2024 11:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=A4=E8=81=8A=E5=A2=9E=E5=8A=A0=E7=BE=A4?= =?UTF-8?q?=E6=88=90=E5=91=98=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/db/dbMicro.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pywxdump/db/dbMicro.py b/pywxdump/db/dbMicro.py index d4cb0371..5741dd80 100644 --- a/pywxdump/db/dbMicro.py +++ b/pywxdump/db/dbMicro.py @@ -267,7 +267,7 @@ def get_room_list(self, word=None, roomwxids: list = None): DisplayNameList = DisplayNameList.split("^G") RoomData = ChatRoom_RoomData(RoomData) - wxid2remark = {} + wxid2roomNickname = {} if RoomData: rd = [] for k, v in RoomData.items(): @@ -276,13 +276,20 @@ def get_room_list(self, word=None, roomwxids: list = None): for i in rd: try: if isinstance(i, dict) and isinstance(i.get('1'), str) and i.get('2'): - wxid2remark[i['1']] = i["2"] + wxid2roomNickname[i['1']] = i["2"] except Exception as e: db_loger.error(f"wxid2remark: ChatRoomName:{ChatRoomName}, {i} error:{e}", exc_info=True) + + wxid2userinfo = self.get_user_list(wxids=UserNameList) + for i in wxid2userinfo: + wxid2userinfo[i]["roomNickname"] = wxid2roomNickname.get(i, "") + + owner = wxid2userinfo.get(Reserved2, Reserved2) + rooms[ChatRoomName] = { - "wxid": ChatRoomName, "UserNameList": UserNameList, "DisplayNameList": DisplayNameList, - "ChatRoomFlag": ChatRoomFlag, "IsShowName": IsShowName, "SelfDisplayName": SelfDisplayName, - "owner": Reserved2, "wxid2remark": wxid2remark, + "wxid": ChatRoomName, "roomWxids": UserNameList, "IsShowName": IsShowName, + "ChatRoomFlag": ChatRoomFlag, "SelfDisplayName": SelfDisplayName, + "owner": owner, "wxid2userinfo": wxid2userinfo, "Announcement": Announcement, "AnnouncementEditor": AnnouncementEditor, "AnnouncementPublishTime": AnnouncementPublishTime} return rooms