细节调整

This commit is contained in:
yanghongwei 2025-03-26 10:54:22 +08:00
parent 6d9acac89d
commit 61439bf419
2 changed files with 12 additions and 7 deletions

View File

@ -85,17 +85,22 @@ 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))
{
return 1;
}
}
}
return result;
}
/// <summary>

View File

@ -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);
}
}
}