|
|
@@ -146,7 +146,7 @@ class BizService(): |
|
|
|
for t in intersection_wxids: |
|
|
|
if t == intersection_wxids[0]: |
|
|
|
# 发送图片 |
|
|
|
ret,ret_msg,res = await self.wxchat.post_image(token_id, app_id, t, image_url) |
|
|
|
ret,ret_msg,res = await self.wxchat.post_image_async(token_id, app_id, t, image_url) |
|
|
|
if ret==200: |
|
|
|
aeskey = res["aesKey"] |
|
|
|
cdnthumburl = res["fileId"] |
|
|
@@ -162,11 +162,11 @@ class BizService(): |
|
|
|
else: |
|
|
|
if aeskey !="": |
|
|
|
# 转发图片 |
|
|
|
ret,ret_msg,res = await self.wxchat.forward_image(token_id, app_id, t, aeskey, cdnthumburl, cdnthumblength, cdnthumbheight, cdnthumbwidth, length, md5) |
|
|
|
ret,ret_msg,res = await self.wxchat.forward_image_async(token_id, app_id, t, aeskey, cdnthumburl, cdnthumblength, cdnthumbheight, cdnthumbwidth, length, md5) |
|
|
|
logger.info(f'{agent_wxid} 向 {t} 转发图片【{image_url}】{ret_msg}') |
|
|
|
else: |
|
|
|
# 发送图片 |
|
|
|
ret,ret_msg,res = await self.wxchat.post_image(token_id, app_id, t, image_url) |
|
|
|
ret,ret_msg,res = await self.wxchat.post_image_async(token_id, app_id, t, image_url) |
|
|
|
if ret==200: |
|
|
|
aeskey = res["aesKey"] |
|
|
|
cdnthumburl = res["fileId"] |
|
|
@@ -194,7 +194,7 @@ class BizService(): |
|
|
|
for t in intersection_wxids: |
|
|
|
# 发送送语音消息 |
|
|
|
if voice_url: |
|
|
|
ret,ret_msg,res = await self.wxchat.post_voice(token_id, app_id, t, voice_url,voice_during) |
|
|
|
ret,ret_msg,res = await self.wxchat.post_voice_async(token_id, app_id, t, voice_url,voice_during) |
|
|
|
if ret==200: |
|
|
|
logger.info(f'{agent_wxid} 向 {t} 发送语音文本【{text}】{ret_msg}') |
|
|
|
|
|
|
@@ -238,13 +238,13 @@ class BizService(): |
|
|
|
video_thumb_url,video_duration =download_video_and_get_thumbnail(file_url,thumbnail_path) |
|
|
|
print(f'视频缩略图 {video_thumb_url} 时长 {video_duration}') |
|
|
|
|
|
|
|
ret,ret_msg,res = await self.wxchat.post_video(token_id, app_id, t, file_url,video_thumb_url,video_duration) |
|
|
|
ret,ret_msg,res = await self.wxchat.post_video_async(token_id, app_id, t, file_url,video_thumb_url,video_duration) |
|
|
|
if ret==200: |
|
|
|
self.wxchat.forward_video_aeskey = res["aesKey"] |
|
|
|
self.wxchat.forward_video_cdnvideourl = res["cdnThumbUrl"] |
|
|
|
self.wxchat.forward_video_length = res["length"] |
|
|
|
else: |
|
|
|
ret,ret_msg,res = await self.wxchat.forward_video(token_id, app_id, t, self.wxchat.forward_video_aeskey, self.wxchat.forward_video_cdnvideourl, self.wxchat.forward_video_length) |
|
|
|
ret,ret_msg,res = await self.wxchat.forward_video_async(token_id, app_id, t, self.wxchat.forward_video_aeskey, self.wxchat.forward_video_cdnvideourl, self.wxchat.forward_video_length) |
|
|
|
print('转发视频') |
|
|
|
if ret==200: |
|
|
|
logger.info(f'{agent_wxid} 向 {t} 发送视频【{file_url}】{ret_msg}') |
|
|
|