白名单调整
This commit is contained in:
parent
6c31a6a72d
commit
8bd8f38962
|
|
@ -137,37 +137,18 @@ namespace LY.App.Service
|
|||
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 new Tuple<bool, long>(false, 0);
|
||||
else
|
||||
if (await _redisService.ExistsAsync(key))
|
||||
{
|
||||
var entity = await _redisService.GetAsync<Whitelist>(key);
|
||||
//判断 是否在防区内
|
||||
if (entity.positionId.Any())
|
||||
//判断时间是否在区在
|
||||
if (entity.allDay)
|
||||
{
|
||||
foreach (var item in entity.positionId)
|
||||
{
|
||||
var region = await _redisService.GetAsync<PositionInfo>(RedisKeyList.PositioinRegion(item));
|
||||
if (region != null)
|
||||
{
|
||||
region.SetRegionJson();
|
||||
if (IsPointInGeoJson(lat, lon, region.RegionJson))
|
||||
{
|
||||
//判断时间是否在区在
|
||||
if (entity.allDay)
|
||||
{
|
||||
return new Tuple<bool, long>(true, entity.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
var has = entity.startTime <= DateTime.Now && DateTime.Now <= entity.endTime;
|
||||
return new Tuple<bool, long>(has, has ? entity.Id : 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Tuple<bool, long>(true, entity.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
var has = entity.startTime <= DateTime.Now && DateTime.Now <= entity.endTime;
|
||||
return new Tuple<bool, long>(has, has ? entity.Id : 0);
|
||||
}
|
||||
}
|
||||
return new Tuple<bool, long>(false, 0); ;
|
||||
|
|
@ -393,7 +374,7 @@ namespace LY.App.Service
|
|||
positionId = SqlFunc.AggregateMax(st.positionId),
|
||||
}).MergeTable()//合并查询
|
||||
.ToPageListAsync(input.pageNum, input.pageSize, total);
|
||||
var ids= items.Select(s => s.positionId).Distinct().ToList();
|
||||
var ids = items.Select(s => s.positionId).Distinct().ToList();
|
||||
var positionNames = await _db.Queryable<PositionInfo>()
|
||||
.Where(s => ids.Contains(s.Id))
|
||||
.Select(s => new { s.Id, s.Name })
|
||||
|
|
|
|||
Loading…
Reference in New Issue