mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-06-20 02:38:15 +08:00
feat: ✨ 查询过滤器保存
页面定时刷新 WebSocket断线自动重连
This commit is contained in:
@ -25,7 +25,6 @@ public record QueryConfigRsp : Sys_Config
|
||||
public override bool UserRegisterConfirm { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_Config.UserRegisterDept" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public new virtual QueryDeptRsp UserRegisterDept { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_Config.UserRegisterDeptId" />
|
||||
@ -33,7 +32,6 @@ public record QueryConfigRsp : Sys_Config
|
||||
public override long UserRegisterDeptId { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_Config.UserRegisterRole" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public new virtual QueryRoleRsp UserRegisterRole { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_Config.UserRegisterRoleId" />
|
||||
|
@ -48,7 +48,6 @@ public record QueryLoginLogRsp : Sys_LoginLog
|
||||
public override string LoginUserName { get; protected init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.Owner" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public new virtual QueryUserRsp Owner { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_LoginLog.RequestBody" />
|
||||
|
@ -17,7 +17,6 @@ public record QueryRequestLogRsp : Sys_RequestLog
|
||||
public new virtual string CreatedClientIp => base.CreatedClientIp?.ToIpV4();
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.Api" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public new virtual QueryApiRsp Api { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.ApiPathCrc32" />
|
||||
@ -29,7 +28,6 @@ public record QueryRequestLogRsp : Sys_RequestLog
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.Detail" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public new virtual QueryRequestLogDetailRsp Detail { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.Duration" />
|
||||
@ -45,7 +43,6 @@ public record QueryRequestLogRsp : Sys_RequestLog
|
||||
public override int HttpStatusCode { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_RequestLog.Owner" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public new virtual QueryUserRsp Owner { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldOwner.OwnerId" />
|
||||
|
@ -24,7 +24,6 @@ public record QuerySiteMsgRsp : Sys_SiteMsg
|
||||
public override string CreatedUserName { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_SiteMsg.Depts" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public new virtual IEnumerable<QueryDeptRsp> Depts { get; init; }
|
||||
|
||||
/// <inheritdoc cref="EntityBase{T}.Id" />
|
||||
@ -45,7 +44,6 @@ public record QuerySiteMsgRsp : Sys_SiteMsg
|
||||
public QuerySiteMsgFlagRsp MyFlags { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_SiteMsg.Roles" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public new virtual IEnumerable<QueryRoleRsp> Roles { get; init; }
|
||||
|
||||
/// <summary>
|
||||
@ -62,7 +60,6 @@ public record QuerySiteMsgRsp : Sys_SiteMsg
|
||||
public override string Title { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_SiteMsg.Users" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public new virtual IEnumerable<QueryUserRsp> Users { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldVersion.Version" />
|
||||
|
@ -207,7 +207,9 @@ public sealed class UserService(
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return dbUser == null ? throw new NetAdminInvalidOperationException(Ln.用户名或密码错误) : LoginInternal(dbUser);
|
||||
return dbUser == null
|
||||
? throw new NetAdminInvalidOperationException(Ln.用户名或密码错误)
|
||||
: await LoginInternalAsync(dbUser).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -221,7 +223,9 @@ public sealed class UserService(
|
||||
}
|
||||
|
||||
var dbUser = await Rpo.Where(a => a.Mobile == req.DestDevice).ToOneAsync().ConfigureAwait(false);
|
||||
return dbUser == null ? throw new NetAdminInvalidOperationException(Ln.用户不存在) : LoginInternal(dbUser);
|
||||
return dbUser == null
|
||||
? throw new NetAdminInvalidOperationException(Ln.用户不存在)
|
||||
: await LoginInternalAsync(dbUser).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -229,7 +233,7 @@ public sealed class UserService(
|
||||
{
|
||||
var dbUser = await Rpo.Where(a => a.Id == userId).ToOneAsync().ConfigureAwait(false);
|
||||
|
||||
return LoginInternal(dbUser);
|
||||
return await LoginInternalAsync(dbUser).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -464,14 +468,15 @@ public sealed class UserService(
|
||||
return dept.Count != 1 ? throw new NetAdminInvalidOperationException(Ln.部门不存在) : roles;
|
||||
}
|
||||
|
||||
private LoginRsp LoginInternal(Sys_User dbUser)
|
||||
private async Task<LoginRsp> LoginInternalAsync(Sys_User dbUser)
|
||||
{
|
||||
if (!dbUser.Enabled) {
|
||||
throw new NetAdminInvalidOperationException(Ln.请联系管理员激活账号);
|
||||
}
|
||||
|
||||
_ = UpdateAsync(dbUser with { LastLoginTime = DateTime.Now }, [nameof(Sys_User.LastLoginTime)]
|
||||
, ignoreVersion: true);
|
||||
_ = await UpdateAsync(dbUser with { LastLoginTime = DateTime.Now }, [nameof(Sys_User.LastLoginTime)]
|
||||
, ignoreVersion: true)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var tokenPayload
|
||||
= new Dictionary<string, object> { { nameof(ContextUserToken), dbUser.Adapt<ContextUserToken>() } };
|
||||
|
Reference in New Issue
Block a user