From 04165aacc7ca067d9165aead47ff86d311ce7d89 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Thu, 2 Apr 2026 13:53:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YD_YiLu/Controllers/DeviceSyncController.cs | 4 ++- YD_YiLu/Services/Impl/DeviceSyncService.cs | 29 ++++++++++----------- YD_YiLu/SmartSportsEntitys/YL_Device.cs | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/YD_YiLu/Controllers/DeviceSyncController.cs b/YD_YiLu/Controllers/DeviceSyncController.cs index c1fb38c..f17ae2d 100644 --- a/YD_YiLu/Controllers/DeviceSyncController.cs +++ b/YD_YiLu/Controllers/DeviceSyncController.cs @@ -39,7 +39,9 @@ namespace YD_YiLu.Api.Controllers dto.PageSize = 10; if (dto.PageIndex < 1) dto.PageIndex = 1; - return await _deviceSyncService.UserPageAsync(dto); + var res = await _deviceSyncService.UserPageAsync(dto); + + return res; } /// diff --git a/YD_YiLu/Services/Impl/DeviceSyncService.cs b/YD_YiLu/Services/Impl/DeviceSyncService.cs index b9cb98e..bd1ebc2 100644 --- a/YD_YiLu/Services/Impl/DeviceSyncService.cs +++ b/YD_YiLu/Services/Impl/DeviceSyncService.cs @@ -22,11 +22,10 @@ namespace YD_YiLu.Api.Services.Impl public async Task GetOrgIdByDeviceAsync(string deviceSerial) { - var device = await _context.YL_Device.FirstOrDefaultAsync(x => - x.AndroidId == deviceSerial || x.SerialNumber == deviceSerial); - if (device?.OrgId != null) return device.OrgId; - var school = await _context.School.FirstOrDefaultAsync(); - return school?.Id; + var device = await _context.YL_Device.FirstOrDefaultAsync(x => x.SerialNumber == deviceSerial); + if (device?.OrgId != null) + return device.OrgId; + else return 0; } public async Task UserPageAsync(DeviceSyncUserPageRequestDto dto) @@ -37,9 +36,9 @@ namespace YD_YiLu.Api.Services.Impl string schoolCode = await _context.School.Where(x => x.Id == orgId).Select(x => x.SchoolCode).FirstAsync(); var query = _context.Student.Where(x => x.SchoolCode == schoolCode); - if (dto.UserType == 1) query = query.Where(x => false); - else if (dto.UserType == 2) { } - else if (dto.UserType == 3) query = query.Where(x => false); + //if (dto.UserType == 1) query = query.Where(x => false); + //else if (dto.UserType == 2) { } + //else if (dto.UserType == 3) query = query.Where(x => false); var total = await query.CountAsync(); var pageIndex = dto.PageIndex < 1 ? 1 : dto.PageIndex; @@ -55,14 +54,14 @@ namespace YD_YiLu.Api.Services.Impl UserType = 2, Username = s.StudentNo, Nickname = s.StudentName, - OrganizationId = s.ClassId ?? 0, - OrganizationName = s.ClassName ?? "", GradeName = "", + OrganizationId = s.Id, + OrganizationName = s.ClassName ?? "", FacePictureUrl = s.Photo ?? "", Identity = "学生", Gender = s.Sex == 1 ? "男" : "女", Birthday = s.Birthday.HasValue ? s.Birthday.Value.ToString("yyyy-MM-dd") : "", - UserSerial = s.StudentNo + UserSerial = s.StudentNo, }) .ToListAsync(); @@ -197,10 +196,10 @@ namespace YD_YiLu.Api.Services.Impl var student = await _context.Student.FindAsync(ts.StudentId); var recentTrains = await (from t in _context.XW_TrainStudents - join td in _context.XW_SportsTestData on t.XW_SportsTestDataId equals td.Id - where t.StudentId == ts.StudentId && td.ProjectId == train.ProjectId - orderby t.CreateTime descending - select new CountListItem { TrainId = td.Id, Score = t.Achievement.ToString(), Time = t.CreateTime ?? "" }) + join td in _context.XW_SportsTestData on t.XW_SportsTestDataId equals td.Id + where t.StudentId == ts.StudentId && td.ProjectId == train.ProjectId + orderby t.CreateTime descending + select new CountListItem { TrainId = td.Id, Score = t.Achievement.ToString(), Time = t.CreateTime ?? "" }) .Take(10) .ToListAsync(); diff --git a/YD_YiLu/SmartSportsEntitys/YL_Device.cs b/YD_YiLu/SmartSportsEntitys/YL_Device.cs index 9066b04..ab02540 100644 --- a/YD_YiLu/SmartSportsEntitys/YL_Device.cs +++ b/YD_YiLu/SmartSportsEntitys/YL_Device.cs @@ -105,6 +105,6 @@ namespace VOL.Entity.DomainModels.XinWei /// 备注 /// [MaxLength(500)] - public string Remark { get; set; } + public string? Remark { get; set; } } }