This commit is contained in:
tanglong 2025-07-28 14:56:35 +08:00
parent 65874b3b86
commit 742664d994
3 changed files with 7 additions and 2 deletions

View File

@ -97,7 +97,7 @@ namespace YD_AllHeartRates.Api.Mqtt
studentList = (from d in _smartSportsContext.Device
join s in _smartSportsContext.Student on d.StudentNo equals s.StudentNo
join c in _smartSportsContext.Class on s.ClassId equals c.Id
where s.StudentStatus == 1
where s.SchoolCode == AppSettings.SchoolCode && s.StudentStatus == 1
select new StudentDto
{
SchoolCode = s.SchoolCode,
@ -114,7 +114,7 @@ namespace YD_AllHeartRates.Api.Mqtt
DeviceType = d.DeviceType,
}).ToList();
devices = _smartSportsContext.Device.ToList();
devices = _smartSportsContext.Device.Where(x => x.SchoolCode == AppSettings.SchoolCode).ToList();
_caching.AddObject(AppSettings.StudentListCacheKey, studentList, 28800);
_caching.AddObject(AppSettings.DeviceListCacheKey, devices, 28800);

View File

@ -16,6 +16,8 @@
public static string StudentListCacheKey = "student_list";
public static string DeviceListCacheKey = "device_list";
public static string SchoolCode { get; set; }
public static void Init(IConfiguration configuration)
{
Logging = configuration.GetSection("Logging").Get<LoggingConfig>();
@ -25,6 +27,7 @@
FlushTime = configuration["FlushTime"];
DbConnectionString = configuration["DbConnectionString"];
SmartSportsString = configuration["SmartSportsString"];
SchoolCode = configuration["SchoolCode"];
RedisConnectionString = configuration["RedisConnectionString"];
CorsUrls = configuration["CorsUrls"].Split(',');
Mqtt = configuration.GetSection("Mqtt").Get<MqttConfig>();

View File

@ -25,6 +25,8 @@
"FlushTime": "2000", //
"SchoolCode": "202507280052",
"AppUrls": {
},