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 }