首页数据格式调整
This commit is contained in:
parent
51b79bde5d
commit
bb33e69cd8
|
|
@ -43,5 +43,7 @@
|
|||
public string OrgId { get; set; }
|
||||
public int DeviceType { get; set; }
|
||||
public string VideoUrl { get; set; }
|
||||
public double lng { get; set; }
|
||||
public double lat { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
public class Rate
|
||||
{
|
||||
public string key { get; set; }
|
||||
public string val { get; set; }
|
||||
public double val { get; set; }
|
||||
}
|
||||
public class alarmList
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using langguanApi.Model;
|
|||
using System.Linq.Expressions;
|
||||
using langguanApi.Common.Proxy;
|
||||
using langguanApi.Model.Dto;
|
||||
using Npoi.Mapper;
|
||||
|
||||
namespace langguanApi.Service
|
||||
{
|
||||
|
|
@ -47,7 +48,8 @@ namespace langguanApi.Service
|
|||
/// <returns></returns>
|
||||
public async Task<ApiResult> View()
|
||||
{
|
||||
var devices = await _deviceService.GetAsync();
|
||||
Expression<Func<Device, bool>> exp = x => x.IsDelete == false && x.lng > 0 && x.lat > 0;
|
||||
var devices = (await _deviceService.GetListWithExp(exp)).ToList();
|
||||
var cleanData = new
|
||||
{
|
||||
Yesterday = 0.8,
|
||||
|
|
@ -61,7 +63,7 @@ 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*24*30);
|
||||
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 * 60 * 24 * 30);
|
||||
|
|
@ -70,6 +72,7 @@ namespace langguanApi.Service
|
|||
// 获取远程接口污染物排放率
|
||||
var rateResp = await _httpProxy.Get<RespModel<List<Rate>>>(null, _configuration.GetValue<string>("Apis:RateUrl"));
|
||||
var rate = rateResp.data.ToList().Take(6);
|
||||
rate.ForEach(x => x.val = Math.Round( x.val / 100,2));
|
||||
var AlermResp = await _httpProxy.Get<RespModel<alarmList>>(null, _configuration.GetValue<string>("Apis:AlertUrl"));
|
||||
if (AlermResp.code == 0 && AlermResp.data.List.Any())
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue