修复报错

This commit is contained in:
2025-11-05 23:10:51 +08:00
parent 10b123ab93
commit a1f7c09b2a
12 changed files with 51 additions and 44 deletions

View File

@@ -330,7 +330,7 @@ func (s *pigFarmService) DeletePen(ctx context.Context, id uint) error {
func (s *pigFarmService) UpdatePenStatus(ctx context.Context, id uint, newStatus models.PenStatus) (*dto.PenResponse, error) {
serviceCtx, logger := logs.Trace(ctx, s.ctx, "UpdatePenStatus")
var updatedPen *models.Pen
err := s.uow.ExecuteInTransaction(func(tx *gorm.DB) error {
err := s.uow.ExecuteInTransaction(serviceCtx, func(tx *gorm.DB) error {
pen, err := s.penRepository.GetPenByIDTx(serviceCtx, tx, id)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {