Просмотр исходного кода

😎框架同步升级(建议赶紧升级到此版本)

zuohuaijun 2 лет назад
Родитель
Сommit
1e80ff0c77

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

@@ -19,10 +19,10 @@
     <PackageReference Include="AspNet.Security.OAuth.Gitee" Version="6.0.15" />
     <PackageReference Include="AspNet.Security.OAuth.Weixin" Version="6.0.15" />
     <PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
-    <PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.13.11" />
-    <PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.2.35" />
-    <PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.2.35" />
-    <PackageReference Include="Furion.Pure" Version="4.9.2.35" />
+    <PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.13.12" />
+    <PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.2.36" />
+    <PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.2.36" />
+    <PackageReference Include="Furion.Pure" Version="4.9.2.36" />
     <PackageReference Include="IPTools.China" Version="1.6.0" />
     <PackageReference Include="IPTools.International" Version="1.6.0" />
     <PackageReference Include="Lazy.Captcha.Core" Version="2.0.6" />
@@ -41,7 +41,7 @@
     <PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.1.0" />
     <PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.2.0" />
     <PackageReference Include="SqlSugarCore" Version="5.1.4.154" />
-    <PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.13" />
+    <PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.14" />
     <PackageReference Include="UAParser" Version="3.1.47" />
     <PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
     <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.29" />

+ 2 - 12
Admin.NET/Admin.NET.Core/Const/CacheConst.cs

@@ -11,16 +11,6 @@ namespace Admin.NET.Core;
 /// </summary>
 public class CacheConst
 {
-    ///// <summary>
-    ///// 用户缓存
-    ///// </summary>
-    //public const string KeyUser = "sys_user:";
-
-    ///// <summary>
-    ///// 用户菜单缓存
-    ///// </summary>
-    //public const string KeyUserMenu = "sys_user_menu:";
-
     /// <summary>
     /// 用户权限缓存(按钮集合)
     /// </summary>
@@ -87,7 +77,7 @@ public class CacheConst
     public const string KeyOpenAccessNonce = "sys_open_access_nonce:";
 
     /// <summary>
-    /// 黑名单
+    /// 登录黑名单
     /// </summary>
     public const string KeyBlacklist = "sys_blacklist:";
-}
+}

+ 15 - 0
Admin.NET/Admin.NET.Core/Const/CommonConst.cs

@@ -76,4 +76,19 @@ public class CommonConst
     /// 开启域登录验证
     /// </summary>
     public const string SysDomainLogin = "sys_domain_login";
+
+    /// <summary>
+    /// 日志分组名称
+    /// </summary>
+    public const string SysLogCategoryName = "System.Logging.LoggingMonitor";
+
+    /// <summary>
+    /// 事件-增加异常日志
+    /// </summary>
+    public const string AddExLog = "Add:ExLog";
+
+    /// <summary>
+    /// 事件-发送异常邮件
+    /// </summary>
+    public const string SendErrorMail = "Send:ErrorMail";
 }

+ 0 - 26
Admin.NET/Admin.NET.Core/Const/SysToDoEventConst.cs

@@ -1,26 +0,0 @@
-// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
-//
-// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
-//
-// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
-
-namespace Admin.NET.Core;
-
-/// <summary>
-/// 系统事件常量
-/// </summary>
-public class SysToDoEventConst
-{
-
-    /// <summary>
-    /// 增加异常日志
-    /// </summary>
-    public const string AddExLog = "Add:ExLog";
-    /// <summary>
-    /// 发送异常邮件
-    /// </summary>
-    public const string SendErrorMail = "Send:ErrorMail";
-
-
-
-}

+ 2 - 2
Admin.NET/Admin.NET.Core/EventBus/AppEventSubscriber.cs

@@ -23,7 +23,7 @@ public class AppEventSubscriber : IEventSubscriber, ISingleton, IDisposable
     /// </summary>
     /// <param name="context"></param>
     /// <returns></returns>
-    [EventSubscribe(SysToDoEventConst.AddExLog)]
+    [EventSubscribe(CommonConst.AddExLog)]
     public async Task CreateExLog(EventHandlerExecutingContext context)
     {
         var rep = _serviceScope.ServiceProvider.GetRequiredService<SqlSugarRepository<SysLogEx>>();
@@ -35,7 +35,7 @@ public class AppEventSubscriber : IEventSubscriber, ISingleton, IDisposable
     /// </summary>
     /// <param name="context"></param>
     /// <returns></returns>
-    [EventSubscribe(SysToDoEventConst.SendErrorMail)]
+    [EventSubscribe(CommonConst.SendErrorMail)]
     public async Task SendOrderErrorMail(EventHandlerExecutingContext context)
     {
         //var mailTempPath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Temp\\ErrorMail.tp");

+ 1 - 1
Admin.NET/Admin.NET.Core/Job/LogJob.cs

@@ -19,7 +19,7 @@ public class LogJob : IJob
     public LogJob(IServiceScopeFactory scopeFactory, ILoggerFactory loggerFactory)
     {
         _scopeFactory = scopeFactory;
-        _logger = loggerFactory.CreateLogger("System.Logging.LoggingMonitor");
+        _logger = loggerFactory.CreateLogger(CommonConst.SysLogCategoryName);
     }
 
     public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)

+ 1 - 1
Admin.NET/Admin.NET.Core/Job/OnlineUserJob.cs

@@ -21,7 +21,7 @@ public class OnlineUserJob : IJob
     public OnlineUserJob(IServiceScopeFactory scopeFactory, ILoggerFactory loggerFactory)
     {
         _scopeFactory = scopeFactory;
-        _logger = loggerFactory.CreateLogger("System.Logging.LoggingMonitor");
+        _logger = loggerFactory.CreateLogger(CommonConst.SysLogCategoryName);
     }
 
     public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)

+ 1 - 1
Admin.NET/Admin.NET.Core/Logging/DatabaseLoggingWriter.cs

@@ -123,7 +123,7 @@ public class DatabaseLoggingWriter : IDatabaseLoggingWriter, IDisposable
                 // 将异常日志发送到邮件
                 if (await _sysConfigService.GetConfigValue<bool>(CommonConst.SysErrorMail))
                 {
-                    await App.GetRequiredService<IEventPublisher>().PublishAsync(SysToDoEventConst.SendErrorMail, loggingMonitor.exception);
+                    await App.GetRequiredService<IEventPublisher>().PublishAsync(CommonConst.SendErrorMail, loggingMonitor.exception);
                 }
 
                 return;

+ 2 - 2
Admin.NET/Admin.NET.Core/Logging/LoggingSetup.cs

@@ -75,7 +75,7 @@ public static class LoggingSetup
                 options.MessageFormat = LoggerFormatter.Json;
                 options.WriteFilter = (logMsg) =>
                 {
-                    return logMsg.LogName == "System.Logging.LoggingMonitor"; // 只写LoggingMonitor日志
+                    return logMsg.LogName == CommonConst.SysLogCategoryName; // 只写LoggingMonitor日志
                 };
             });
         }
@@ -90,7 +90,7 @@ public static class LoggingSetup
                 options.IgnoreReferenceLoop = false; // 忽略循环检测
                 options.WriteFilter = (logMsg) =>
                 {
-                    return logMsg.LogName == "System.Logging.LoggingMonitor"; // 只写LoggingMonitor日志
+                    return logMsg.LogName == CommonConst.SysLogCategoryName; // 只写LoggingMonitor日志
                 };
             });
         }

+ 1 - 1
Admin.NET/Admin.NET.Core/Service/Auth/SysAuthService.cs

@@ -257,7 +257,7 @@ public class SysAuthService : IDynamicApiController, ITransient
         var pos = await _sysUserRep.ChangeRepository<SqlSugarRepository<SysPos>>().GetFirstAsync(u => u.Id == user.PosId);
         // 获取按钮集合
         var buttons = await _sysMenuService.GetOwnBtnPermList();
-        // 获取权限集合
+        // 获取角色集合
         var roleIds = await _sysUserRep.ChangeRepository<SqlSugarRepository<SysUserRole>>().AsQueryable()
             .Where(u => u.UserId == user.Id).Select(u => u.RoleId).ToListAsync();
 

+ 1 - 1
Admin.NET/Admin.NET.Core/Service/Job/DbJobPersistence.cs

@@ -195,4 +195,4 @@ public class DbJobPersistence : IJobPersistence
             await db.Insertable(jobTriggerRecord).ExecuteCommandAsync();
         }
     }
-}
+}

+ 5 - 8
Admin.NET/Admin.NET.Core/Service/Job/JobMonitor.cs

@@ -13,26 +13,23 @@ public class JobMonitor : IJobMonitor, IDisposable
 {
     private readonly IEventPublisher _eventPublisher;
     private readonly IServiceScope _serviceScope;
-    private readonly SysConfigService _sysConfigService; // 参数配置服务
+    private readonly SysConfigService _sysConfigService;
+
     public JobMonitor(IServiceScopeFactory scopeFactory)
     {
-
         _serviceScope = scopeFactory.CreateScope();
         _sysConfigService = _serviceScope.ServiceProvider.GetRequiredService<SysConfigService>();
         _eventPublisher = _serviceScope.ServiceProvider.GetRequiredService<IEventPublisher>(); ;
     }
 
-
-
     public async Task OnExecutedAsync(JobExecutedContext context, CancellationToken stoppingToken)
     {
+        // 将异常作业发送到邮件
         if (await _sysConfigService.GetConfigValue<bool>(CommonConst.SysErrorMail) && context.Exception != null)
         {
             var errorInfo = $"【{context.Trigger.Description}】出现错误:{context.Exception.InnerException}";
-            // 将异常日志发送到邮件
-            await _eventPublisher.PublishAsync(SysToDoEventConst.SendErrorMail, errorInfo);
+            await _eventPublisher.PublishAsync(CommonConst.SendErrorMail, errorInfo);
         }
-
     }
 
     public Task OnExecutingAsync(JobExecutingContext context, CancellationToken stoppingToken)
@@ -47,4 +44,4 @@ public class JobMonitor : IJobMonitor, IDisposable
     {
         _serviceScope.Dispose();
     }
-}
+}

+ 1 - 1
Admin.NET/Admin.NET.Web.Core/Startup.cs

@@ -52,7 +52,7 @@ public class Startup : AppStartup
         services.AddSchedule(options =>
         {
             options.AddPersistence<DbJobPersistence>(); // 添加作业持久化器
-            options.AddMonitor<JobMonitor>(); //添加作业执行监视器
+            options.AddMonitor<JobMonitor>(); // 添加作业执行监视器
         });
         // 脱敏检测
         services.AddSensitiveDetection();

+ 1 - 1
Admin.NET/Plugins/Admin.NET.Plugin.DingTalk/Job/SyncDingTalkUserJob.cs

@@ -26,7 +26,7 @@ public class SyncDingTalkUserJob : IJob
     {
         _scopeFactory = scopeFactory;
         _dingTalkApi = dingTalkApi;
-        _logger = loggerFactory.CreateLogger("System.Logging.LoggingMonitor");
+        _logger = loggerFactory.CreateLogger(CommonConst.SysLogCategoryName);
     }
 
     public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)

+ 1 - 1
Admin.NET/Plugins/Admin.NET.Plugin.ReZero/Admin.NET.Plugin.ReZero.csproj

@@ -24,7 +24,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Rezero.Api" Version="1.0.35" />
+    <PackageReference Include="Rezero.Api" Version="1.0.39" />
   </ItemGroup>  
 
   <ItemGroup>

+ 1 - 1
Admin.NET/Plugins/Admin.NET.Plugin.ReZero/Service/SuperApiAop.cs

@@ -102,7 +102,7 @@ public class SuperApiAop : DefaultSuperApiAop
             exception = aopContext.Exception == null ? null : JSON.Serialize(aopContext.Exception)
         });
 
-        var logger = App.GetRequiredService<ILoggerFactory>().CreateLogger("System.Logging.LoggingMonitor");
+        var logger = App.GetRequiredService<ILoggerFactory>().CreateLogger(CommonConst.SysLogCategoryName);
         using var scope = logger.ScopeContext(new Dictionary<object, object> {
             { "loggingMonitor", apiInfo.ToString() }
         });

+ 7 - 7
Web/package.json

@@ -61,24 +61,24 @@
 	"devDependencies": {
 		"@plugin-web-update-notification/vite": "^1.7.1",
 		"@types/lodash-es": "^4.17.12",
-		"@types/node": "^20.12.7",
+		"@types/node": "^20.12.8",
 		"@types/nprogress": "^0.2.3",
 		"@types/sortablejs": "^1.15.8",
-		"@typescript-eslint/eslint-plugin": "^7.7.1",
-		"@typescript-eslint/parser": "^7.7.1",
+		"@typescript-eslint/eslint-plugin": "^7.8.0",
+		"@typescript-eslint/parser": "^7.8.0",
 		"@vitejs/plugin-vue": "^5.0.4",
 		"@vitejs/plugin-vue-jsx": "^3.1.0",
 		"@vue/compiler-sfc": "^3.4.26",
 		"code-inspector-plugin": "^0.13.0",
-		"eslint": "^9.1.1",
+		"eslint": "^9.2.0",
 		"eslint-plugin-vue": "^9.25.0",
 		"less": "^4.2.0",
 		"prettier": "^3.2.5",
 		"rollup-plugin-visualizer": "^5.12.0",
-		"sass": "^1.75.0",
-		"terser": "^5.30.4",
+		"sass": "^1.76.0",
+		"terser": "^5.31.0",
 		"typescript": "^5.4.5",
-		"vite": "^5.2.10",
+		"vite": "^5.2.11",
 		"vite-plugin-cdn-import": "^1.0.1",
 		"vite-plugin-compression2": "^1.1.0",
 		"vite-plugin-vue-setup-extend-plus": "^0.1.0",

+ 64 - 53
Web/src/views/login/component/account.vue

@@ -1,61 +1,62 @@
 <template>
 	<el-tooltip :visible="state.capsLockVisible" effect="light" content="大写锁定已打开" placement="top">
-	<el-form ref="ruleFormRef" :model="state.ruleForm" size="large" :rules="state.rules" class="login-content-form">
-		<el-form-item class="login-animation1" prop="account">
-			<el-input ref="accountRef" text placeholder="请输入账号" v-model="state.ruleForm.account" clearable autocomplete="off" @keyup.enter.native="handleSignIn">
-				<template #prefix>
-					<el-icon>
-						<ele-User />
-					</el-icon>
-				</template>
-			</el-input>
-		</el-form-item>
-		<el-form-item class="login-animation2" prop="password">
-			<el-input ref="passwordRef" :type="state.isShowPassword ? 'text' : 'password'" placeholder="请输入密码" v-model="state.ruleForm.password" autocomplete="off" @keyup.enter.native="handleSignIn">
-				<template #prefix>
-					<el-icon>
-						<ele-Unlock />
-					</el-icon>
-				</template>
-				<template #suffix>
-					<i class="iconfont el-input__icon login-content-password" :class="state.isShowPassword ? 'icon-yincangmima' : 'icon-xianshimima'" @click="state.isShowPassword = !state.isShowPassword"> </i>
-				</template>
-			</el-input>
-		</el-form-item>
-		<el-form-item class="login-animation3" prop="captcha" v-if="state.captchaEnabled">
-			<el-col :span="15">
-				<el-input
-					ref="codeRef"
-					text
-					maxlength="4"
-					:placeholder="$t('message.account.accountPlaceholder3')"
-					v-model="state.ruleForm.code"
-					clearable
-					autocomplete="off"
-					@keyup.enter.native="handleSignIn"
-				>
+		<el-form ref="ruleFormRef" :model="state.ruleForm" size="large" :rules="state.rules" class="login-content-form">
+			<el-form-item class="login-animation1" prop="account">
+				<el-input ref="accountRef" text placeholder="请输入账号" v-model="state.ruleForm.account" clearable autocomplete="off" @keyup.enter.native="handleSignIn">
 					<template #prefix>
 						<el-icon>
-							<ele-Position />
+							<ele-User />
 						</el-icon>
 					</template>
 				</el-input>
-			</el-col>
-			<el-col :span="1"></el-col>
-			<el-col :span="8">
-				<div class="login-content-code">
-					<img class="login-content-code-img" @click="getCaptcha" width="130px" height="38px" :src="state.captchaImage" style="cursor: pointer" />
-				</div>
-			</el-col>
-		</el-form-item>
-		<el-form-item class="login-animation4">
-			<el-button type="primary" class="login-content-submit" round v-waves @click="handleSignIn" :loading="state.loading.signIn">
-				<span>{{ $t('message.account.accountBtnText') }}</span>
-			</el-button>
-		</el-form-item>
-		<div class="font12 mt30 login-animation4 login-msg">{{ $t('message.mobile.msgText') }}</div>
-		<!-- <el-button type="primary" round v-waves @click="weixinSignIn" :loading="state.loading.signIn"></el-button> -->
-	</el-form>
+			</el-form-item>
+			<el-form-item class="login-animation2" prop="password">
+				<el-input ref="passwordRef" :type="state.isShowPassword ? 'text' : 'password'" placeholder="请输入密码" v-model="state.ruleForm.password" autocomplete="off" @keyup.enter.native="handleSignIn">
+					<template #prefix>
+						<el-icon>
+							<ele-Unlock />
+						</el-icon>
+					</template>
+					<template #suffix>
+						<i class="iconfont el-input__icon login-content-password" :class="state.isShowPassword ? 'icon-yincangmima' : 'icon-xianshimima'" @click="state.isShowPassword = !state.isShowPassword">
+						</i>
+					</template>
+				</el-input>
+			</el-form-item>
+			<el-form-item class="login-animation3" prop="captcha" v-if="state.captchaEnabled">
+				<el-col :span="15">
+					<el-input
+						ref="codeRef"
+						text
+						maxlength="4"
+						:placeholder="$t('message.account.accountPlaceholder3')"
+						v-model="state.ruleForm.code"
+						clearable
+						autocomplete="off"
+						@keyup.enter.native="handleSignIn"
+					>
+						<template #prefix>
+							<el-icon>
+								<ele-Position />
+							</el-icon>
+						</template>
+					</el-input>
+				</el-col>
+				<el-col :span="1"></el-col>
+				<el-col :span="8">
+					<div class="login-content-code">
+						<img class="login-content-code-img" @click="getCaptcha" width="130px" height="38px" :src="state.captchaImage" style="cursor: pointer" />
+					</div>
+				</el-col>
+			</el-form-item>
+			<el-form-item class="login-animation4">
+				<el-button type="primary" class="login-content-submit" round v-waves @click="handleSignIn" :loading="state.loading.signIn">
+					<span>{{ $t('message.account.accountBtnText') }}</span>
+				</el-button>
+			</el-form-item>
+			<div class="font12 mt30 login-animation4 login-msg">{{ $t('message.mobile.msgText') }}</div>
+			<!-- <el-button type="primary" round v-waves @click="weixinSignIn" :loading="state.loading.signIn"></el-button> -->
+		</el-form>
 	</el-tooltip>
 	<div class="dialog-header">
 		<el-dialog v-model="state.rotateVerifyVisible" :show-close="false">
@@ -125,6 +126,7 @@ const state = reactive({
 	isPassRotate: false,
 	capsLockVisible: false,
 });
+
 onMounted(async () => {
 	// 若URL带有Token参数(第三方登录)
 	var accessToken = route.query.token;
@@ -136,14 +138,19 @@ onMounted(async () => {
 	var res1 = await getAPI(SysAuthApi).apiSysAuthLoginConfigGet();
 	state.secondVerEnabled = res1.data.result.secondVerEnabled ?? true;
 	state.captchaEnabled = res1.data.result.captchaEnabled ?? true;
+
+	// 获取验证码
 	getCaptcha();
-	// Caps Lock检测
+
+	// 检测大小写按键/CapsLK
 	document.addEventListener('keyup', handleKeyPress);
 });
+
 onUnmounted(() => {
 	document.removeEventListener('keyup', handleKeyPress);
 });
-const handleKeyPress = (e:any) => {
+
+const handleKeyPress = (e: any) => {
 	const isCapsLockOn = e.getModifierState('CapsLock');
 	state.capsLockVisible = isCapsLockOn;
 };
@@ -157,10 +164,12 @@ const getCaptcha = async () => {
 	state.captchaImage = 'data:text/html;base64,' + res.data.result?.img;
 	state.ruleForm.codeId = res.data.result?.id;
 };
+
 // 获取时间
 const currentTime = computed(() => {
 	return formatAxis(new Date());
 });
+
 // 登录
 const onSignIn = async () => {
 	ruleFormRef.value.validate(async (valid: boolean) => {
@@ -228,12 +237,14 @@ const signInSuccess = (isNoPower: boolean | undefined) => {
 		NextLoading.start();
 	}
 };
+
 // 打开旋转验证
 const openRotateVerify = () => {
 	state.rotateVerifyVisible = true;
 	state.isPassRotate = false;
 	dragRef.value?.reset();
 };
+
 // 通过旋转验证
 const passRotateVerify = () => {
 	state.rotateVerifyVisible = false;