feat 数据迁移接口

This commit is contained in:
2024-03-12 12:45:25 +08:00
parent 73cc592cd3
commit 80aa3f6932
4 changed files with 99 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
using System.ComponentModel.DataAnnotations;
using Kurisu.AspNetCore.Utils.Extensions;
namespace Dlhis.Basic.Organization.Request;
public class MigrationRequest : IValidatableObject
{
/// <summary>
/// 工号
/// </summary>
[Required(ErrorMessage = "工号不能为空")]
public string Code { get; set; }
/// <summary>
/// 卡号
/// </summary>
public string CardNo { get; set; }
/// <summary>
/// base64
/// </summary>
public string Face { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (Face.IsPresent())
{
bool v = true;
try
{
Convert.FromBase64String(Face);
}
catch (Exception)
{
v = false;
}
if (!v)
{
yield return new ValidationResult("人脸照片需要为Base64格式", new[] { nameof(Face) });
}
}
}
}