This commit is contained in:
tanglong 2025-07-28 15:29:18 +08:00
parent b11ae8d679
commit e4b9113836

View File

@ -174,7 +174,8 @@ namespace YD_AllHeartRates.Api.Services.Impl
await _sportsContext.AddAsync(entity);
var res = await _sportsContext.SaveChangesAsync() > 0;
_caching.Remove(AppSettings.DeviceListCacheKey);
_caching.Remove($"{AppSettings.StudentListCacheKey}_{schoolCode}");
_caching.Remove($"{AppSettings.DeviceListCacheKey}_{schoolCode}");
return res;
}
@ -206,7 +207,8 @@ namespace YD_AllHeartRates.Api.Services.Impl
_sportsContext.Update(device);
var res = await _sportsContext.SaveChangesAsync() > 0;
_caching.Remove(AppSettings.DeviceListCacheKey);
_caching.Remove($"{AppSettings.StudentListCacheKey}_{schoolCode}");
_caching.Remove($"{AppSettings.DeviceListCacheKey}_{schoolCode}");
return res;
}
@ -225,7 +227,8 @@ namespace YD_AllHeartRates.Api.Services.Impl
_sportsContext.Device.Remove(device);
var res = await _sportsContext.SaveChangesAsync() > 0;
_caching.Remove(AppSettings.DeviceListCacheKey);
_caching.Remove($"{AppSettings.StudentListCacheKey}_{schoolCode}");
_caching.Remove($"{AppSettings.DeviceListCacheKey}_{schoolCode}");
return res;
}
@ -278,8 +281,13 @@ namespace YD_AllHeartRates.Api.Services.Impl
Name = data.DeviceType == 1 ? "心率设备" : "跳绳设备"
});
}
await _sportsContext.AddRangeAsync(deviceList);
return await _sportsContext.SaveChangesAsync() > 0;
var res = await _sportsContext.SaveChangesAsync() > 0;
_caching.Remove($"{AppSettings.StudentListCacheKey}_{schoolCode}");
_caching.Remove($"{AppSettings.DeviceListCacheKey}_{schoolCode}");
return res;
}
}
}