From 2ba47c5e25eaaa68abdccce1c26c7e65e31537cf Mon Sep 17 00:00:00 2001 From: aaron <> Date: Tue, 25 Feb 2025 13:35:20 +0800 Subject: [PATCH] update --- app/core/mpmessage.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/core/mpmessage.py b/app/core/mpmessage.py index 53c5a6e..cbe39d9 100644 --- a/app/core/mpmessage.py +++ b/app/core/mpmessage.py @@ -1,17 +1,21 @@ from app.core.config import settings from app.core.mpclient import mp_client from app.core.config import settings +import logging # 发送订单状态改变消息 async def sent_order_status_change_message(openid: str, template_id: str, data: dict): - await mp_client.send_template_message( - openid=openid, - template_id=template_id, - data=data, - miniprogram={ - "appid": settings.WECHAT_APPID, - "path": f"/pages/order/detail/index?id={data.orderid}" - } - ) \ No newline at end of file + try: + await mp_client.send_template_message( + openid=openid, + template_id=template_id, + data=data, + miniprogram={ + "appid": settings.WECHAT_APPID, + "path": f"/pages/order/detail/index?id={data.orderid}" + } + ) + except Exception as e: + logging.exception(f"发送模板消息失败: {str(e)}") \ No newline at end of file