瀏覽代碼

😎代码优化

zuohuaijun 1 年之前
父節點
當前提交
2e37b1541d

+ 1 - 2
Admin.NET/Admin.NET.Application/Configuration/App.json

@@ -46,8 +46,7 @@
     "PasswordStrengthValidation": "(?=^.{6,16}$)(?=.*\\d)(?=.*\\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\\n).*$", // 密码强度验证正则表达式,必须须包含大小写字母、数字和特殊字符的组合,长度在6-16之间
     "PasswordStrengthValidationMsg": "密码必须包含大小写字母、数字和特殊字符的组合,长度在6-16之间", // 密码强度验证消息提示
     "CryptoType": "SM2", // 密码加密算法:MD5、SM2、SM4
-    //新业务系统一定要改私钥,通过接口(http://localhost:5005/api/sysCommon/smKeyPair)获取
-    //获取后要同时修改前端文件:VITE_SM_PUBLIC_KEY 配置地项
+    // 新业务系统记得改密匙,通过接口(http://localhost:5005/api/sysCommon/smKeyPair)获取。记得同步修改前端公钥配置:VITE_SM_PUBLIC_KEY
     "PublicKey": "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312", // 公钥
     "PrivateKey": "8EDB615B1D48B8BE188FC0F18EC08A41DF50EA731FA28BF409E6552809E3A111" // 私钥
   }

+ 2 - 1
Admin.NET/Admin.NET.Application/Configuration/Captcha.json

@@ -1,6 +1,7 @@
 {
   "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
-  // Lazy.Captcha.Core 配置:详细文档(https://api.gitee.com/pojianbing/lazy-captcha/)
+
+  // Lazy.Captcha.Core 组件详细文档(https://api.gitee.com/pojianbing/lazy-captcha/)
   "CaptchaOptions": {
     "CaptchaType": 10, // 验证码类型0、1、2、3、4、5、6、7、8、9、10、11
     "CodeLength": 1, // 验证码长度, 要放在CaptchaType设置后  当类型为算术表达式时,长度代表操作的个数, 例如2

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

@@ -18,9 +18,9 @@
     <PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
     <PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
     <PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.15.0" />
-    <PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.5" />
-    <PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.5" />
-    <PackageReference Include="Furion.Pure" Version="4.9.5" />
+    <PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.5.1" />
+    <PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.5.1" />
+    <PackageReference Include="Furion.Pure" Version="4.9.5.1" />
     <PackageReference Include="IPTools.China" Version="1.6.0" />
     <PackageReference Include="IPTools.International" Version="1.6.0" />
     <PackageReference Include="Magicodes.IE.Excel" Version="2.7.5.1" />

+ 20 - 0
Admin.NET/Admin.NET.Core/EventBus/RedisQueue.cs

@@ -179,4 +179,24 @@ public static class RedisQueue
         var queue = GetRedisReliableQueue<T>(topic);
         return queue.Take(count).ToList();
     }
+
+    /// <summary>
+    /// 申请分布式锁
+    /// </summary>
+    /// <param name="key">要锁定的key</param>
+    /// <param name="msTimeout">申请锁等待的时间,单位毫秒</param>
+    /// <param name="msExpire">锁过期时间,超过该时间没有主动是放则自动是放,必须整数秒,单位毫秒</param>
+    /// <param name="throwOnFailure">失败时是否抛出异常,如不抛出异常,可通过判断返回null得知申请锁失败</param>
+    /// <returns></returns>
+    public static IDisposable? BeginCacheLock(string key, int msTimeout = 500, int msExpire = 10000, bool throwOnFailure = true)
+    {
+        try
+        {
+            return _cacheProvider.Cache.AcquireLock(key, msTimeout, msExpire, throwOnFailure);
+        }
+        catch
+        {
+            return null;
+        }
+    }
 }

+ 4 - 4
Web/.env

@@ -10,11 +10,11 @@ VITE_OPEN_CDN = false
 # public path 配置线上环境路径(打包)、本地通过 http-server 访问时,请置空即可
 VITE_PUBLIC_PATH =
 
-# 登陆界面默认填入用户
-VITE_DEFAULT_USER = superadmin1
+# 登陆界面默认用户
+VITE_DEFAULT_USER = superadmin
 
-# 登陆界面默认填入密码
+# 登陆界面默认密码
 VITE_DEFAULT_USER_PASSWORD = 123456
 
-# SM公钥
+# 国密SM公钥
 VITE_SM_PUBLIC_KEY = "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312"

+ 9 - 9
Web/package.json

@@ -2,7 +2,7 @@
 	"name": "admin.net",
 	"type": "module",
 	"version": "2.4.33",
-	"lastBuildTime": "2024.08.07",
+	"lastBuildTime": "2024.08.10",
 	"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
 	"author": "zuohuaijun",
 	"license": "MIT",
@@ -26,7 +26,7 @@
 		"@vue-office/docx": "^1.6.2",
 		"@vue-office/excel": "^1.7.11",
 		"@vue-office/pdf": "^2.0.2",
-		"@vueuse/core": "^10.11.0",
+		"@vueuse/core": "^10.11.1",
 		"@wangeditor/editor": "^5.1.23",
 		"@wangeditor/editor-for-vue": "^5.1.12",
 		"animate.css": "^4.1.1",
@@ -37,7 +37,7 @@
 		"echarts": "^5.5.1",
 		"echarts-gl": "^2.0.9",
 		"echarts-wordcloud": "^2.1.0",
-		"element-plus": "^2.7.8",
+		"element-plus": "^2.8.0",
 		"ezuikit": "^1.0.0",
 		"ezuikit-js": "^8.0.8",
 		"js-cookie": "^3.0.5",
@@ -61,7 +61,7 @@
 		"splitpanes": "^3.1.5",
 		"vcrontab-3": "^3.3.22",
 		"vform3-builds": "^3.0.10",
-		"vue": "^3.4.36",
+		"vue": "^3.4.37",
 		"vue-clipboard3": "^2.0.0",
 		"vue-demi": "^0.14.6",
 		"vue-draggable-plus": "^0.5.3",
@@ -69,7 +69,7 @@
 		"vue-i18n": "^9.13.1",
 		"vue-json-pretty": "^2.4.0",
 		"vue-plugin-hiprint": "0.0.57-beta27",
-		"vue-router": "^4.4.2",
+		"vue-router": "^4.4.3",
 		"vue-signature-pad": "^3.0.2",
 		"vue3-tree-org": "^4.2.2",
 		"xlsx-js-style": "^1.2.0"
@@ -77,14 +77,14 @@
 	"devDependencies": {
 		"@plugin-web-update-notification/vite": "^1.7.1",
 		"@types/lodash-es": "^4.17.12",
-		"@types/node": "^20.14.14",
+		"@types/node": "^20.14.15",
 		"@types/nprogress": "^0.2.3",
 		"@types/sortablejs": "^1.15.8",
 		"@typescript-eslint/eslint-plugin": "^7.18.0",
 		"@typescript-eslint/parser": "^7.18.0",
 		"@vitejs/plugin-vue": "^5.1.2",
 		"@vitejs/plugin-vue-jsx": "^4.0.0",
-		"@vue/compiler-sfc": "^3.4.36",
+		"@vue/compiler-sfc": "^3.4.37",
 		"code-inspector-plugin": "^0.15.2",
 		"eslint": "^8.57.0",
 		"eslint-plugin-vue": "^9.27.0",
@@ -93,9 +93,9 @@
 		"prettier": "^3.3.3",
 		"rollup-plugin-visualizer": "^5.12.0",
 		"sass": "^1.77.8",
-		"terser": "^5.31.3",
+		"terser": "^5.31.5",
 		"typescript": "^5.5.4",
-		"vite": "^5.3.5",
+		"vite": "^5.4.0",
 		"vite-plugin-cdn-import": "^1.0.1",
 		"vite-plugin-compression2": "^1.1.3",
 		"vite-plugin-vue-setup-extend": "^0.4.0",