feat(notify): 添加发送到群聊

This commit is contained in:
2026-04-29 23:26:14 +08:00
parent 081f63c1d4
commit bb923ee2b3
6 changed files with 95 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ import logging
import base64
import hashlib
from notify.wechat_company import send_image
from notify.wechat_company import send_image, upload_and_notify
from services.render import render_ammeter_chart, render_water_chart
from services import collector
import config
@@ -122,8 +122,11 @@ class SD:
ele_img_path = await render_ammeter_chart()
if ele_img_path:
logger.info("生成电表图表成功: %s", ele_img_path)
ele_b64, ele_md5 = image_to_base64_md5(ele_img_path)
await send_image(ele_b64, ele_md5)
# ele_b64, ele_md5 = image_to_base64_md5(ele_img_path)
# await send_image(ele_b64, ele_md5)
await upload_and_notify(
ele_img_path, config.WEBHOOK_GROUP_ID, ele_img_path.split("/")[-1]
)
logger.info("电表图表推送完成")
else:
logger.warning("未生成电表图表,跳过推送")
@@ -131,8 +134,13 @@ class SD:
water_img_path = await render_water_chart()
if water_img_path:
logger.info("生成水表图表成功: %s", water_img_path)
water_b64, water_md5 = image_to_base64_md5(water_img_path)
await send_image(water_b64, water_md5)
# water_b64, water_md5 = image_to_base64_md5(water_img_path)
# await send_image(water_b64, water_md5)
await upload_and_notify(
water_img_path,
config.WEBHOOK_GROUP_ID,
water_img_path.split("/")[-1],
)
logger.info("水表图表推送完成")
else:
logger.warning("未生成水表图表,跳过推送")