From 1f6d996d8515330ad10f90279ed0139370cfde89 Mon Sep 17 00:00:00 2001 From: zpc Date: Thu, 5 Feb 2026 20:06:19 +0800 Subject: [PATCH] 21 --- honey_box/common/env.js | 4 ++-- honey_box/package/mine/equity.vue | 12 +++++++++-- .../HoneyBox.Core/Services/QuanYiService.cs | 20 ++++++++++++++++++- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/honey_box/common/env.js b/honey_box/common/env.js index 6ee2ac79..927fcad7 100644 --- a/honey_box/common/env.js +++ b/honey_box/common/env.js @@ -11,9 +11,9 @@ // 测试环境配置 - .NET 10 后端 const testing = { - baseUrl: 'https://app.zpc-xy.com/honey/api', + // baseUrl: 'https://app.zpc-xy.com/honey/api', // baseUrl: 'http://192.168.1.24:5238', - // baseUrl: 'http://192.168.195.15:2822', + baseUrl: 'http://192.168.195.15:2822', imageUrl: 'https://youdas-1308826010.cos.ap-shanghai.myqcloud.com', loginPage: '', wxAppId: '' diff --git a/honey_box/package/mine/equity.vue b/honey_box/package/mine/equity.vue index 5f23d84b..b9390597 100644 --- a/honey_box/package/mine/equity.vue +++ b/honey_box/package/mine/equity.vue @@ -300,9 +300,17 @@ async getData() { try { const res = await getEquity(); + console.log('[equity] API响应:', JSON.stringify(res.data?.quan_yi_level)); if (res.status == 1) { - this.curLvId = `prize-item${res.data.quan_yi_level.level}` - + const qyLevel = res.data.quan_yi_level; + console.log('[equity] 等级信息:', { + level: qyLevel.level, + ou_qi: qyLevel.ou_qi, + next_ou_qi: qyLevel.next_ou_qi, + cha: qyLevel.cha, + jindu: qyLevel.jindu + }); + this.curLvId = `prize-item${qyLevel.level}` this.pageData = res.data } } catch (error) { diff --git a/server/HoneyBox/src/HoneyBox.Core/Services/QuanYiService.cs b/server/HoneyBox/src/HoneyBox.Core/Services/QuanYiService.cs index 778bf7a7..b3f7af4e 100644 --- a/server/HoneyBox/src/HoneyBox.Core/Services/QuanYiService.cs +++ b/server/HoneyBox/src/HoneyBox.Core/Services/QuanYiService.cs @@ -382,6 +382,9 @@ public class QuanYiService : IQuanYiService /// private QuanYiLevelInfo GetQuanYiLevelInfo(int ouQiLevel, int ouQi, List equityLevelConfigs) { + _logger.LogInformation("GetQuanYiLevelInfo called: ouQiLevel={OuQiLevel}, ouQi={OuQi}, configCount={ConfigCount}", + ouQiLevel, ouQi, equityLevelConfigs.Count); + // 从数据库配置构建等级阈值 var levelThresholds = equityLevelConfigs .ToDictionary(v => v.Level, v => v.Number); @@ -390,9 +393,13 @@ public class QuanYiService : IQuanYiService var levelTitles = equityLevelConfigs .ToDictionary(v => v.Level, v => v.Title ?? $"等级{v.Level}"); + _logger.LogInformation("Level thresholds from DB: {Thresholds}", + string.Join(", ", levelThresholds.Take(10).Select(kv => $"L{kv.Key}={kv.Value}"))); + // 如果没有配置,使用默认值 if (!levelThresholds.Any()) { + _logger.LogWarning("No equity level configs found in database, using defaults"); levelThresholds = new Dictionary { { 0, 0 }, @@ -423,6 +430,9 @@ public class QuanYiService : IQuanYiService var currentLevelOuQi = levelThresholds.GetValueOrDefault(ouQiLevel, 0); var maxLevel = levelThresholds.Keys.DefaultIfEmpty(0).Max(); + _logger.LogInformation("Level calculation: currentLevel={CurrentLevel}, nextLevel={NextLevel}, currentLevelOuQi={CurrentLevelOuQi}, nextOuQi={NextOuQi}, maxLevel={MaxLevel}", + ouQiLevel, nextLevel, currentLevelOuQi, nextOuQi, maxLevel); + // 计算差值和进度 int cha; int jindu; @@ -431,6 +441,7 @@ public class QuanYiService : IQuanYiService // 已满级 cha = -1; jindu = 100; + _logger.LogInformation("User is at max level"); } else { @@ -439,9 +450,11 @@ public class QuanYiService : IQuanYiService var levelRange = nextOuQi - currentLevelOuQi; var progress = ouQi - currentLevelOuQi; jindu = levelRange > 0 ? Math.Min(100, Math.Max(0, progress * 100 / levelRange)) : 0; + _logger.LogInformation("Progress calculation: levelRange={LevelRange}, progress={Progress}, cha={Cha}, jindu={Jindu}", + levelRange, progress, cha, jindu); } - return new QuanYiLevelInfo + var result = new QuanYiLevelInfo { Level = ouQiLevel, Title = title, @@ -450,6 +463,11 @@ public class QuanYiService : IQuanYiService Cha = cha, Jindu = jindu }; + + _logger.LogInformation("GetQuanYiLevelInfo result: Level={Level}, Title={Title}, OuQi={OuQi}, NextOuQi={NextOuQi}, Cha={Cha}, Jindu={Jindu}", + result.Level, result.Title, result.OuQi, result.NextOuQi, result.Cha, result.Jindu); + + return result; } ///