diff --git a/Dlhis.Jinko.Face.sln b/Dlhis.Jinko.Face.sln
index f8c00af7..d1d15d0f 100644
--- a/Dlhis.Jinko.Face.sln
+++ b/Dlhis.Jinko.Face.sln
@@ -47,6 +47,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Message", "Message", "{65E7
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Message", "Src\Dlhis.Message\Dlhis.Message.csproj", "{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dlhis.InfoCheck", "Src\Dlhis.InfoCheck\Dlhis.InfoCheck.csproj", "{4D656761-8CE7-4316-A3DF-8C1722D69CCE}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -117,6 +119,10 @@ Global
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4D656761-8CE7-4316-A3DF-8C1722D69CCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4D656761-8CE7-4316-A3DF-8C1722D69CCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4D656761-8CE7-4316-A3DF-8C1722D69CCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4D656761-8CE7-4316-A3DF-8C1722D69CCE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -136,6 +142,7 @@ Global
{D4043506-7247-4DDC-9751-927403515669} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
{69E8A91A-5D05-4327-BC24-038523C7628C} = {489252FB-A44B-46EE-B065-21CDCB724441}
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5} = {65E76F97-E78A-4C95-B788-4091236B1A79}
+ {4D656761-8CE7-4316-A3DF-8C1722D69CCE} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7439494A-E2FD-4FEA-8ABF-74AE57A4A5A0}
diff --git a/Src/Dlhis.InfoCheck/Controllers/FaceController.cs b/Src/Dlhis.InfoCheck/Controllers/FaceController.cs
new file mode 100644
index 00000000..030057cd
--- /dev/null
+++ b/Src/Dlhis.InfoCheck/Controllers/FaceController.cs
@@ -0,0 +1,104 @@
+using Microsoft.AspNetCore.Mvc;
+using SkiaSharp;
+using ViewFaceCore.Core;
+using ViewFaceCore.Model;
+using ViewFaceCore.Exceptions;
+using ViewFaceCore;
+using ViewFaceCore.Configs;
+using Microsoft.AspNetCore.Authorization;
+using Dlhis.InfoCheck.Request;
+using Dlhis.InfoCheck.Response;
+
+namespace Dlhis.InfoCheck.Controllers;
+
+///
+/// 人脸检测
+///
+[Authorize]
+[ApiController]
+[Route("[controller]")]
+public class FaceController : ControllerBase
+{
+ ///
+ /// 人脸质量检测
+ ///
+ ///
+ ///
+ [HttpPost("detection")]
+ public object FacialDetection(FaceDetectRequest request)
+ {
+ var base64Bytes = Convert.FromBase64String(request.Base64);
+ using var stream = new MemoryStream(base64Bytes);
+ using var bitmap = SKBitmap.Decode(stream);
+ using var faceDetector = new FaceDetector();
+
+ using var faceMark = new FaceLandmarker(new FaceLandmarkConfig
+ {
+ MarkType = MarkType.Light
+ });
+
+ //todo 多人情况
+ var info = faceDetector.Detect(bitmap).First();
+ var markPoints = faceMark.Mark(bitmap, info);
+
+ using var faceQuality = new FaceQuality();
+ var brightnessResult = faceQuality.Detect(bitmap, info, markPoints, QualityType.Brightness);
+ var resolutionResult = faceQuality.Detect(bitmap, info, markPoints, QualityType.Resolution);
+ //var clarityResult = faceQuality.Detect(bitmap, info, markPoints, QualityType.Clarity);
+ var clarityExResult = faceQuality.Detect(bitmap, info, markPoints, QualityType.ClarityEx);
+ var integrityExResult = faceQuality.Detect(bitmap, info, markPoints, QualityType.Integrity);
+ var structureeResult = faceQuality.Detect(bitmap, info, markPoints, QualityType.Structure);
+ //var poseResult = faceQuality.Detect(bitmap, info, markPoints, QualityType.Pose);
+ var poseExeResult = faceQuality.Detect(bitmap, info, markPoints, QualityType.PoseEx);
+
+ return new
+ {
+ Brightness = brightnessResult,
+ Resolution = resolutionResult,
+ Clarity = clarityExResult,
+ Integrity = integrityExResult,
+ Structure = structureeResult,
+ Pose = poseExeResult
+ };
+ }
+
+
+ ///
+ /// 人脸对比
+ ///
+ ///
+ ///
+ [HttpPost("recognize")]
+ public FaceRecognizeResponse FacialRecognize(FaceRecognizeRequest request)
+ {
+ var firstBase64Bytes = Convert.FromBase64String(request.FirstBase64);
+ using var firstStream = new MemoryStream(firstBase64Bytes);
+ using var firstBitmap = SKBitmap.Decode(firstStream);
+
+ var secondBase64Bytes = Convert.FromBase64String(request.SecondBase64);
+ using var secondStream = new MemoryStream(secondBase64Bytes);
+ using var secondBitmap = SKBitmap.Decode(secondStream);
+
+ using var recognizer = new FaceRecognizer(new FaceRecognizeConfig
+ {
+ //对应阈值 FaceType.Normal:0.62、FaceType.Mask:0.4、FaceType.Light:0.55
+ FaceType = FaceType.Normal
+ });
+
+ using var faceDetector = new FaceDetector();
+ using var faceMark = new FaceLandmarker();
+
+ //todo
+ var lft = recognizer.Extract(firstBitmap, faceMark.Mark(firstBitmap, faceDetector.Detect(firstBitmap).First()));
+ var rft = recognizer.Extract(secondBitmap, faceMark.Mark(secondBitmap, faceDetector.Detect(secondBitmap).First()));
+
+ var similarity = recognizer.Compare(lft, rft);
+ var isSelf = recognizer.IsSelf(similarity);
+
+ return new FaceRecognizeResponse
+ {
+ Similarity = similarity,
+ IsSelf = isSelf
+ };
+ }
+}
diff --git a/Src/Dlhis.InfoCheck/Dlhis.InfoCheck.csproj b/Src/Dlhis.InfoCheck/Dlhis.InfoCheck.csproj
new file mode 100644
index 00000000..cad3976a
--- /dev/null
+++ b/Src/Dlhis.InfoCheck/Dlhis.InfoCheck.csproj
@@ -0,0 +1,23 @@
+
+
+
+ net6.0
+ disable
+ enable
+ True
+ Linux
+ ..\..
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Src/Dlhis.InfoCheck/Dockerfile b/Src/Dlhis.InfoCheck/Dockerfile
new file mode 100644
index 00000000..c9f9f586
--- /dev/null
+++ b/Src/Dlhis.InfoCheck/Dockerfile
@@ -0,0 +1,23 @@
+#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
+
+FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
+WORKDIR /app
+EXPOSE 80
+
+FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
+ARG BUILD_CONFIGURATION=Release
+WORKDIR /src
+COPY ["Src/Dlhis.InfoCheck/Dlhis.InfoCheck.csproj", "Src/Dlhis.InfoCheck/"]
+RUN dotnet restore "./Src/Dlhis.InfoCheck/./Dlhis.InfoCheck.csproj"
+COPY . .
+WORKDIR "/src/Src/Dlhis.InfoCheck"
+RUN dotnet build "./Dlhis.InfoCheck.csproj" -c $BUILD_CONFIGURATION -o /app/build
+
+FROM build AS publish
+ARG BUILD_CONFIGURATION=Release
+RUN dotnet publish "./Dlhis.InfoCheck.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+ENTRYPOINT ["dotnet", "Dlhis.InfoCheck.dll"]
\ No newline at end of file
diff --git a/Src/Dlhis.InfoCheck/Program.cs b/Src/Dlhis.InfoCheck/Program.cs
new file mode 100644
index 00000000..ec28e74a
--- /dev/null
+++ b/Src/Dlhis.InfoCheck/Program.cs
@@ -0,0 +1,19 @@
+using Kurisu.AspNetCore.Startup;
+using Kurisu.AspNetCore.Utils.Extensions;
+using Microsoft.IdentityModel.Logging;
+
+class Program
+{
+ static void Main(string[] args)
+ {
+ KurisuHost.Run(args);
+ }
+}
+
+public class Startup : DefaultStartup
+{
+ public Startup(IConfiguration configuration) : base(configuration)
+ {
+ IdentityModelEventSource.ShowPII = true;
+ }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.InfoCheck/Properties/launchSettings.json b/Src/Dlhis.InfoCheck/Properties/launchSettings.json
new file mode 100644
index 00000000..49b1f9a2
--- /dev/null
+++ b/Src/Dlhis.InfoCheck/Properties/launchSettings.json
@@ -0,0 +1,38 @@
+{
+ "profiles": {
+ "Dlhis.InfoCheck": {
+ "commandName": "Project",
+ "launchUrl": "weatherforecast",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "dotnetRunMessages": true,
+ "applicationUrl": "http://localhost:5048"
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "weatherforecast",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "Docker": {
+ "commandName": "Docker",
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/weatherforecast",
+ "environmentVariables": {
+ "ASPNETCORE_URLS": "http://+:80"
+ },
+ "publishAllPorts": true
+ }
+ },
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:53902",
+ "sslPort": 0
+ }
+ }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.InfoCheck/Request/FaceDetectRequest.cs b/Src/Dlhis.InfoCheck/Request/FaceDetectRequest.cs
new file mode 100644
index 00000000..5593cc4e
--- /dev/null
+++ b/Src/Dlhis.InfoCheck/Request/FaceDetectRequest.cs
@@ -0,0 +1,6 @@
+锘縩amespace Dlhis.InfoCheck.Request;
+
+public class FaceDetectRequest
+{
+ public string Base64 { get; set; }
+}
diff --git a/Src/Dlhis.InfoCheck/Request/FaceRecognizeRequest.cs b/Src/Dlhis.InfoCheck/Request/FaceRecognizeRequest.cs
new file mode 100644
index 00000000..126df29c
--- /dev/null
+++ b/Src/Dlhis.InfoCheck/Request/FaceRecognizeRequest.cs
@@ -0,0 +1,8 @@
+锘縩amespace Dlhis.InfoCheck.Request;
+
+public class FaceRecognizeRequest
+{
+ public string FirstBase64 { get; set; }
+
+ public string SecondBase64 { get; set; }
+}
diff --git a/Src/Dlhis.InfoCheck/Response/FaceRecognizeResponse.cs b/Src/Dlhis.InfoCheck/Response/FaceRecognizeResponse.cs
new file mode 100644
index 00000000..dc3adb16
--- /dev/null
+++ b/Src/Dlhis.InfoCheck/Response/FaceRecognizeResponse.cs
@@ -0,0 +1,14 @@
+锘縩amespace Dlhis.InfoCheck.Response;
+
+public class FaceRecognizeResponse
+{
+ ///
+ /// 鐩镐技搴�
+ ///
+ public float Similarity { get; set; }
+
+ ///
+ /// 鍚屼竴浜�
+ ///
+ public bool IsSelf { get; set; }
+}
diff --git a/Src/Dlhis.InfoCheck/appsettings.Development.json b/Src/Dlhis.InfoCheck/appsettings.Development.json
new file mode 100644
index 00000000..17b935d5
--- /dev/null
+++ b/Src/Dlhis.InfoCheck/appsettings.Development.json
@@ -0,0 +1,31 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "SwaggerOptions": {
+ "Enable": true,
+ "Authority": "https://yikatong.isawesome.cn/oauth2",
+ "ClientId": "4fb184324eac4180",
+ "ClientSecret": "8ac8f235152f1524",
+ "Scopes": {
+ "openid": "openid",
+ "profile": "profile",
+ "yikatong": "yikatong"
+ }
+ },
+ "IdentityServerOptions": {
+ "Authority": "https://yikatong.isawesome.cn/oauth2",
+ "RequireHttpsMetadata": true,
+ "Issuer": "identity.isawesome.cn",
+ "Audience": "",
+ "Pat": {
+ "Enable": false,
+ "Scheme": "token",
+ "ClientId": "reference",
+ "ClientSecret": "123456"
+ }
+ }
+}
diff --git a/Src/Dlhis.InfoCheck/appsettings.json b/Src/Dlhis.InfoCheck/appsettings.json
new file mode 100644
index 00000000..f7c0efed
--- /dev/null
+++ b/Src/Dlhis.InfoCheck/appsettings.json
@@ -0,0 +1,65 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*",
+ "SwaggerOptions": {
+ "Enable": true,
+ "Authority": "http://identity.oauth.svc.cluster.local",
+ "ClientId": "4fb184324eac4180",
+ "ClientSecret": "8ac8f235152f1524",
+ "Scopes": {
+ "openid": "openid",
+ "profile": "profile",
+ "yikatong": "yikatong"
+ }
+ },
+ "IdentityServerOptions": {
+ "Authority": "http://identity.oauth.svc.cluster.local",
+ "RequireHttpsMetadata": false,
+ "Issuer": "identity.isawesome.cn",
+ "Audience": "",
+ "Pat": {
+ "Enable": false,
+ "Scheme": "token",
+ "ClientId": "reference",
+ "ClientSecret": "123456"
+ }
+ },
+ "Serilog": {
+ "MinimumLevel": {
+ "Default": "Information",
+ "Override": {
+ "System": "Warning",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ },
+ "WriteTo": [
+ {
+ "Name": "Async",
+ "Args": {
+ "configure": [
+ {
+ "Name": "Console",
+ "Args": {
+ "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}"
+ }
+ },
+ {
+ "Name": "MySQL",
+ "Args": {
+ "connectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=log;charset=utf8mb4;",
+ "tableName": "Logs",
+ "autoCreateSqlTable": true
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}