细节调整
This commit is contained in:
parent
6d9acac89d
commit
61439bf419
|
|
@ -85,15 +85,20 @@ namespace LY.App.Service
|
|||
{
|
||||
var key = RedisKeyList.PositioinRegion(positionId);
|
||||
var geodata = await _redisService.GetAsync<string>(key);
|
||||
if (geodata == null)
|
||||
{
|
||||
geodata = await _db.CopyNew().Queryable<PositionInfo>()
|
||||
.Where(s => s.Id == positionId)
|
||||
.Select(s => s.Region)
|
||||
.FirstAsync();
|
||||
await _redisService.SetAsync<string>(key, geodata);
|
||||
}
|
||||
WKTReader reader = new WKTReader();
|
||||
Geometry point = reader.Read($"POINT ({lon} {lat})");
|
||||
if (!string.IsNullOrEmpty(geodata))
|
||||
Geometry multipolygon = reader.Read(geodata);
|
||||
if (multipolygon.Contains(point))
|
||||
{
|
||||
Geometry multipolygon = reader.Read(geodata);
|
||||
if (multipolygon.Contains(point))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ namespace LY.App.Service
|
|||
foreach (var item in position)
|
||||
{
|
||||
var key = RedisKeyList.PositioinRegion(item.Id);
|
||||
await _redisService.SetAsync(key, item.Region, TimeSpan.FromDays(100));
|
||||
await _redisService.SetAsync(key, item.Region);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue