fix: wxid传参
This commit is contained in:
35
WXBotDemo.py
35
WXBotDemo.py
@@ -151,18 +151,9 @@ def kp(event_data):
|
||||
|
||||
elif msg_type == 49: # 49 xml消息
|
||||
# 获取根节点
|
||||
root=ET.fromstring(msg)
|
||||
|
||||
# 微信好友的wxid
|
||||
wxid='111'
|
||||
for pagepath in xml_appmsg.iter('pagepath'):
|
||||
print (pagepath.text) # 打印名字
|
||||
pagepath.text =pagepath.text +f'/?wxid={wxid}'
|
||||
print ('修改path',pagepath.text) # 打印名字
|
||||
|
||||
|
||||
|
||||
root=ET.fromstring(msg)
|
||||
xml_appmsg = root.find('appmsg')
|
||||
|
||||
xml_title = xml_appmsg.findtext('title')
|
||||
xml_type = xml_appmsg.findtext('type')
|
||||
xml_des = xml_appmsg.findtext('des')
|
||||
@@ -177,11 +168,11 @@ def kp(event_data):
|
||||
print("kp_log--------------------------------",msg)
|
||||
# 本身也是系统消息-link,会无线循环
|
||||
# 判断是不是自己发的消息
|
||||
if data.get('isSender') != 1:
|
||||
WXBotService.send_link_message(
|
||||
account_wxid, "wxid_w2imh7ki5s4q12", "title", "dec",
|
||||
"https://www.baidu.com",
|
||||
"https://p1-q.mafengwo.net/s17/M00/E3/9C/CoUBXl_cawCAQWMcAAGGhEoBcRU77.jpeg")
|
||||
# if data.get('isSender') != 1:
|
||||
# WXBotService.send_link_message(
|
||||
# account_wxid, "wxid_w2imh7ki5s4q12", "title", "dec",
|
||||
# "https://www.baidu.com",
|
||||
# "https://p1-q.mafengwo.net/s17/M00/E3/9C/CoUBXl_cawCAQWMcAAGGhEoBcRU77.jpeg")
|
||||
|
||||
|
||||
elif xml_type == '6': # 6 文件
|
||||
@@ -197,6 +188,18 @@ def kp(event_data):
|
||||
# print('msg---', msg)
|
||||
# 发送小程序
|
||||
if data.get('isSender') != 1:
|
||||
root=ET.fromstring(msg)
|
||||
|
||||
# 微信好友的wxid
|
||||
wxid='wxid_w2imh7ki5s4q12'
|
||||
for pagepath in root.iter('pagepath'):
|
||||
print (pagepath.text) # 打印名字
|
||||
pagepath.text =pagepath.text +f'?wxid={wxid}'
|
||||
print ('修改path',pagepath.text) # 打印名字
|
||||
|
||||
# 修改后的xml转成string , method='xml'
|
||||
msg =ET.tostring(root, encoding='utf-8').decode('utf-8')
|
||||
|
||||
WXBotService.send_xml_message(
|
||||
account_wxid, "wxid_w2imh7ki5s4q12", msg
|
||||
# account_wxid, "wxid_w2imh7ki5s4q12", planetXml
|
||||
|
||||
Reference in New Issue
Block a user