From d3e9523a587abdbd6fc0b37e0b74bda1b2b6a230 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Tue, 28 Apr 2026 10:36:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B4=E7=BA=A7id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeChatApplet/Program.cs | 2 +- .../Services/Impl/PatriarchService.cs | 73 ++++++++++++++----- 2 files changed, 54 insertions(+), 21 deletions(-) diff --git a/WeChatApplet/Program.cs b/WeChatApplet/Program.cs index a1a346a..fbe375c 100644 --- a/WeChatApplet/Program.cs +++ b/WeChatApplet/Program.cs @@ -19,7 +19,7 @@ namespace YD_WeChatApplet { serverOptions.Limits.MaxRequestBodySize = 10485760; }); - webBuilder.UseKestrel().UseUrls("http://*:9993"); + webBuilder.UseKestrel().UseUrls("http://*:9995"); webBuilder.UseIIS(); webBuilder.UseStartup(); }).UseServiceProviderFactory(new AutofacServiceProviderFactory()); diff --git a/WeChatApplet/Services/Impl/PatriarchService.cs b/WeChatApplet/Services/Impl/PatriarchService.cs index 4eeecbb..926db11 100644 --- a/WeChatApplet/Services/Impl/PatriarchService.cs +++ b/WeChatApplet/Services/Impl/PatriarchService.cs @@ -203,34 +203,67 @@ namespace YD_WeChatApplet.Api.Services.Impl if (student == null) return res; - var grade = await _sportsContext.SportsTestValue.Where(x => x.IsDisplay && x.SchoolCode == student.SchoolCode && x.StudentNo == studentNo).Select(x => new - { - x.ScoreTime, - x.GradeId + var classInfo = await _sportsContext.Class.FirstOrDefaultAsync(x => x.Id == student.ClassId); - }).OrderByDescending(x => x.ScoreTime).FirstOrDefaultAsync(); - - if (grade == null) + if (classInfo == null) return res; - var categorys = await ( - from g in _sportsContext.GradeAssocCategory - join s in _sportsContext.SportsTestCategory on g.CategoryValue equals s.CategoryValue - - where g.GradeId == grade.GradeId - - select new + var categorys = new List + { + new { - s.Id, - s.CategoryEnum, - s.CategoryValue, - s.CategoryName, - g.Weight - }).ToListAsync(); + Id = 1, + CategoryValue = 1, + CategoryName = "BMI", + CategoryEnum = "BMI", + Weight = 0.15f + }, + new + { + Id = 2, + CategoryValue = 2, + CategoryName = "肺活量", + CategoryEnum = "VitalCapacity", + Weight = 0.2f + }, + new + { + Id = 4, + CategoryValue = 4, + CategoryName = "坐位体前屈", + CategoryEnum = "Sit_And_Reach", + Weight = 0.15f + }, + new + { + Id = 5, + CategoryValue = 5, + CategoryName = "一分钟跳绳", + CategoryEnum = "OneMinuteJumpRope", + Weight = 0.2f + }, + new + { + Id = 6, + CategoryValue = 6, + CategoryName = "一分钟仰卧起坐", + CategoryEnum = "One_Minute_Sit_Up", + Weight = 0.15f + }, + new + { + Id = 8, + CategoryValue = 6, + CategoryName = "立定跳远", + CategoryEnum = "StandingLongJump", + Weight = 0.15f + } + }; var sportsTestResults = await _sportsContext.SportsTestValue.Where(x => x.IsDisplay && x.SchoolCode == student.SchoolCode).Select(x => new SportsTestValueModel() { StudentNo = x.StudentNo, + GradeId = x.GradeId, Value = x.Value, Score = x.Score, Rank = x.Rank,