websocket返回白名单id
This commit is contained in:
parent
4762ea002b
commit
c4aff6eac0
|
|
@ -51,6 +51,12 @@ namespace LY.App.Model
|
|||
[SugarColumn(ColumnName = "is_whitelist", ColumnDescription = "是否白名单")]
|
||||
public bool IsWhitelist { get; set; }
|
||||
/// <summary>
|
||||
/// 白名单id
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public long WhiteListId { get; set; }
|
||||
/// <summary>
|
||||
/// ,#东向速度
|
||||
/// </summary>
|
||||
public double speed_E { get; set; }
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Mapster;
|
|||
using NetTopologySuite.Geometries;
|
||||
using NetTopologySuite.IO;
|
||||
using SqlSugar;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LY.App.Service
|
||||
{
|
||||
|
|
@ -67,7 +68,9 @@ namespace LY.App.Service
|
|||
item.PostionName = deviceinfo.PositionName;
|
||||
item.Time = input.time;
|
||||
item.distance = GisHelper.HaversineDistance(item.drone_lat, item.drone_lon, item.app_lat, item.app_lon);
|
||||
item.IsWhitelist = await Iswhitlist(item.serial_number, item.drone_lat, item.drone_lon);
|
||||
var temp = await Iswhitlist(item.serial_number, item.drone_lat, item.drone_lon);
|
||||
item.IsWhitelist = temp.Item1;
|
||||
item.WhiteListId = temp.Item2;
|
||||
item.alarmLevel = item.IsWhitelist == true ? 0 : await GetAlarmLevel(deviceinfo.PositionId, item.drone_lon, item.drone_lat);
|
||||
item.centerdistance = await GetCenterDistance(item.drone_lat, item.drone_lon, item.positionId);
|
||||
}
|
||||
|
|
@ -131,11 +134,11 @@ namespace LY.App.Service
|
|||
/// <param name="lat"></param>
|
||||
/// <param name="lon"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> Iswhitlist(string serial_number, double lat, double lon)
|
||||
private async Task<Tuple<bool, long>> Iswhitlist(string serial_number, double lat, double lon)
|
||||
{
|
||||
string key = RedisKeyList.white_list(serial_number);
|
||||
if (!await _redisService.ExistsAsync(key))
|
||||
return false;
|
||||
return new Tuple<bool, long>(false, 0);
|
||||
else
|
||||
{
|
||||
var entity = await _redisService.GetAsync<Whitelist>(key);
|
||||
|
|
@ -153,19 +156,21 @@ namespace LY.App.Service
|
|||
//判断时间是否在区在
|
||||
if (entity.allDay)
|
||||
{
|
||||
return true;
|
||||
return new Tuple<bool, long>(false, entity.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
return entity.startTime <= DateTime.Now && DateTime.Now <= entity.endTime;
|
||||
var has = entity.startTime <= DateTime.Now && DateTime.Now <= entity.endTime;
|
||||
return new Tuple<bool, long>(has, has ? entity.Id : 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return new Tuple<bool, long>(false, 0); ;
|
||||
}
|
||||
|
||||
static bool IsPointInGeoJson(double latitude, double longitude, string geoJson)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
"log2db": true, //是否记录
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "server=114.66.57.139;port=13306;database=lyapp;user=root;password=dklymysql;Pooling=true;"
|
||||
"DefaultConnection": "server=114.66.57.139;port=23306;database=lyapp;user=root;password=dklymysql;Pooling=true;"
|
||||
},
|
||||
"Token": {
|
||||
"SecretKey": "HWLSNPM+OhlFe4wwEV/teSWsxGjrWbxKnHonxW5Z+mFlQq3zonv5",
|
||||
|
|
|
|||
Loading…
Reference in New Issue