Skip to content

Commit

Permalink
完善csv字段
Browse files Browse the repository at this point in the history
  • Loading branch information
LC044 committed Jan 4, 2024
1 parent 1d67b16 commit cad1d45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/DataBase/exporter_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ def to_csv(self):
writer = csv.writer(file)
writer.writerow(columns)
# 写入数据
writer.writerows(messages)
# writer.writerows(messages)
for msg in messages:
other_data = [msg[12].remark, msg[12].nickName, msg[12].wxid] if self.contact.is_chatroom else []
writer.writerow([*msg[:9], *other_data])
self.okSignal.emit('ok')

def run(self):
self.to_csv()
self.to_csv()
4 changes: 3 additions & 1 deletion app/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def __init__(self):
self.name = ''
self.mobile = ''
self.smallHeadImgUrl = ''
self.nickName = self.name
self.remark = self.nickName


class Contact(Person):
Expand All @@ -79,7 +81,7 @@ def __init__(self, contact_info: Dict):
self.avatar_path = Icon.Default_avatar_path
self.is_chatroom = self.wxid.__contains__('@chatroom')
self.detail = contact_info.get('detail')
self.label_name = contact_info.get('label_name') # 联系人的标签分类
self.label_name = contact_info.get('label_name') # 联系人的标签分类

"""
detail存储了联系人的详细信息,是个字典
Expand Down

0 comments on commit cad1d45

Please sign in to comment.