diff --git a/.gitignore b/.gitignore index 89d8631b..c01ac3e2 100644 --- a/.gitignore +++ b/.gitignore @@ -275,3 +275,4 @@ database_backup /Yi.Abp.Net8/src/Yi.Abp.Web/logs/ /Yi.Abp.Net8/src/Yi.Abp.Web/yi-abp-dev.db +package-lock.json diff --git a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/YiFrameworkSqlSugarCoreModule.cs b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/YiFrameworkSqlSugarCoreModule.cs index 7cc138ac..4d83a783 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/YiFrameworkSqlSugarCoreModule.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/YiFrameworkSqlSugarCoreModule.cs @@ -9,6 +9,7 @@ using SqlSugar; using Volo.Abp.Data; using Volo.Abp.Domain; using Volo.Abp.Domain.Repositories; +using Volo.Abp.Guids; using Yi.Framework.SqlSugarCore.Abstractions; using Yi.Framework.SqlSugarCore.Repositories; using Yi.Framework.SqlSugarCore.Uow; @@ -24,7 +25,32 @@ namespace Yi.Framework.SqlSugarCore var configuration = service.GetConfiguration(); var section = configuration.GetSection("DbConnOptions"); Configure(section); + var dbConnOptions = new DbConnOptions(); + section.Bind(dbConnOptions); + //很多人遗漏了这一点,不同的数据库,对于主键的使用规约不一样,需要根据数据库进行判断 + SequentialGuidType guidType; + switch (dbConnOptions.DbType) + { + case DbType.MySql: + case DbType.PostgreSQL: + guidType= SequentialGuidType.SequentialAsString; + break; + case DbType.SqlServer: + guidType = SequentialGuidType.SequentialAtEnd; + break; + case DbType.Oracle: + guidType = SequentialGuidType.SequentialAsBinary; + break; + default: + guidType = SequentialGuidType.SequentialAtEnd; + break; + } + Configure(options => + { + options.DefaultSequentialGuidType = guidType; + }); + service.TryAddScoped(); //不开放sqlsugarClient diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Operlog/OperLogGlobalAttribute.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Operlog/OperLogGlobalAttribute.cs index a2f0ac0c..3fe445b7 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Operlog/OperLogGlobalAttribute.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Domain/Operlog/OperLogGlobalAttribute.cs @@ -6,6 +6,7 @@ using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; +using Volo.Abp.Uow; using Volo.Abp.Users; using Yi.Framework.Core.Extensions; using Yi.Framework.Core.Helper; @@ -18,12 +19,15 @@ namespace Yi.Framework.Rbac.Domain.Operlog private ILogger _logger; private IRepository _repository; private ICurrentUser _currentUser; + + private IUnitOfWorkManager _unitOfWorkManager; //注入一个日志服务 - public OperLogGlobalAttribute(ILogger logger, IRepository repository, ICurrentUser currentUser) + public OperLogGlobalAttribute(ILogger logger, IRepository repository, ICurrentUser currentUser, IUnitOfWorkManager unitOfWorkManager) { _logger = logger; _repository = repository; _currentUser = currentUser; + _unitOfWorkManager = unitOfWorkManager; } public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) @@ -35,8 +39,9 @@ namespace Yi.Framework.Rbac.Domain.Operlog if (resultContext.ActionDescriptor is not ControllerActionDescriptor controllerActionDescriptor) return; //查找标签,获取标签对象 - OperLogAttribute? operLogAttribute = controllerActionDescriptor.MethodInfo.GetCustomAttributes(inherit: true) - .FirstOrDefault(a => a.GetType().Equals(typeof(OperLogAttribute))) as OperLogAttribute; + OperLogAttribute? operLogAttribute = controllerActionDescriptor.MethodInfo + .GetCustomAttributes(inherit: true) + .FirstOrDefault(a => a.GetType().Equals(typeof(OperLogAttribute))) as OperLogAttribute; //空对象直接返回 if (operLogAttribute is null) return; @@ -48,7 +53,7 @@ namespace Yi.Framework.Rbac.Domain.Operlog //获取Ip string ip = resultContext.HttpContext.GetClientIp(); - //根据ip获取地址 + //根据ip获取地址 string location = ""; try { @@ -78,6 +83,7 @@ namespace Yi.Framework.Rbac.Domain.Operlog { logEntity.RequestResult = result.Content?.Replace("\r\n", "").Trim(); } + if (resultContext.Result is JsonResult result2) { logEntity.RequestResult = result2.Value?.ToString(); @@ -92,14 +98,13 @@ namespace Yi.Framework.Rbac.Domain.Operlog if (operLogAttribute.IsSaveRequestData) { - //不建议保存,吃性能 - //保存请求参数 logEntity.RequestParam = JsonConvert.SerializeObject(context.ActionArguments); } - await _repository.InsertAsync(logEntity); - - + using (var uow = _unitOfWorkManager.Begin()) + { + await _repository.InsertAsync(logEntity); + } } } diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Dockerfile b/Yi.Abp.Net8/src/Yi.Abp.Web/Dockerfile index 91301637..21592fb0 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Dockerfile +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/Dockerfile @@ -8,6 +8,8 @@ EXPOSE 8080 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src + +COPY ./common.props ./ COPY ["src/Yi.Abp.Web/Yi.Abp.Web.csproj", "src/Yi.Abp.Web/"] COPY ["framework/Yi.Framework.AspNetCore.Authentication.OAuth/Yi.Framework.AspNetCore.Authentication.OAuth.csproj", "framework/Yi.Framework.AspNetCore.Authentication.OAuth/"] COPY ["framework/Yi.Framework.AspNetCore/Yi.Framework.AspNetCore.csproj", "framework/Yi.Framework.AspNetCore/"] diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/README-DOCKER-BUILD.md b/Yi.Abp.Net8/src/Yi.Abp.Web/README-DOCKER-BUILD.md new file mode 100644 index 00000000..5589c57c --- /dev/null +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/README-DOCKER-BUILD.md @@ -0,0 +1,22 @@ +# Docker 构建说明 + +## 执行命令 + +```shell +# 在Yi.Abp.Net8 目录下执行 +docker build -t admin-server:${BUILD_NUMBER} -f ./src/Yi.Abp.Web/Dockerfile . + +``` + +## 注意 + +NuGet 源国内访问有时候会报错,可以考虑切换成华为源,加上参数 + +```shell +RUN dotnet restore --source https://repo.huaweicloud.com/repository/nuget/v3/index.json "./src/Yi.Abp.Web/./Yi.Abp.Web.csproj" + +RUN dotnet build --source https://repo.huaweicloud.com/repository/nuget/v3/index.json "./Yi.Abp.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build + +RUN dotnet publish --source https://repo.huaweicloud.com/repository/nuget/v3/index.json "./Yi.Abp.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +``` \ No newline at end of file diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Yi.Abp.Web.csproj b/Yi.Abp.Net8/src/Yi.Abp.Web/Yi.Abp.Web.csproj index 2623b61f..5be942ee 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Yi.Abp.Web.csproj +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/Yi.Abp.Web.csproj @@ -10,6 +10,10 @@ + + + + diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs index e559c957..50bc5d5b 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using System.Text; using System.Text.Json.Serialization; using System.Text.Json.Serialization.Metadata; @@ -103,10 +103,10 @@ namespace Yi.Abp.Web var service = context.Services; //请求日志 - Configure(optios => + Configure(options => { //默认关闭,开启会有大量的审计日志 - optios.IsEnabled = true; + options.IsEnabled = true; }); //忽略审计日志路径 Configure(options => diff --git a/Yi.Pure.Vue3/src/store/modules/user.ts b/Yi.Pure.Vue3/src/store/modules/user.ts index e5f10379..8c389d9d 100644 --- a/Yi.Pure.Vue3/src/store/modules/user.ts +++ b/Yi.Pure.Vue3/src/store/modules/user.ts @@ -94,6 +94,7 @@ export const useUserStore = defineStore({ storeData.avatar = resInfo.data.user.icon; storeData.nickname = resInfo.data.user.nick; storeData.roles = resInfo.data.roleCodes; + storeData.permissions = resInfo.data.permissions; setToken(storeData); resolve(resInfo); }); diff --git a/Yi.Pure.Vue3/src/views/system/config/form.vue b/Yi.Pure.Vue3/src/views/system/config/form.vue index 7ffe926d..e8eb515e 100644 --- a/Yi.Pure.Vue3/src/views/system/config/form.vue +++ b/Yi.Pure.Vue3/src/views/system/config/form.vue @@ -12,7 +12,8 @@ const props = withDefaults(defineProps(), { configValue: "", configKey: "", configType: "", - remark: "" + remark: "", + creationTime: "" }) }); const ruleFormRef = ref(); @@ -28,38 +29,62 @@ defineExpose({ getRef });