tiaosheng

This commit is contained in:
tanglong 2025-07-25 14:18:27 +08:00
parent d050410b4b
commit c56f8c1554
8 changed files with 15 additions and 10 deletions

View File

@ -212,7 +212,16 @@ namespace YD_AllHeartRates.Api.Mqtt
var totalData = _caching.Get<JumpRopeData>(jumpKey) ?? new JumpRopeData var totalData = _caching.Get<JumpRopeData>(jumpKey) ?? new JumpRopeData
{ {
Id = jumpData.Id,
StudentNo = jumpData.StudentNo, StudentNo = jumpData.StudentNo,
ClassId = jumpData.ClassId,
ClassName = jumpData.ClassName,
Code = jumpData.Code,
GradeId = jumpData.GradeId,
GradeName = jumpData.GradeName,
SchoolCode = jumpData.SchoolCode,
Sex = jumpData.Sex,
StudentName = jumpData.StudentName,
JumpValue = 0, JumpValue = 0,
ErrorNumber = 0, ErrorNumber = 0,
QuantityOfElectricity = jumpData.QuantityOfElectricity, QuantityOfElectricity = jumpData.QuantityOfElectricity,
@ -362,23 +371,19 @@ namespace YD_AllHeartRates.Api.Mqtt
{ {
try try
{ {
if ((DateTime.Now - _lastJumpRopeSaveTime).TotalSeconds < 600) if ((DateTime.Now - _lastJumpRopeSaveTime).TotalSeconds < 60)
return; return;
var today = DateTime.Today; var today = DateTime.Today;
var dateStr = today.ToString("yyyyMMdd"); var dateStr = today.ToString("yyyyMMdd");
var studentNos = RedisHelper.SMembers($"jumpRope:active:{dateStr}"); var keys = RedisHelper.Keys($"jumpRope:active:*:{dateStr}");
if (studentNos == null || studentNos.Length == 0)
return;
using var scope = _scopeFactory.CreateScope(); using var scope = _scopeFactory.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService<UserContext>(); var dbContext = scope.ServiceProvider.GetRequiredService<UserContext>();
foreach (var studentNo in studentNos) foreach (var key in keys)
{ {
var cacheKey = $"jumpRope:active:{studentNo}:{dateStr}"; var data = _caching.Get<JumpRopeData>(key);
var data = _caching.Get<JumpRopeData>(cacheKey);
if (data == null || string.IsNullOrWhiteSpace(data.StudentNo)) continue; if (data == null || string.IsNullOrWhiteSpace(data.StudentNo)) continue;

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("YD_AllHeartRates.Api")] [assembly: System.Reflection.AssemblyCompanyAttribute("YD_AllHeartRates.Api")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+83b0a0b2711f789f4185bdfb416752add0ad7fed")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d050410b4b408994ca1c9d7c01c1c3c65a0c35f8")]
[assembly: System.Reflection.AssemblyProductAttribute("YD_AllHeartRates.Api")] [assembly: System.Reflection.AssemblyProductAttribute("YD_AllHeartRates.Api")]
[assembly: System.Reflection.AssemblyTitleAttribute("YD_AllHeartRates.Api")] [assembly: System.Reflection.AssemblyTitleAttribute("YD_AllHeartRates.Api")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
3300c3316a91487d4a3e54535ac38625dbd521ded9b0ad8d5c828df0da4f398e fd5d16723371e9533b9278925799289d0ca07c958290a8d765748dccd151aa1e