diff --git a/app/api/endpoints/order.py b/app/api/endpoints/order.py index c898a87..e3ad6a1 100644 --- a/app/api/endpoints/order.py +++ b/app/api/endpoints/order.py @@ -906,12 +906,13 @@ async def cancel_order( db.commit() - wechat = WeChatClient() - await wechat.apply_refund( - order_id=order.orderid, - total_amount=int(float(order.final_amount) * 100) if not settings.DEBUG else 1, # 转换为分 - reason="用户取消订单" - ) + if order.final_amount > 0: + wechat = WeChatClient() + await wechat.apply_refund( + order_id=order.orderid, + total_amount=int(float(order.final_amount) * 100) if not settings.DEBUG else 1, # 转换为分 + reason="用户取消订单" + ) # 发送企业微信消息 wecom_bot = WecomBot() @@ -1167,12 +1168,13 @@ async def deliveryman_cancel_order( db.commit() - wechat = WeChatClient() - await wechat.apply_refund( - order_id=order.orderid, - total_amount=int(float(order.final_amount) * 100) if not settings.DEBUG else 1, # 转换为分 - reason="配送员取消订单" - ) + if order.final_amount > 0: + wechat = WeChatClient() + await wechat.apply_refund( + order_id=order.orderid, + total_amount=int(float(order.final_amount) * 100) if not settings.DEBUG else 1, # 转换为分 + reason="配送员取消订单" + ) # 发送企业微信消息 wecom_bot = WecomBot() diff --git a/jobs.sqlite b/jobs.sqlite index f4f371b..a8bb479 100644 Binary files a/jobs.sqlite and b/jobs.sqlite differ