Skip to content

Commit

Permalink
Merge pull request #311 from gszw90/feature/handle_transaction
Browse files Browse the repository at this point in the history
fix: 操作工单过程中出现错误并返回,事务未回滚
  • Loading branch information
lanyulei authored Nov 18, 2024
2 parents 2a20e73 + 816b81b commit f396aa0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/service/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ func (h *Handle) HandleWorkOrder(
Where("user_id = ?", tools.GetUserId(c)).
Find(&currentUserInfo).Error
if err != nil {
h.tx.Rollback()
return
}

Expand All @@ -805,6 +806,7 @@ func (h *Handle) HandleWorkOrder(
// 获取流程通知类型列表
err = json.Unmarshal(processInfo.Notice, &noticeList)
if err != nil {
h.tx.Rollback()
return
}

Expand All @@ -816,6 +818,7 @@ func (h *Handle) HandleWorkOrder(
Pluck("email", &emailCCList).Error
if err != nil {
err = errors.New("查询邮件抄送人失败")
h.tx.Rollback()
return
}
}
Expand Down Expand Up @@ -862,6 +865,7 @@ func (h *Handle) HandleWorkOrder(
Where("user_id = ?", h.workOrderDetails.Creator).
Find(&sendToUserList).Error
if err != nil {
h.tx.Rollback()
return
}

Expand Down

0 comments on commit f396aa0

Please sign in to comment.