测试新的解析IP的库
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
bf5f56f5f2
commit
9bcaa07c1a
|
@ -113,6 +113,12 @@
|
|||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Resources\GeoLite2-City.mmdb">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties properties_4launchsettings_1json__JsonSchema="" />
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 73 MiB |
|
@ -50,6 +50,7 @@
|
|||
<PackageReference Include="IP2Region.Net" Version="2.0.2" />
|
||||
<PackageReference Include="MailKit" Version="4.7.1.1" />
|
||||
<PackageReference Include="Masa.Contrib.Service.MinimalAPIs" Version="1.0.0" />
|
||||
<PackageReference Include="MaxMind.GeoIP2" Version="5.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
|
||||
<PackageReference Include="MimeKit" Version="4.7.1" />
|
||||
<PackageReference Include="MiniExcel" Version="1.34.2" />
|
||||
|
|
|
@ -16,6 +16,7 @@ using IRaCIS.Core.Infrastructure.Encryption;
|
|||
using IRaCIS.Core.Infrastructure.NewtonsoftJson;
|
||||
using MassTransit;
|
||||
using MassTransit.Mediator;
|
||||
using MaxMind.GeoIP2;
|
||||
using Medallion.Threading;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
|
@ -95,6 +96,46 @@ namespace IRaCIS.Core.Application.Service
|
|||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> NewIP([FromServices] IRepository<UserLog> _userLogRepository)
|
||||
{
|
||||
var path = Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, "GeoLite2-City.mmdb");
|
||||
|
||||
|
||||
var ipList = _userLogRepository.Select(t => t.IP).Distinct().ToList();
|
||||
|
||||
foreach (var ip in ipList)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var reader = new DatabaseReader(path))
|
||||
{
|
||||
|
||||
var city = reader.City(ip);
|
||||
|
||||
Console.WriteLine(city.Country.IsoCode); // 'US' 'CN'
|
||||
Console.WriteLine(city.Country.Name); // 'United States' 'China'
|
||||
//Console.WriteLine(city.Country.Names["zh-CN"]); // '美国'
|
||||
Console.WriteLine(city.MostSpecificSubdivision.Name); // 'Minnesota' 'Hubei'
|
||||
Console.WriteLine(city.City.Name); // 'Minneapolis' 'WUHan'
|
||||
|
||||
|
||||
Console.WriteLine("----------------");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Console.WriteLine($"{ip}在数据库无法解析 {ex.Message}"); // 44.9733
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IQC 回退到影像上传
|
||||
|
@ -182,11 +223,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> BackImageResize(Guid trialSiteId ,Guid subjectId/* , [FromServices] IRepository<>*/)
|
||||
public async Task<IResponseOutput> BackImageResize(Guid trialSiteId, Guid subjectId/* , [FromServices] IRepository<>*/)
|
||||
{
|
||||
///${params.trialId}/ Image /${params.subjectId}/${params.subjectVisitId}/${ dicomInfo.studyUid}/${ v.seriesUid}.jpg
|
||||
|
||||
var dealSeriesList = await _dicomSeriesRepository.Where(t => t.DicomStudy.Subject.TrialSiteId == trialSiteId && t.SubjectId== subjectId).Select(t => new { t.Id, t.SubjectId, t.TrialId, t.SubjectVisitId, t.StudyInstanceUid, t.SeriesInstanceUid, t.ImageResizePath, t.UpdateUserId, FirstInstancePath = t.DicomInstanceList.First().Path }).ToListAsync();
|
||||
var dealSeriesList = await _dicomSeriesRepository.Where(t => t.DicomStudy.Subject.TrialSiteId == trialSiteId && t.SubjectId == subjectId).Select(t => new { t.Id, t.SubjectId, t.TrialId, t.SubjectVisitId, t.StudyInstanceUid, t.SeriesInstanceUid, t.ImageResizePath, t.UpdateUserId, FirstInstancePath = t.DicomInstanceList.First().Path }).ToListAsync();
|
||||
|
||||
//下载到本地
|
||||
string tempFolderPath = Path.Combine(Directory.GetCurrentDirectory(), $"DownloadTemp_{NewId.NextGuid()}");
|
||||
|
@ -218,7 +259,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
// 保存缩略图为 JPEG
|
||||
image.Save(resizePath, new JpegEncoder());
|
||||
}
|
||||
|
||||
|
||||
var ossFolder = $"{dealSeries.TrialId}/Image/{dealSeries.SubjectId}/{dealSeries.SubjectVisitId}/{dealSeries.StudyInstanceUid}";
|
||||
|
||||
var relativePath = await _IOSSService.UploadToOSSAsync(resizePath, ossFolder, false);
|
||||
|
|
Loading…
Reference in New Issue