mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-06-07 08:29:51 +08:00
feat: 添加裁剪人脸图片功能,更新人脸管理服务以支持裁剪路径
This commit is contained in:
@@ -4,12 +4,14 @@ using Foxel.Models.Response.Picture;
|
||||
using Foxel.Services.Mapping;
|
||||
using Foxel.Api.Management;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Foxel.Services.Configuration;
|
||||
|
||||
namespace Foxel.Services.Management;
|
||||
|
||||
public class FaceManagementService(
|
||||
IDbContextFactory<MyDbContext> contextFactory,
|
||||
IMappingService mappingService,
|
||||
IConfigService configService,
|
||||
ILogger<FaceManagementService> logger) : IFaceManagementService
|
||||
{
|
||||
public async Task<PaginatedResult<FaceClusterResponse>> GetFaceClustersAsync(int page = 1, int pageSize = 20)
|
||||
@@ -22,7 +24,7 @@ public class FaceManagementService(
|
||||
{
|
||||
Cluster = c,
|
||||
FaceCount = dbContext.Faces.Count(f => f.ClusterId == c.Id),
|
||||
ThumbnailPath = dbContext.Faces
|
||||
ThumbnailPath = configService["AppSettings:ServerUrl"] + dbContext.Faces
|
||||
.Where(f => f.ClusterId == c.Id)
|
||||
.Include(f => f.Picture)
|
||||
.OrderByDescending(f => f.CreatedAt)
|
||||
@@ -195,11 +197,10 @@ public class FaceManagementService(
|
||||
{
|
||||
Cluster = c,
|
||||
FaceCount = dbContext.Faces.Count(f => f.ClusterId == c.Id && f.Picture.UserId == userId),
|
||||
ThumbnailPath = dbContext.Faces
|
||||
.Where(f => f.ClusterId == c.Id && f.Picture.UserId == userId)
|
||||
.Include(f => f.Picture)
|
||||
ThumbnailPath = configService["AppSettings:ServerUrl"]+ dbContext.Faces
|
||||
.Where(f => f.ClusterId == c.Id && f.Picture.UserId == userId && !string.IsNullOrEmpty(f.CroppedImagePath))
|
||||
.OrderByDescending(f => f.CreatedAt)
|
||||
.Select(f => f.Picture.ThumbnailPath)
|
||||
.Select(f => f.CroppedImagePath)
|
||||
.FirstOrDefault()
|
||||
})
|
||||
.Where(x => x.FaceCount > 0)
|
||||
|
||||
Reference in New Issue
Block a user