修复批量已读事务原子性并补充回滚测试
This commit is contained in:
1 parent
e99edb189b
commit
c7e79ab4ac
3 files changed
+158
-6
No files matched your search
@@ -25,12 +25,10 @@ func MarkRead(ctx *context.Context, w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
for _, id := range reqData.IDs {
|
||||
if _, err := detail.GetEmailDetail(ctx, id, true); err != nil {
|
||||
log.WithContext(ctx).WithError(err).Error("mark email read failed")
|
||||
response.NewErrorResponse(response.ServerError, "更新邮件失败", "").FPrint(w)
|
||||
return
|
||||
}
|
||||
if err := detail.MarkEmailsRead(ctx, reqData.IDs); err != nil {
|
||||
log.WithContext(ctx).WithError(err).Error("mark email read failed")
|
||||
response.NewErrorResponse(response.ServerError, "更新邮件失败", "").FPrint(w)
|
||||
return
|
||||
}
|
||||
response.NewSuccessResponse("success").FPrint(w)
|
||||
|
||||
|
||||
Reference in new issue
Block a user