fix 同时返回userNo

This commit is contained in:
2024-06-14 15:51:40 +08:00
parent 86c7111c19
commit f5a3e1fe7c
3 changed files with 13 additions and 13 deletions

View File

@@ -184,11 +184,11 @@ public class GainfosController : ControllerBase
/// <returns></returns>
[AllowAnonymous]
[HttpPost("check/idnoWithName")]
public async Task<string> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request)
public async Task<object> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request)
{
return await _gainfoService.CheckIdNoAndNameMatchAsync(request);
}
/// <summary>
/// 离职
/// </summary>
@@ -199,5 +199,4 @@ public class GainfosController : ControllerBase
{
await _gainfoService.ResignAsync(request);
}
}
}

View File

@@ -18,7 +18,7 @@ public interface IGainfoService : IScopeDependency
Task MigrationAsync(MigrationRequest request);
Task<string> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request);
Task<object> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request);
Task ResignAsync(GainfoResignRequest request);
}

View File

@@ -159,18 +159,19 @@ public class GainfoService : IGainfoService
return info;
}
public async Task<string> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request)
public async Task<object> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request)
{
var match = await _gainfoStore.Queryable(GainfoStatusEnumType.External).AnyAsync(x => x.IdNo == request.IdNo && x.Name == request.Name);
if (!match)
{
match = await _gainfoStore.Queryable(GainfoStatusEnumType.Working).AnyAsync(x => x.IdNo == request.IdNo && x.Name == request.Name);
}
var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.External).FirstAsync(x => x.IdNo == request.IdNo && x.Name == request.Name)
?? await _gainfoStore.Queryable(GainfoStatusEnumType.Working).FirstAsync(x => x.IdNo == request.IdNo && x.Name == request.Name);
match.ThrowIfFalse("验证失败!");
gainfo.ThrowIfNull("验证失败!");
var protector = _dataProtectionProvider.CreateProtector("gainfo:external:idno");
return protector.Protect(request.IdNo);
return new
{
loginPass = protector.Protect(request.IdNo),
UserNo = gainfo.No
};
}