From b8d9670953c239cb5d6e0bc9d8124e9ee835b827 Mon Sep 17 00:00:00 2001
From: ltx <1006158920@qq.com>
Date: Fri, 31 Jul 2026 11:59:37 +0800
Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=E5=AD=A6=E7=94=9F=E7=AB=AF?=
=?UTF-8?q?=E8=AF=BE=E5=A0=82=E6=8A=A5=E5=91=8A&=E4=BD=93=E6=B5=8B?=
=?UTF-8?q?=E6=8A=A5=E5=91=8A=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
WeChatApplet/Services/Impl/PatriarchService.cs | 13 +++++++------
.../Dto/Patriarch/StudentReportDto.cs | 14 +++++++-------
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/WeChatApplet/Services/Impl/PatriarchService.cs b/WeChatApplet/Services/Impl/PatriarchService.cs
index a72dee9..fadfb47 100644
--- a/WeChatApplet/Services/Impl/PatriarchService.cs
+++ b/WeChatApplet/Services/Impl/PatriarchService.cs
@@ -186,7 +186,10 @@ namespace YD_WeChatApplet.Api.Services.Impl
///
public async Task StudentReport(string? studentNo)
{
- var res = new StudentReportDto();
+ var res = new StudentReportDto
+ {
+ CategoryScoreList = new List()
+ };
// 若参数为空,则尝试从登录上下文获取当前用户编号
if (string.IsNullOrWhiteSpace(studentNo))
@@ -272,8 +275,6 @@ namespace YD_WeChatApplet.Api.Services.Impl
ScoreTime = x.ScoreTime
}).ToListAsync();
- res.CategoryScoreList = new List();
-
foreach (var item in categorys)
{
// ✅ 当前学生数据
@@ -327,11 +328,11 @@ namespace YD_WeChatApplet.Api.Services.Impl
res.CategoryScoreList.Add(new CategoryScoreDto()
{
- CategoryValue = item.CategoryValue,
+ CategoryValue = item.Id,
Name = item.CategoryName,
Rank = lastResult?.Rank,
- GradeId = lastResult.GradeId,
+ GradeId = lastResult?.GradeId,
PrevScore = prevResult?.Score ?? 0,
LastScore = lastResult?.Score ?? 0,
@@ -340,7 +341,7 @@ namespace YD_WeChatApplet.Api.Services.Impl
//ClassAvgScore = (float)classAvgScore,
SchoolAvgScore = (float)schoolAvgScore,
- ScoreTrendChart = trendChart,
+ ScoreTrendChart = trendChart ?? new ScoreTrendChartDataDto { AxisX = new List(), AxisY = new List() },
ImgUrl = $"{AppSettings.ALiYunOSS.CategoryImgUrl}{item.CategoryEnum}.png"
});
diff --git a/YD_WeChatApplet.Commons/Dto/Patriarch/StudentReportDto.cs b/YD_WeChatApplet.Commons/Dto/Patriarch/StudentReportDto.cs
index ddbc198..7b1ca56 100644
--- a/YD_WeChatApplet.Commons/Dto/Patriarch/StudentReportDto.cs
+++ b/YD_WeChatApplet.Commons/Dto/Patriarch/StudentReportDto.cs
@@ -14,7 +14,7 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
///
/// 各项目得分
///
- public List CategoryScoreList { get; set; }
+ public List CategoryScoreList { get; set; } = new List();
}
///
@@ -30,7 +30,7 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
///
/// 项目名称
///
- public string Name { get; set; }
+ public string Name { get; set; } = string.Empty;
///
/// 上一次得分
@@ -60,12 +60,12 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
///
/// 图片地址
///
- public string ImgUrl { get; set; }
+ public string ImgUrl { get; set; } = string.Empty;
///
/// 等级
///
- public string Rank { get; set; }
+ public string Rank { get; set; } = string.Empty;
///
///年级Id
@@ -75,7 +75,7 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
///
/// 成绩趋势图
///
- public ScoreTrendChartDataDto ScoreTrendChart { get; set; }
+ public ScoreTrendChartDataDto ScoreTrendChart { get; set; } = new ScoreTrendChartDataDto();
}
public class ScoreTrendChartDataDto
@@ -83,11 +83,11 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
///
/// X轴
///
- public List AxisX { get; set; }
+ public List AxisX { get; set; } = new List();
///
/// Y轴
///
- public List AxisY { get; set; }
+ public List AxisY { get; set; } = new List();
}
}