sc
This commit is contained in:
parent
97017bcf87
commit
4af2ed6c7d
@ -89,8 +89,11 @@ namespace YD_AllHeartRates.Api.Mqtt
|
||||
List<StudentDto> studentList;
|
||||
List<S_Device> devices;
|
||||
|
||||
studentList = _caching.Get<List<StudentDto>>(AppSettings.StudentListCacheKey);
|
||||
devices = _caching.Get<List<S_Device>>(AppSettings.DeviceListCacheKey);
|
||||
var studentListCacheKey = $"{AppSettings.StudentListCacheKey}_{AppSettings.SchoolCode}";
|
||||
var deviceListCacheKey = $"{AppSettings.DeviceListCacheKey}_{AppSettings.SchoolCode}";
|
||||
|
||||
studentList = _caching.Get<List<StudentDto>>(studentListCacheKey);
|
||||
devices = _caching.Get<List<S_Device>>(deviceListCacheKey);
|
||||
|
||||
if (studentList == null || devices == null)
|
||||
{
|
||||
@ -114,10 +117,10 @@ namespace YD_AllHeartRates.Api.Mqtt
|
||||
DeviceType = d.DeviceType,
|
||||
}).ToList();
|
||||
|
||||
devices = _smartSportsContext.Device.Where(x => x.SchoolCode == AppSettings.SchoolCode).ToList();
|
||||
devices = _smartSportsContext.Device.Where(x => x.SchoolCode == AppSettings.SchoolCode && !string.IsNullOrWhiteSpace(x.StudentNo)).ToList();
|
||||
|
||||
_caching.AddObject(AppSettings.StudentListCacheKey, studentList, 28800);
|
||||
_caching.AddObject(AppSettings.DeviceListCacheKey, devices, 28800);
|
||||
_caching.AddObject(studentListCacheKey, studentList, 28800);
|
||||
_caching.AddObject(deviceListCacheKey, devices, 28800);
|
||||
}
|
||||
|
||||
var heartRateEntities = new ConcurrentBag<HeartRateData>();
|
||||
|
@ -14,8 +14,9 @@
|
||||
public static string[] CorsUrls { get; set; }
|
||||
public static MqttConfig Mqtt { get; set; }
|
||||
|
||||
public static string StudentListCacheKey = $"student_list_{SchoolCode}";
|
||||
public static string DeviceListCacheKey = $"device_list_{SchoolCode}";
|
||||
public static string StudentListCacheKey = $"student_list";
|
||||
|
||||
public static string DeviceListCacheKey = $"device_list";
|
||||
public static string SchoolCode { get; set; }
|
||||
|
||||
public static void Init(IConfiguration configuration)
|
||||
|
Loading…
x
Reference in New Issue
Block a user