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

View File

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

View File

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