From 3638845d6e2e76488fb7c5a609803f4130ccdc86 Mon Sep 17 00:00:00 2001 From: cjy Date: Wed, 22 Oct 2025 13:05:50 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E5=AE=8C=E6=88=90=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E8=B6=85=E8=BF=87=E9=99=90=E5=88=B6=E4=B8=8D=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/taskDao.go | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/internal/dao/taskDao.go b/internal/dao/taskDao.go index 177aa29..d8ce3d6 100644 --- a/internal/dao/taskDao.go +++ b/internal/dao/taskDao.go @@ -5,10 +5,11 @@ import ( "micro-bundle/internal/model" "micro-bundle/pkg/app" commonErr "micro-bundle/pkg/err" - "time" "strings" + "time" "github.com/google/uuid" + "go.uber.org/zap" "gorm.io/gorm" ) @@ -493,22 +494,46 @@ func UpdateTaskProgress(req *CompleteTaskRequest) error { case "video": newCompleteCount := assignRecord.CompleteVideoCount + req.CompleteCount if newCompleteCount > assignRecord.AssignVideoCount { - tx.Rollback() - return commonErr.ReturnError(nil, "完成数量超出限制", "视频完成数量不能超过指派数量") + // 记录超限日志,但不返回错误 + app.ModuleClients.Lg.Info("视频完成数量超出限制", + zap.String("assignRecordsUUID", assignRecord.AssignRecordsUUID), + zap.String("employeeName", req.EmployeeName), + zap.String("employeeNum", req.EmployeeNum), + zap.Int("currentCompleteCount", assignRecord.CompleteVideoCount), + zap.Int("requestCompleteCount", req.CompleteCount), + zap.Int("newCompleteCount", newCompleteCount), + zap.Int("assignVideoCount", assignRecord.AssignVideoCount), + ) } updateData["complete_video_count"] = newCompleteCount case "post": newCompleteCount := assignRecord.CompletePostCount + req.CompleteCount if newCompleteCount > assignRecord.AssignPostCount { - tx.Rollback() - return commonErr.ReturnError(nil, "完成数量超出限制", "图文完成数量不能超过指派数量") + // 记录超限日志,但不返回错误 + app.ModuleClients.Lg.Info("图文完成数量超出限制", + zap.String("assignRecordsUUID", assignRecord.AssignRecordsUUID), + zap.String("employeeName", req.EmployeeName), + zap.String("employeeNum", req.EmployeeNum), + zap.Int("currentCompleteCount", assignRecord.CompletePostCount), + zap.Int("requestCompleteCount", req.CompleteCount), + zap.Int("newCompleteCount", newCompleteCount), + zap.Int("assignPostCount", assignRecord.AssignPostCount), + ) } updateData["complete_post_count"] = newCompleteCount case "data": newCompleteCount := assignRecord.CompleteDataCount + req.CompleteCount if newCompleteCount > assignRecord.AssignDataCount { - tx.Rollback() - return commonErr.ReturnError(nil, "完成数量超出限制", "数据完成数量不能超过指派数量") + // 记录超限日志,但不返回错误 + app.ModuleClients.Lg.Info("数据完成数量超出限制", + zap.String("assignRecordsUUID", assignRecord.AssignRecordsUUID), + zap.String("employeeName", req.EmployeeName), + zap.String("employeeNum", req.EmployeeNum), + zap.Int("currentCompleteCount", assignRecord.CompleteDataCount), + zap.Int("requestCompleteCount", req.CompleteCount), + zap.Int("newCompleteCount", newCompleteCount), + zap.Int("assignDataCount", assignRecord.AssignDataCount), + ) } updateData["complete_data_count"] = newCompleteCount default: