From 975088da26d39a1d41462ac739057c8e4023f267 Mon Sep 17 00:00:00 2001
From: tanglong <842690096@qq.com>
Date: Fri, 24 Apr 2026 16:29:21 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
WeChatApplet/Controllers/PatriarchController.cs | 2 +-
WeChatApplet/Services/Impl/PatriarchService.cs | 11 ++++++++---
WeChatApplet/Services/Interface/IPatriarchService.cs | 2 +-
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/WeChatApplet/Controllers/PatriarchController.cs b/WeChatApplet/Controllers/PatriarchController.cs
index 42cb810..c460f45 100644
--- a/WeChatApplet/Controllers/PatriarchController.cs
+++ b/WeChatApplet/Controllers/PatriarchController.cs
@@ -63,7 +63,7 @@ namespace YD_WeChatApplet.Api.Controllers
///
///
[HttpGet("StudentReport")]
- public async Task StudentReport(string studentNo)
+ public async Task StudentReport(string? studentNo)
{
var res = await _patriarchService.StudentReport(studentNo);
return res;
diff --git a/WeChatApplet/Services/Impl/PatriarchService.cs b/WeChatApplet/Services/Impl/PatriarchService.cs
index 888fef4..4792471 100644
--- a/WeChatApplet/Services/Impl/PatriarchService.cs
+++ b/WeChatApplet/Services/Impl/PatriarchService.cs
@@ -184,15 +184,20 @@ namespace YD_WeChatApplet.Api.Services.Impl
/// 学生报告
///
///
- public async Task StudentReport(string studentNo)
+ public async Task StudentReport(string? studentNo)
{
var res = new StudentReportDto();
+ // 若参数为空,则尝试从登录上下文获取当前用户编号
+ if (string.IsNullOrWhiteSpace(studentNo))
+ {
+ studentNo = UserLoginContext.Current.UserNo;
+ }
+
+ // 最终编号仍为空,则直接返回空结果
if (string.IsNullOrWhiteSpace(studentNo))
return res;
- //var studentNo = UserLoginContext.Current.UserNo;
-
var student = await _sportsContext.Student.Where(x => x.StudentNo == studentNo).FirstOrDefaultAsync();
if (student == null)
diff --git a/WeChatApplet/Services/Interface/IPatriarchService.cs b/WeChatApplet/Services/Interface/IPatriarchService.cs
index 5013d90..37bdc49 100644
--- a/WeChatApplet/Services/Interface/IPatriarchService.cs
+++ b/WeChatApplet/Services/Interface/IPatriarchService.cs
@@ -42,7 +42,7 @@ namespace YD_WeChatApplet.Services
/// 学生报告
///
///
- Task StudentReport(string studentNo);
+ Task StudentReport(string? studentNo);
///
/// 训练记录