diff --git a/app/core/wecombot.py b/app/core/wecombot.py index 08a0084..8ba9508 100644 --- a/app/core/wecombot.py +++ b/app/core/wecombot.py @@ -152,7 +152,7 @@ class WecomBot: print(f"发送异常: {str(e)}") return False - def send_order_notification(self,db: Session, shipping_order: ShippingOrderDB, notify_type: OrderStatus = OrderStatus.CREATED) -> bool: + async def send_order_notification(self,db: Session, shipping_order: ShippingOrderDB, notify_type: OrderStatus = OrderStatus.CREATED) -> bool: """ 发送订单通知 @@ -174,7 +174,7 @@ class WecomBot: webhook = community.webot_webhook if not webhook: - raise ValueError("不支持的通知类型") + return False deliveryman = None if shipping_order.deliveryman_user_id: @@ -220,7 +220,7 @@ class WecomBot: > 电话: {deliveryman.phone[:3]}\*\*\*\*{deliveryman.phone[7:]} """ - return self.send_markdown(content, webhook) + return await self.send_markdown(content, webhook) except Exception as e: logging.exception(f"发送企业微信消息失败: {str(e)}")