From 1c52f0adc658218c7131cbdaedd54e4d21e5f704 Mon Sep 17 00:00:00 2001 From: ziming Date: Tue, 12 Aug 2025 15:58:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=AC=94=E7=AB=8B=E5=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/data/repoimpl/order.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/data/repoimpl/order.go b/internal/data/repoimpl/order.go index 444da78..0e3c64a 100644 --- a/internal/data/repoimpl/order.go +++ b/internal/data/repoimpl/order.go @@ -329,6 +329,10 @@ func (p *OrderRepoImpl) Success(ctx context.Context, id uint64, voucherNo string return fmt.Errorf("update db fail %w", tx.Error) } + if tx.RowsAffected == 0 { + return fmt.Errorf("no rows affected") + } + return nil } @@ -378,6 +382,10 @@ func (p *OrderRepoImpl) Fail(ctx context.Context, id uint64, remark string) erro return fmt.Errorf("update db fail %w", tx.Error) } + if tx.RowsAffected == 0 { + return fmt.Errorf("no rows affected") + } + return nil }