平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PersonFacesService.cs 1.2 KiB

1 月之前
3 月之前
3 月之前
1 月之前
3 月之前
12345678910111213141516171819202122232425262728293031323334
  1. using MoYu.RemoteRequest.Extensions;
  2. namespace SafeCampus.Application.Services.Business.PersonFacesService;
  3. public class PersonFacesService:DbRepository<PersonFaces>, IPersonFacesService
  4. {
  5. public async Task<bool> BatchAdd(List<PersonFaces> list)
  6. {
  7. var oldList = await GetListAsync(x => x.PersonId == list[0].PersonId);
  8. await DeleteAsync(oldList);
  9. foreach (var item in list)
  10. {
  11. var signImg = Path.Combine(Directory.GetCurrentDirectory(), "Files", App.Configuration["AppInfo:PersonImg"], item.FaceId + ".jpg");
  12. await item.FaceUrl.GetToSaveAsync(signImg);
  13. item.FaceUrl = $"/Files/{App.Configuration["AppInfo:PersonImg"]}/{item.FaceId}.jpg";
  14. await InsertAsync(item);
  15. }
  16. //await InsertRangeAsync(list);
  17. return true;
  18. }
  19. public async Task<bool> Add(PersonFaces entity)
  20. {
  21. await InsertAsync(entity);
  22. return true;
  23. }
  24. public async Task<bool> Delete(string personId, List<string> faceIds)
  25. {
  26. var delList = await GetListAsync(x => x.PersonId == personId && faceIds.Contains(x.FaceId));
  27. await DeleteAsync(delList);
  28. return true;
  29. }
  30. }