This commit is contained in:
tanglong 2026-04-24 16:29:21 +08:00
parent 2278bfc8a7
commit 975088da26
3 changed files with 10 additions and 5 deletions

View File

@ -63,7 +63,7 @@ namespace YD_WeChatApplet.Api.Controllers
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("StudentReport")] [HttpGet("StudentReport")]
public async Task<StudentReportDto> StudentReport(string studentNo) public async Task<StudentReportDto> StudentReport(string? studentNo)
{ {
var res = await _patriarchService.StudentReport(studentNo); var res = await _patriarchService.StudentReport(studentNo);
return res; return res;

View File

@ -184,15 +184,20 @@ namespace YD_WeChatApplet.Api.Services.Impl
/// 学生报告 /// 学生报告
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public async Task<StudentReportDto> StudentReport(string studentNo) public async Task<StudentReportDto> StudentReport(string? studentNo)
{ {
var res = new StudentReportDto(); var res = new StudentReportDto();
// 若参数为空,则尝试从登录上下文获取当前用户编号
if (string.IsNullOrWhiteSpace(studentNo))
{
studentNo = UserLoginContext.Current.UserNo;
}
// 最终编号仍为空,则直接返回空结果
if (string.IsNullOrWhiteSpace(studentNo)) if (string.IsNullOrWhiteSpace(studentNo))
return res; return res;
//var studentNo = UserLoginContext.Current.UserNo;
var student = await _sportsContext.Student.Where(x => x.StudentNo == studentNo).FirstOrDefaultAsync(); var student = await _sportsContext.Student.Where(x => x.StudentNo == studentNo).FirstOrDefaultAsync();
if (student == null) if (student == null)

View File

@ -42,7 +42,7 @@ namespace YD_WeChatApplet.Services
/// 学生报告 /// 学生报告
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task<StudentReportDto> StudentReport(string studentNo); Task<StudentReportDto> StudentReport(string? studentNo);
/// <summary> /// <summary>
/// 训练记录 /// 训练记录