Sfoglia il codice sorgente

😎1、优化新增用户时默认密码逻辑 2、代码整理及升级依赖

zuohuaijun 8 mesi fa
parent
commit
e681571cd1

+ 7 - 7
Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj

@@ -19,9 +19,9 @@
     <PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
     <PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
     <PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.0.7" />
-    <PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.96" />
-    <PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.96" />
-    <PackageReference Include="Furion.Pure" Version="4.9.7.96" />
+    <PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.98" />
+    <PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.98" />
+    <PackageReference Include="Furion.Pure" Version="4.9.7.98" />
 	<PackageReference Include="Hardware.Info" Version="101.0.1.1" />
     <PackageReference Include="Hashids.net" Version="1.7.0" />
     <PackageReference Include="IPTools.China" Version="1.6.0" />
@@ -39,9 +39,9 @@
     <PackageReference Include="QRCoder" Version="1.6.0" />
     <PackageReference Include="RabbitMQ.Client" Version="7.1.2" />
     <PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.5" />
-    <PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.10.0" />
-    <PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.12.0" />
-    <PackageReference Include="SqlSugar.MongoDbCore" Version="5.1.4.220" />
+    <PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.11.0" />
+    <PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.13.0" />
+    <PackageReference Include="SqlSugar.MongoDbCore" Version="5.1.4.227" />
     <PackageReference Include="SqlSugarCore" Version="5.1.4.198" />
     <PackageReference Include="SSH.NET" Version="2025.0.0" />
     <PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.6" />
@@ -71,7 +71,7 @@
     <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.7" />
     <PackageReference Include="Microsoft.AspNetCore.SignalR.StackExchangeRedis" Version="9.0.7" />
 	<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.5.2" />
-	<PackageReference Include="XiHan.Framework.Utils" Version="0.11.5" />
+	<PackageReference Include="XiHan.Framework.Utils" Version="0.11.6" />
   </ItemGroup>
 
 </Project>

+ 2 - 2
Admin.NET/Admin.NET.Core/Service/User/SysUserService.cs

@@ -101,8 +101,8 @@ public class SysUserService : IDynamicApiController, ITransient
         // 禁止越权新增超级管理员和系统管理员
         if (_userManager.AccountType != AccountTypeEnum.SuperAdmin && input.AccountType is AccountTypeEnum.SuperAdmin or AccountTypeEnum.SysAdmin) throw Oops.Oh(ErrorCodeEnum.D1038);
 
-        var password = await _sysConfigService.GetConfigValue<string>(ConfigConst.SysPassword);
-
+        // 若没有设置密码则取默认密码
+        var password = !string.IsNullOrWhiteSpace(input.Password) ? input.Password : await _sysConfigService.GetConfigValue<string>(ConfigConst.SysPassword);
         var user = input.Adapt<SysUser>();
         user.Password = CryptogramUtil.Encrypt(password);
         var newUser = await _sysUserRep.AsInsertable(user).ExecuteReturnEntityAsync();

+ 1 - 1
Admin.NET/Admin.NET.Core/Service/User/UserManager.cs

@@ -34,7 +34,7 @@ public class UserManager : IScoped
     public string RealName => _httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.RealName)?.Value;
 
     /// <summary>
-    /// 是否超级管理员
+    /// 账号类型
     /// </summary>
     public AccountTypeEnum? AccountType => int.TryParse(_httpContextAccessor.HttpContext?.User.FindFirst(ClaimConst.AccountType)?.Value, out var val) ? (AccountTypeEnum?)val : null;
 

+ 3 - 9
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

@@ -29,10 +29,9 @@ public static class SqlSugarSetup
 
         // 自定义 SqlSugar 雪花ID算法
         SnowFlakeSingle.WorkId = snowIdOpt.WorkerId;
-        StaticConfig.CustomSnowFlakeFunc = () =>
-        {
-            return YitIdHelper.NextId();
-        };
+        StaticConfig.CustomSnowFlakeFunc = YitIdHelper.NextId;
+        // 注册 MongoDb
+        InstanceFactory.CustomAssemblies = [typeof(SqlSugar.MongoDb.MongoDbProvider).Assembly];
         // 动态表达式 SqlFunc 支持,https://www.donet5.com/Home/Doc?typeId=2569
         StaticConfig.DynamicExpressionParserType = typeof(DynamicExpressionParser);
         StaticConfig.DynamicExpressionParsingConfig = new ParsingConfig
@@ -43,11 +42,6 @@ public static class SqlSugarSetup
         var dbOptions = App.GetConfig<DbConnectionOptions>("DbConnection", true);
         dbOptions.ConnectionConfigs.ForEach(SetDbConfig);
 
-        //注册DLL防止找不到DLL(扔在程序启动时)
-        InstanceFactory.CustomAssemblies = new System.Reflection.Assembly[] {
-            typeof(SqlSugar.MongoDb.MongoDbProvider).Assembly
-        };
-
         SqlSugarScope sqlSugar = new(dbOptions.ConnectionConfigs.Adapt<List<ConnectionConfig>>(), db =>
         {
             dbOptions.ConnectionConfigs.ForEach(config =>

+ 2 - 2
Admin.NET/Admin.NET.Test/Admin.NET.Test.csproj

@@ -12,11 +12,11 @@
     </PropertyGroup>
 
     <ItemGroup>
-      <PackageReference Include="Furion.Xunit" Version="4.9.7.96" />
+      <PackageReference Include="Furion.Xunit" Version="4.9.7.98" />
       <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
       <PackageReference Include="Selenium.Support" Version="4.34.0" />
       <PackageReference Include="Selenium.WebDriver" Version="4.34.0" />
-      <PackageReference Include="Selenium.WebDriver.MSEdgeDriver" Version="138.0.3351.65" />
+      <PackageReference Include="Selenium.WebDriver.MSEdgeDriver" Version="138.0.3351.83" />
       <PackageReference Include="xunit.assert" Version="2.9.3" />
     </ItemGroup>
 

+ 10 - 10
Web/package.json

@@ -2,7 +2,7 @@
 	"name": "admin.net",
 	"type": "module",
 	"version": "2.4.33",
-	"lastBuildTime": "2025.07.12",
+	"lastBuildTime": "2025.07.19",
 	"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
 	"author": "zuohuaijun",
 	"license": "MIT",
@@ -43,10 +43,10 @@
 		"json-editor-vue": "^0.18.1",
 		"jsplumb": "^2.15.6",
 		"lodash-es": "^4.17.21",
-		"md-editor-v3": "^5.7.1",
+		"md-editor-v3": "^5.8.2",
 		"mitt": "^3.0.1",
 		"monaco-editor": "^0.52.2",
-		"mqtt": "^5.13.2",
+		"mqtt": "^5.13.3",
 		"nprogress": "^0.2.0",
 		"pinia": "^3.0.3",
 		"print-js": "^1.6.0",
@@ -55,7 +55,7 @@
 		"qs": "^6.14.0",
 		"relation-graph": "^2.2.11",
 		"screenfull": "^6.0.2",
-		"sm-crypto-v2": "^1.12.0",
+		"sm-crypto-v2": "^1.13.0",
 		"sortablejs": "^1.15.6",
 		"splitpanes": "^4.0.4",
 		"vcrontab-3": "^3.3.22",
@@ -65,7 +65,7 @@
 		"vue-demi": "^0.14.10",
 		"vue-draggable-plus": "^0.6.0",
 		"vue-grid-layout": "3.0.0-beta1",
-		"vue-i18n": "^11.1.9",
+		"vue-i18n": "^11.1.10",
 		"vue-json-pretty": "^2.5.0",
 		"vue-plugin-hiprint": "^0.0.60",
 		"vue-router": "^4.5.1",
@@ -81,22 +81,22 @@
 		"@types/node": "^22.15.35",
 		"@types/nprogress": "^0.2.3",
 		"@types/sortablejs": "^1.15.8",
-		"@typescript-eslint/eslint-plugin": "^8.36.0",
-		"@typescript-eslint/parser": "^8.36.0",
+		"@typescript-eslint/eslint-plugin": "^8.37.0",
+		"@typescript-eslint/parser": "^8.37.0",
 		"@vitejs/plugin-vue": "^6.0.0",
 		"@vitejs/plugin-vue-jsx": "^5.0.1",
 		"@vue/compiler-sfc": "^3.5.17",
-		"code-inspector-plugin": "^0.20.15",
+		"code-inspector-plugin": "^0.20.17",
 		"eslint": "^9.31.0",
 		"eslint-plugin-vue": "^10.3.0",
 		"globals": "^16.3.0",
-		"less": "^4.3.0",
+		"less": "^4.4.0",
 		"prettier": "^3.6.2",
 		"rollup-plugin-visualizer": "^6.0.3",
 		"sass": "^1.89.2",
 		"terser": "^5.43.1",
 		"typescript": "^5.8.3",
-		"vite": "^7.0.4",
+		"vite": "^7.0.5",
 		"vite-plugin-cdn-import": "^1.0.1",
 		"vite-plugin-compression2": "^2.2.0",
 		"vite-plugin-vue-setup-extend": "^0.4.0",