From 6decfdca6f83c527249d19d5f54dade32e83ad32 Mon Sep 17 00:00:00 2001 From: cjy Date: Wed, 22 Oct 2025 15:54:03 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E5=A5=97=E9=A4=90=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E4=B8=8D=E8=83=BD=E5=AE=8C=E6=88=90=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E8=89=BA=E4=BA=BA=E7=9A=84=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/controller/task.go | 2 +- internal/logic/taskLogic.go | 31 ++++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/internal/controller/task.go b/internal/controller/task.go index e2d8d5c..42c3af1 100644 --- a/internal/controller/task.go +++ b/internal/controller/task.go @@ -182,7 +182,7 @@ func (b *BundleProvider) CompleteTaskManually(_ context.Context, req *bundle.Com } return &bundle.CommonResponse{ - Msg: "任务完成状态更新成功", + Msg: "任务完成", }, nil } diff --git a/internal/logic/taskLogic.go b/internal/logic/taskLogic.go index 40bd841..8dfb5ce 100644 --- a/internal/logic/taskLogic.go +++ b/internal/logic/taskLogic.go @@ -282,11 +282,32 @@ func GetEmployeeAssignedTasks(req *dao.EmployeeTaskQueryRequest) ([]*dao.TaskAss // CompleteTaskManually 员工手动点击完成任务 func CompleteTaskManually(assignRecordsUUID string, taskAssigneeNum string) error { - // // 第一步,批量更新记录被指派的员工为taskAssigneeNum的待完成任务数量和已经完成任务的数量 - // err := dao.UpdateTaskRecordsByAssigneeNum(taskAssigneeNum) - // if err != nil { - // return err - // } + // 第一步,查询指派记录,获取艺人编号 + record, err := dao.GetAssignRecordByUUID(assignRecordsUUID) + if err != nil { + return err + } + if record == nil { + return commonErr.ReturnError(nil, "未找到任务记录", "未找到指派记录: ") + } + + // 第二步,校验该艺人是否为有效艺人(套餐未过期且已激活) + validArtistList, err := GetValidArtistList() + if err != nil { + return err + } + isValid := false + for _, a := range validArtistList { + if a.CustomerNum == record.SubNum { + isValid = true + break + } + } + if !isValid { + return commonErr.ReturnError(nil, "该艺人套餐已过期,暂不能完成任务", "艺人套餐已过期,暂不能完成任务: ") + } + + // 第三步,执行任务完成更新 return dao.CompleteTaskManually(assignRecordsUUID) }