Merge branch 'feat-cjy-taskBench' into dev

This commit is contained in:
cjy 2025-10-22 13:06:10 +08:00
commit 483314d2c4

View File

@ -5,10 +5,11 @@ import (
"micro-bundle/internal/model" "micro-bundle/internal/model"
"micro-bundle/pkg/app" "micro-bundle/pkg/app"
commonErr "micro-bundle/pkg/err" commonErr "micro-bundle/pkg/err"
"time"
"strings" "strings"
"time"
"github.com/google/uuid" "github.com/google/uuid"
"go.uber.org/zap"
"gorm.io/gorm" "gorm.io/gorm"
) )
@ -493,22 +494,46 @@ func UpdateTaskProgress(req *CompleteTaskRequest) error {
case "video": case "video":
newCompleteCount := assignRecord.CompleteVideoCount + req.CompleteCount newCompleteCount := assignRecord.CompleteVideoCount + req.CompleteCount
if newCompleteCount > assignRecord.AssignVideoCount { 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 updateData["complete_video_count"] = newCompleteCount
case "post": case "post":
newCompleteCount := assignRecord.CompletePostCount + req.CompleteCount newCompleteCount := assignRecord.CompletePostCount + req.CompleteCount
if newCompleteCount > assignRecord.AssignPostCount { 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 updateData["complete_post_count"] = newCompleteCount
case "data": case "data":
newCompleteCount := assignRecord.CompleteDataCount + req.CompleteCount newCompleteCount := assignRecord.CompleteDataCount + req.CompleteCount
if newCompleteCount > assignRecord.AssignDataCount { 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 updateData["complete_data_count"] = newCompleteCount
default: default: