Skip to content

Commit c679678

Browse files
committed
修复两处错误
1 parent ea691f4 commit c679678

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

efb_wechat_comwechat_slave/MsgDeco.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ def efb_share_link_wrapper(text: str) -> Message:
112112
处理msgType49消息 - 复合xml, xml 中 //appmsg/type 指示具体消息类型.
113113
/msg/appmsg/type
114114
已知:
115-
//appmsg/type = 1 : 至少包含百度网盘分享
115+
//appmsg/type = 1 : 百度网盘分享
116116
//appmsg/type = 2 : 微信运动
117117
//appmsg/type = 3 : 音乐分享
118-
//appmsg/type = 4 : 至少包含小红书分享
118+
//appmsg/type = 4 : 小红书分享
119119
//appmsg/type = 5 : 链接(公众号文章)
120120
//appmsg/type = 6 : 文件 (收到文件的第二个提示【文件下载完成】),也有可能 msgType = 10000 【【提示文件有风险】没有任何有用标识,无法判断是否与前面哪条消息有关联】
121121
//appmsg/type = 8 : 未解析图片消息
@@ -125,7 +125,7 @@ def efb_share_link_wrapper(text: str) -> Message:
125125
//appmsg/type = 24 : 从收藏中分享的笔记
126126
//appmsg/type = 33 : 美团外卖
127127
//appmsg/type = 35 : 消息同步
128-
//appmsg/type = 36 : 京东农场
128+
//appmsg/type = 36 : 京东农场,滴滴打车
129129
//appmsg/type = 51 : 视频(微信视频号分享)
130130
//appmsg/type = 53 : 转账过期退还通知
131131
//appmsg/type = 57 : 引用(回复)消息,未细致研究哪个参数是被引用的消息 id
@@ -173,9 +173,12 @@ def efb_share_link_wrapper(text: str) -> Message:
173173
)
174174
except:
175175
pass
176-
elif type in [ 4 , 36 ]: # 至少包含小红书分享 , 京东农场
176+
elif type in [ 4 , 36 ]: # 至少包含小红书分享 , 京东农场 , 滴滴打车
177177
title = xml.xpath('/msg/appmsg/title/text()')[0]
178-
des = xml.xpath('/msg/appmsg/des/text()')[0]
178+
try:
179+
des = xml.xpath('/msg/appmsg/des/text()')[0]
180+
except:
181+
des = ""
179182
url = xml.xpath('/msg/appmsg/url/text()')[0]
180183
app = xml.xpath('/msg/appinfo/appname/text()')[0]
181184
description = f"{des}\n---- from {app}"
@@ -334,7 +337,7 @@ def efb_share_link_wrapper(text: str) -> Message:
334337
type=MsgType.Text,
335338
text= '系统消息 : 消息同步',
336339
vendor_specific={ "is_mp": False }
337-
)
340+
)
338341
elif type == 40: # 转发的转发消息
339342
title = xml.xpath('/msg/appmsg/title/text()')[0]
340343
desc = xml.xpath('/msg/appmsg/des/text()')[0]
@@ -579,6 +582,24 @@ def efb_other_wrapper(text: str) -> Union[Message, None]:
579582
elif msg_type == "paymsg":
580583
if "待接收" in text and "转账" in text:
581584
efb_msg = efb_text_simple_wrapper("[你有一笔待接收的转账]")
585+
elif msg_type == "carditemmsg":
586+
msg_type = xml.xpath('/sysmsg/carditemmsg/msg_type/text()')[0]
587+
if str(msg_type) == "15":
588+
title = xml.xpath('/sysmsg/carditemmsg/title/text()')[0]
589+
desc = xml.xpath('/sysmsg/carditemmsg/description/text()')[0]
590+
url = xml.xpath('/sysmsg/carditemmsg/logo_url/text()')[0]
591+
attribute = LinkAttribute(
592+
title = title,
593+
description = desc,
594+
url = url,
595+
image = None
596+
)
597+
efb_msg = Message(
598+
attributes=attribute,
599+
type=MsgType.Link,
600+
text= None,
601+
vendor_specific={ "is_mp": False }
602+
)
582603

583604
if efb_msg:
584605
return efb_msg

0 commit comments

Comments
 (0)