From eacce3cacf71e10d487f85425c81a6290dd99ab5 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 21 May 2026 15:49:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=A0=E9=80=81=E5=B9=B8=E8=BF=90=E7=A4=BC?= =?UTF-8?q?=E7=89=A9=E4=BB=BB=E5=8A=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/app/listener/task/TaskListener.java | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java index 7cacd6ca..1e5fc007 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java @@ -115,7 +115,7 @@ public class TaskListener implements MessageListener { handleTask7(eventBody); break; case 8: - // 处理任务-8 的逻辑 发送10个幸运礼物 + // 处理任务-8 的逻辑 发送1个幸运礼物 handleTask8(eventBody); break; case 9: @@ -276,27 +276,10 @@ public class TaskListener implements MessageListener { } private void handleTask8(TaskApprovalEvent eventBody) { - log.warn("处理任务-8 发送10个幸运礼物: {}", eventBody); - - String redisKey = "task:lucky-gift:count:" + eventBody.getUserId(); - int num = eventBody.getQuantity() == null ? 1 : eventBody.getQuantity(); - - // 获取当前计数 - String countStr = redisService.getString(redisKey); - int currentCount = StringUtils.isEmpty(countStr) ? 0 : Integer.parseInt(countStr); - - // 计算新的计数值 - int newCount = currentCount + num; - - // 更新任务进度 - eventBody.setTargetValue(10); - eventBody.setCompleteValue(Math.min(newCount, 10)); - boolean updated = updateTaskStatus(eventBody); - - // 只有任务状态更新成功才更新 Redis - if (updated) { - redisService.increment(redisKey, num); - } + log.warn("处理任务-8 发送1个幸运礼物: {}", eventBody); + eventBody.setTargetValue(1); + eventBody.setCompleteValue(1); + updateTaskStatus(eventBody); } private void handleTask9(TaskApprovalEvent eventBody) {