fix 注销任务
This commit is contained in:
@@ -34,27 +34,27 @@ namespace Dlhis.ScheduledTask.CommonJobs
|
||||
try
|
||||
{
|
||||
|
||||
var identityDbContext = _dbContext.ChangeDb("identity");
|
||||
//var identityDbContext = _dbContext.ChangeDb("identity");
|
||||
|
||||
//HST0001
|
||||
var users = await identityDbContext.Queryable<UserEntity>().Where(x => x.UserName != "HST0001")
|
||||
.Where(x => x.Id > 21)
|
||||
.ToListAsync();
|
||||
////HST0001
|
||||
//var users = await identityDbContext.Queryable<UserEntity>().Where(x => x.UserName != "HST0001")
|
||||
// .Where(x => x.Id > 21)
|
||||
// .ToListAsync();
|
||||
|
||||
var gainfos = await _dbContext.Queryable<GainfoEntity>().ToListAsync();
|
||||
//var gainfos = await _dbContext.Queryable<GainfoEntity>().ToListAsync();
|
||||
|
||||
var hasher = new PasswordHasher<UserEntity>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
var gainfo = gainfos.FirstOrDefault(x => x.Code == user.UserName);
|
||||
if (gainfo != null && gainfo.IdNo.IsPresent())
|
||||
{
|
||||
var password = gainfo.IdNo.TakeLast(6).Join("");
|
||||
password = hasher.HashPassword(user, password);
|
||||
user.PasswordHash = password;
|
||||
await identityDbContext.UpdateAsync(user);
|
||||
}
|
||||
}
|
||||
//var hasher = new PasswordHasher<UserEntity>();
|
||||
//foreach (var user in users)
|
||||
//{
|
||||
// var gainfo = gainfos.FirstOrDefault(x => x.Code == user.UserName);
|
||||
// if (gainfo != null && gainfo.IdNo.IsPresent())
|
||||
// {
|
||||
// var password = gainfo.IdNo.TakeLast(6).Join("");
|
||||
// password = hasher.HashPassword(user, password);
|
||||
// user.PasswordHash = password;
|
||||
// await identityDbContext.UpdateAsync(user);
|
||||
// }
|
||||
//}
|
||||
|
||||
//var userNames = await identityDbContext.Queryable<UserEntity>().Select(x => x.UserName).ToListAsync();
|
||||
//var newUser = await _dbContext.Queryable<GainfoEntity>()
|
||||
|
||||
Reference in New Issue
Block a user