From 57d5d5a610b7109b01ba435f4320d5f1bbb38bbd Mon Sep 17 00:00:00 2001 From: gpu Date: Wed, 4 Feb 2026 21:19:40 +0800 Subject: [PATCH] 312 --- .../src/HoneyBox.Core/Services/TaskService.cs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/server/HoneyBox/src/HoneyBox.Core/Services/TaskService.cs b/server/HoneyBox/src/HoneyBox.Core/Services/TaskService.cs index 756acf77..5bd07585 100644 --- a/server/HoneyBox/src/HoneyBox.Core/Services/TaskService.cs +++ b/server/HoneyBox/src/HoneyBox.Core/Services/TaskService.cs @@ -162,8 +162,11 @@ public class TaskService : ITaskService if (user != null) { user.OuQi = (user.OuQi ?? 0) + reward; - user.UpdatedAt = now; currentOuQi = user.OuQi ?? 0; + + // 重新计算欧气等级 + user.OuQiLevel = CalculateOuQiLevel(currentOuQi); + user.UpdatedAt = now; // 记录欧气值变动 var profitOuQi = new ProfitOuQi @@ -257,4 +260,23 @@ public class TaskService : ITaskService return 0; } + + /// + /// 根据欧气值计算欧气等级 + /// + /// 当前欧气值 + /// 欧气等级 + private static int CalculateOuQiLevel(int ouQi) + { + // 等级阈值: 0=普通, 1=青铜(100), 2=白银(500), 3=黄金(1000), + // 4=铂金(3000), 5=钻石(6000), 6=星耀(10000), 7=王者(20000) + if (ouQi >= 20000) return 7; + if (ouQi >= 10000) return 6; + if (ouQi >= 6000) return 5; + if (ouQi >= 3000) return 4; + if (ouQi >= 1000) return 3; + if (ouQi >= 500) return 2; + if (ouQi >= 100) return 1; + return 0; + } }