服务器配置太低,首页数据缓存一个月
This commit is contained in:
parent
e3c18ba952
commit
51b79bde5d
|
|
@ -2244,7 +2244,7 @@
|
|||
</member>
|
||||
<member name="T:langguanApi.Model.GetWasherDto">
|
||||
<summary>
|
||||
添加洗车机
|
||||
获取洗车机
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:langguanApi.Model.GetWasherDto.Name">
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ namespace langguanApi.Service
|
|||
// Expression<Func<Model.HJ212, bool>> exp = filter => filter.CreateDateTime >= DateTime.Now.AddDays(-7);
|
||||
|
||||
var filter = Builders<Model.HJ212>.Filter.In(s => s.deviceMN, vocList.Concat(cemsList))
|
||||
& Builders<Model.HJ212>.Filter.Gte(s => s.CreateDateTime, DateTime.Now.AddDays(-7));
|
||||
& Builders<Model.HJ212>.Filter.Gte(s => s.CreateDateTime, DateTime.Now.AddDays(-3));
|
||||
var result = await base.FindListyFilter(filter);
|
||||
var voc = result.Where(s => vocList.Contains(s.deviceMN)).Select(s => new
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,12 +61,12 @@ namespace langguanApi.Service
|
|||
var detections = await _detectionService.GetIndexData();
|
||||
// 获取天气信息,缓存1小时,如果不存在,则调用WeatherService获取
|
||||
Func<Task<object>> getWeatherFunc = async () => await _weatherService.GetWeather();
|
||||
var weather = await _cacheManager.GetConvertVale(RedisKeylist.Weather, getWeatherFunc, 60 * 60);
|
||||
var weather = await _cacheManager.GetConvertVale(RedisKeylist.Weather, getWeatherFunc, 60 * 60*24*30);
|
||||
// 获取空气质量,缓存2小时,如果不存在,则调用WeatherService获取
|
||||
Func<Task<object>> getAriQualityFunc = async () => await _weatherService.GetAirQuality();
|
||||
var ariQuality = await _cacheManager.GetConvertVale(RedisKeylist.AriQuality, getAriQualityFunc, 60 * 120);
|
||||
var ariQuality = await _cacheManager.GetConvertVale(RedisKeylist.AriQuality, getAriQualityFunc, 60 * 60 * 24 * 30);
|
||||
Func<Task<object>> getTrendFunc = async () => await _hj212Service.GetIndexData();
|
||||
var trend = await _cacheManager.GetConvertVale(RedisKeylist.Trend, getTrendFunc, 60 * new Random().Next(70));
|
||||
var trend = await _cacheManager.GetConvertVale(RedisKeylist.Trend, getTrendFunc, 60 * 60 * 24 * 30);
|
||||
// 获取远程接口污染物排放率
|
||||
var rateResp = await _httpProxy.Get<RespModel<List<Rate>>>(null, _configuration.GetValue<string>("Apis:RateUrl"));
|
||||
var rate = rateResp.data.ToList().Take(6);
|
||||
|
|
@ -85,7 +85,7 @@ namespace langguanApi.Service
|
|||
lastWeek = 0.6
|
||||
};
|
||||
Func<Task<object>> getTodayFunc = async () => await _hj212Service.GetTodayData();
|
||||
var today = await _cacheManager.GetConvertVale(RedisKeylist.Today, getTodayFunc, 60 * 30);
|
||||
var today = await _cacheManager.GetConvertVale(RedisKeylist.Today, getTodayFunc, 60 * 60 * 24 * 30);
|
||||
return new ApiResult
|
||||
{
|
||||
code = 0,
|
||||
|
|
|
|||
Loading…
Reference in New Issue