增加分享卡片的logo链接

This commit is contained in:
shuaikangzhou 2024-01-03 21:12:58 +08:00
parent b711a2048b
commit 286127bae2
3 changed files with 8 additions and 2 deletions

View File

@ -241,7 +241,7 @@ class HtmlExporter(ExporterBase):
shutil.copy(app_logo, os.path.join(origin_docx_path, 'image', os.path.basename(app_logo)))
app_logo = './image/' + os.path.basename(app_logo)
else:
app_logo = ''
app_logo = card_data.get('app_logo')
doc.write(
f'''{{ type:49,sub_type:5, text:'',is_send:{is_send},avatar_path:'{avatar}',url:'{card_data.get('url')}',
timestamp:{timestamp},is_chatroom:{is_chatroom},displayname:'{display_name}',title:'{card_data.get('title')}',

View File

@ -106,7 +106,7 @@ class ExportDialog(QDialog):
def set_total_msg_num(self, num):
self.total_msg_num = num
b''+num +(1,1)
# b''+num +(1,1)
def export_finished(self):
self.export_button.setEnabled(True)

View File

@ -140,6 +140,7 @@ def share_card(bytesExtra, compress_content_):
url = appmsg.find('url').text
appinfo = root.find('appinfo')
show_display_name = appmsg.find('sourcedisplayname')
sourceusername = appmsg.find('sourceusername')
if show_display_name is not None:
show_display_name = show_display_name.text
else:
@ -155,6 +156,11 @@ def share_card(bytesExtra, compress_content_):
if msginfo[1][1][1] == 4:
app_logo = msginfo[1][2][1]
app_logo = "\\".join(app_logo.split('\\')[1:])
if sourceusername is not None:
from app.DataBase import micro_msg_db # 放上面会导致循环依赖
contact = micro_msg_db.get_contact_by_username(sourceusername.text)
if contact:
app_logo = contact[7]
return {
'title': escape_js_and_html(title),
'description': escape_js_and_html(des),