XFEExtension.NetCore.ServerInteractive
[DLL] Server interaction extension, including user identity verification and querying in conjunction with AutoConfig
关注
0
Fork
0
Star
0
返回提交历史
Modified
XFEExtension.NetCore.ServerInteractive/Utilities/DataTable/XFEDataTable.cs
+2
-2
Modified
XFEExtension.NetCore.ServerInteractive/Utilities/Server/Services/CoreService/UserLoginService.cs
+5
-4
Modified
XFEExtension.NetCore.ServerInteractive/Utilities/Server/Services/CoreService/UserReloginService.cs
+2
-2
Modified
XFEExtension.NetCore.ServerInteractive/XFEExtension.NetCore.ServerInteractive.csproj
+2
-2
XFEstudio/XFEExtension.NetCore.ServerInteractive
修复部分Json序列化转化问题
a32149d
代码差异
4 个文件
+11
-10
@@ -75,7 +75,7 @@ public class XFEDataTable<T> : IXFEDataTable where T : IIDModel
75
75
var property = type.GetProperty($"{typeof(T).Name}Table", BindingFlags.Public | BindingFlags.Static);
76
76
var profileListType = typeof(ProfileList<T>);
77
77
var addMethod = profileListType.GetMethod("Add", [typeof(T)]);
78
var removeMethod = profileListType.GetMethod("RemoveAt");
78
var removeMethod = profileListType.GetMethod("Remove", [typeof(T)]);
79
79
var saveMethod = type.GetMethod("SaveProfile", BindingFlags.Public | BindingFlags.Static);
80
80
if (property is not null && addMethod is not null && removeMethod is not null && saveMethod is not null)
81
81
{
@@ -135,7 +135,7 @@ public class XFEDataTable<T> : IXFEDataTable where T : IIDModel
135
135
switch (execute)
136
136
{
137
137
case "get":
138
Console.Write($"【{r.Args.ClientIP}】获取{TableShowName}列表请求");
138
Console.Write($"【{r.Args.ClientIP}】获取{TableShowName}列表请求");
139
139
UserHelper.ValidatePermission(requestJsonNode["session"], requestJsonNode["computerInfo"], r.Args.ClientIP, GetPermissionLevel, GetEncryptedUserLoginModelFunction(), GetUsersFunction(), r);
140
140
List<T> tableList = [.. GetTableFunction()];
141
141
int pageCount = requestJsonNode["pageCount"].GetValue<int>();
@@ -1,4 +1,5 @@
1
1
using System.Net;
2
using System.Text.Json;
2
3
using XFEExtension.NetCore.ServerInteractive.Models.ServerModels;
3
4
using XFEExtension.NetCore.ServerInteractive.Models.UserModels;
4
5
using XFEExtension.NetCore.ServerInteractive.Utilities.Helpers;
@@ -52,12 +53,12 @@ public class UserLoginService<T> : ServerCoreUserLoginServiceBase<T> where T : c
52
53
};
53
54
AddEncryptedUserLoginModelFunction(userLogin);
54
55
Console.WriteLine($"[DEBUG]用户 {user.UserName} 登录成功,登录到期时间 {userLogin.UserLoginModel.EndDateTime}");
55
await r.Args.ReplyAndClose(new
56
await r.Args.ReplyAndClose(JsonSerializer.Serialize(new
56
57
{
57
58
session = $"{user.ID}|{UserHelper.Encrypt(userLogin.Key, userLogin.UserLoginModel)}",
58
59
expireDate = userLogin.UserLoginModel.EndDateTime,
59
60
userInfo = LoginResultConvertFunction(user)
60
}.ToJson(), HttpStatusCode.OK);
61
}, JsonSerializerOptions), HttpStatusCode.OK);
61
62
}
62
63
else
63
64
{
@@ -65,12 +66,12 @@ public class UserLoginService<T> : ServerCoreUserLoginServiceBase<T> where T : c
65
66
userLogin.UserLoginModel.LastIPAddress = r.Args.ClientIP;
66
67
userLogin.UserLoginModel.EndDateTime = DateTime.Now.AddDays(GetLoginKeepDays());
67
68
Console.WriteLine($"[DEBUG]用户 {user.UserName} 已登录,登录到期时间:{userLogin.UserLoginModel.EndDateTime}");
68
await r.Args.ReplyAndClose(new
69
await r.Args.ReplyAndClose(JsonSerializer.Serialize(new
69
70
{
70
71
session = $"{user.ID}|{UserHelper.Encrypt(userLogin.Key, userLogin.UserLoginModel)}",
71
72
expireDate = userLogin.UserLoginModel.EndDateTime,
72
73
userInfo = LoginResultConvertFunction(user)
73
}.ToJson(), HttpStatusCode.OK);
74
}, JsonSerializerOptions), HttpStatusCode.OK);
74
75
}
75
76
}
76
77
}
@@ -1,10 +1,10 @@
1
1
using System.Net;
2
using System.Text.Json;
2
3
using System.Text.RegularExpressions;
3
4
using XFEExtension.NetCore.ServerInteractive.Models.ServerModels;
4
5
using XFEExtension.NetCore.ServerInteractive.Models.UserModels;
5
6
using XFEExtension.NetCore.ServerInteractive.Utilities.Helpers;
6
7
using XFEExtension.NetCore.StringExtension;
7
using XFEExtension.NetCore.StringExtension.Json;
8
8
using XFEExtension.NetCore.XFETransform.JsonConverter;
9
9
10
10
namespace XFEExtension.NetCore.ServerInteractive.Utilities.Server.Services.CoreService;
@@ -33,6 +33,6 @@ public class UserReloginService<T> : ServerCoreUserLoginServiceBase<T> where T :
33
33
if (userLoginModel.LastIPAddress != r.Args.ClientIP) r.Error("IP地址不匹配", HttpStatusCode.Forbidden);
34
34
if (userLoginModel.LastIPAddress != encryptedUserLoginModel.UserLoginModel.LastIPAddress) r.Error("IP地址不匹配", HttpStatusCode.Forbidden);
35
35
if (userLoginModel.EndDateTime < DateTime.Now) r.Error("登录已过期", HttpStatusCode.Forbidden);
36
await r.Args.ReplyAndClose(LoginResultConvertFunction(user).ToJson());
36
await r.Args.ReplyAndClose(JsonSerializer.Serialize(LoginResultConvertFunction(user), JsonSerializerOptions));
37
37
}
38
38
}
@@ -5,7 +5,7 @@
5
5
<ImplicitUsings>enable</ImplicitUsings>
6
6
<Nullable>enable</Nullable>
7
7
<GenerateDocumentationFile>True</GenerateDocumentationFile>
8
<Version>1.0.13</Version>
8
<Version>1.0.14</Version>
9
9
<Title>XFEExtension.NetCore.ServerInteractive</Title>
10
10
<RepositoryUrl>https://github.com/XFEstudio/XFEExtension.NetCore.ServerInteractive</RepositoryUrl>
11
11
<AnalysisLevel>latest</AnalysisLevel>
@@ -21,7 +21,7 @@
21
21
<PackageReleaseNotes>
22
22
## 调整
23
23
24
添加日志请求时的日志提示
24
修复部分Json序列化转化问题
25
25
26
26
## 新增
27
27