From 5b8a7043b39853e2a533273fc051fd1a11b8b02c Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期五, 01 八月 2025 14:28:30 +0800 Subject: [PATCH] fix:修复日志目录被git屏蔽 --- FlexJobApi.User.Application/Menus/Queries/MenuAllQueryHandler.cs | 2 FlexJobApi.Core/Entities/LogRecord/WebApiLog.cs | 58 +++++++++ .dockerignore | 30 +++++ FlexJobApi.Web.Entry/Dockerfile | 35 +++++ FlexJobApi.Core/Entities/LogRecord/DbAuditLog.cs | 42 +++++++ FlexJobApi.Core/Entities/LogRecord/ConsoleLog.cs | 47 +++++++ FlexJobApi.Core/Entities/LogRecord/QueueLog.cs | 43 +++++++ FlexJobApi.Core/Entities/LogRecord/SmsLog.cs | 49 ++++++++ FlexJobApi.Core/Entities/LogRecord/ExceptionLog.cs | 37 ++++++ 9 files changed, 342 insertions(+), 1 deletions(-) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fe1152b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,30 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md +!**/.gitignore +!.git/HEAD +!.git/config +!.git/packed-refs +!.git/refs/heads/** \ No newline at end of file diff --git a/FlexJobApi.Core/Entities/LogRecord/ConsoleLog.cs b/FlexJobApi.Core/Entities/LogRecord/ConsoleLog.cs new file mode 100644 index 0000000..269fc3b --- /dev/null +++ b/FlexJobApi.Core/Entities/LogRecord/ConsoleLog.cs @@ -0,0 +1,47 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlexJobApi.Core +{ + /// <summary> + /// 鎺у埗鍙版棩蹇� + /// </summary> + public class ConsoleLog : CommonEntity<LogDbContextLocator>, IDbAuditLogIgnore + { + /// <summary> + /// 閫氶亾 + /// </summary> + public EnumConsoleLogAccess Access { get; set; } + + /// <summary> + /// 绾у埆 + /// </summary> + public EnumLogLevel Level { get; set; } + + /// <summary> + /// 鍐呭 + /// </summary> + [Required] + public string Content { get; set; } + + /// <summary> + /// 鍫嗘爤璺熻釜 + /// </summary> + public string StackTrace { get; set; } + + /// <summary> + /// 閾炬帴鍦板潃 + /// </summary> + public string Url { get; set; } + + /// <summary> + /// 瀹㈡埛IP鍦板潃 + /// </summary> + [MaxLength(32)] + public string ClientIpAddress { get; set; } + } +} diff --git a/FlexJobApi.Core/Entities/LogRecord/DbAuditLog.cs b/FlexJobApi.Core/Entities/LogRecord/DbAuditLog.cs new file mode 100644 index 0000000..0c2c8b3 --- /dev/null +++ b/FlexJobApi.Core/Entities/LogRecord/DbAuditLog.cs @@ -0,0 +1,42 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlexJobApi.Core +{ + /// <summary> + /// 鏁版嵁搴撳璁℃棩蹇� + /// </summary> + public class DbAuditLog : CommonEntity<LogDbContextLocator>, IDbAuditLogIgnore + { + /// <summary> + /// 琛ㄥ悕 + /// </summary> + [MaxLength(128)] + [Required] + public string TableName { get; set; } + + /// <summary> + /// 涓婚敭 + /// </summary> + public Guid PrimaryKey { get; set; } + + /// <summary> + /// 鎿嶄綔 + /// </summary> + public EnumDbAuditOperate Operate { get; set; } + + /// <summary> + /// 鏃у�� + /// </summary> + public string OldValues { get; set; } + + /// <summary> + /// 鏂板�� + /// </summary> + public string NewValues { get; set; } + } +} diff --git a/FlexJobApi.Core/Entities/LogRecord/ExceptionLog.cs b/FlexJobApi.Core/Entities/LogRecord/ExceptionLog.cs new file mode 100644 index 0000000..7c15ae2 --- /dev/null +++ b/FlexJobApi.Core/Entities/LogRecord/ExceptionLog.cs @@ -0,0 +1,37 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlexJobApi.Core +{ + /// <summary> + /// 寮傚父鏃ュ織 + /// </summary> + public class ExceptionLog : CommonEntity<LogDbContextLocator>, IDbAuditLogIgnore + { + /// <summary> + /// 绫诲瀷 + /// </summary> + [MaxLength(256)] + public string Type { get; set; } + + /// <summary> + /// 浠g爜 + /// </summary> + [MaxLength(32)] + public string Code { get; set; } + + /// <summary> + /// 娑堟伅 + /// </summary> + public string Message { get; set; } + + /// <summary> + /// 鍫嗘爤璺熻釜 + /// </summary> + public string StackTrace { get; set; } + } +} diff --git a/FlexJobApi.Core/Entities/LogRecord/QueueLog.cs b/FlexJobApi.Core/Entities/LogRecord/QueueLog.cs new file mode 100644 index 0000000..99a830a --- /dev/null +++ b/FlexJobApi.Core/Entities/LogRecord/QueueLog.cs @@ -0,0 +1,43 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlexJobApi.Core +{ + /// <summary> + /// 娑堟伅闃熷垪鏃ュ織 + /// </summary> + public class QueueLog : CommonEntity<LogDbContextLocator>, IDbAuditLogIgnore + { + /// <summary> + /// 閫氶亾 + /// </summary> + public EnumQueueAccess Access { get; set; } + + /// <summary> + /// 浜嬩欢Id + /// </summary> + [MaxLength(128)] + [Required] + public string EventId { get; set; } + + /// <summary> + /// 鏁版嵁 + /// </summary> + [Required] + public string Data { get; set; } + + /// <summary> + /// 娑堟伅鏄惁鍙秷璐逛竴娆� + /// </summary> + public bool IsConsumOnce { get; set; } + + /// <summary> + /// 鑰楁椂姣鏁� + /// </summary> + public long ElapsedMilliseconds { get; set; } + } +} diff --git a/FlexJobApi.Core/Entities/LogRecord/SmsLog.cs b/FlexJobApi.Core/Entities/LogRecord/SmsLog.cs new file mode 100644 index 0000000..30a3d85 --- /dev/null +++ b/FlexJobApi.Core/Entities/LogRecord/SmsLog.cs @@ -0,0 +1,49 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlexJobApi.Core +{ + /// <summary> + /// 鐭俊鏃ュ織 + /// </summary> + public class SmsLog : CommonEntity<LogDbContextLocator>, IDbAuditLogIgnore + { + /// <summary> + /// 閫氶亾 + /// </summary> + public EnumSmsAccess Access { get; set; } + + /// <summary> + /// 鎵嬫満鍙风爜 + /// </summary> + [MaxLength(11)] + [Required] + public string PhoneNumber { get; set; } + + /// <summary> + /// 妯℃澘浠g爜 + /// </summary> + [MaxLength(128)] + [Required] + public string TemplateCode { get; set; } + + /// <summary> + /// 妯℃澘鍙傛暟 + /// </summary> + public string TemplateParam { get; set; } + + /// <summary> + /// 鏈夋晥鏈� + /// </summary> + public DateTime? Expiry { get; set; } + + /// <summary> + /// 鏄惁浣跨敤 + /// </summary> + public bool IsUsed { get; set; } + } +} diff --git a/FlexJobApi.Core/Entities/LogRecord/WebApiLog.cs b/FlexJobApi.Core/Entities/LogRecord/WebApiLog.cs new file mode 100644 index 0000000..6d478c7 --- /dev/null +++ b/FlexJobApi.Core/Entities/LogRecord/WebApiLog.cs @@ -0,0 +1,58 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlexJobApi.Core.Entities.Common +{ + /// <summary> + /// 鎺ュ彛鏃ュ織 + /// </summary> + public class WebApiLog : CommonEntity<LogDbContextLocator>, IDbAuditLogIgnore + { + /// <summary> + /// 閾炬帴鍦板潃 + /// </summary> + [Required] + public string Url { get; set; } + + /// <summary> + /// 璇锋眰鏂瑰紡 + /// </summary> + [Required] + [MaxLength(6)] + public string Method { get; set; } + + /// <summary> + /// 璇锋眰澶� + /// </summary> + public string Headers { get; set; } + + /// <summary> + /// 璇锋眰鍙傛暟 + /// </summary> + public string Request { get; set; } + + /// <summary> + /// 鍥炶皟鏁版嵁 + /// </summary> + public string Callback { get; set; } + + /// <summary> + /// 鏄惁鎴愬姛 + /// </summary> + public bool IsSuccess { get; set; } + + /// <summary> + /// 瀹㈡埛绔疘P鍦板潃 + /// </summary> + public string ClientIpAddress { get; set; } + + /// <summary> + /// 鑰楁椂姣鏁� + /// </summary> + public long ElapsedMilliseconds { get; set; } + } +} diff --git a/FlexJobApi.User.Application/Menus/Queries/MenuAllQueryHandler.cs b/FlexJobApi.User.Application/Menus/Queries/MenuAllQueryHandler.cs index 7a6011d..7ce7492 100644 --- a/FlexJobApi.User.Application/Menus/Queries/MenuAllQueryHandler.cs +++ b/FlexJobApi.User.Application/Menus/Queries/MenuAllQueryHandler.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -锛氾細 + namespace FlexJobApi.User.Application { //public class MenuAllQueryHandler:IRequestHandler<MenuAllQuery, > diff --git a/FlexJobApi.Web.Entry/Dockerfile b/FlexJobApi.Web.Entry/Dockerfile new file mode 100644 index 0000000..4e898db --- /dev/null +++ b/FlexJobApi.Web.Entry/Dockerfile @@ -0,0 +1,35 @@ +# 璇峰弬闃� https://aka.ms/customizecontainer 浠ヤ簡瑙e浣曡嚜瀹氫箟璋冭瘯瀹瑰櫒锛屼互鍙� Visual Studio 濡備綍浣跨敤姝� Dockerfile 鐢熸垚鏄犲儚浠ユ洿蹇湴杩涜璋冭瘯銆� + +# 姝ら樁娈电敤浜庡湪蹇�熸ā寮�(榛樿涓鸿皟璇曢厤缃�)涓嬩粠 VS 杩愯鏃� +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + + +# 姝ら樁娈电敤浜庣敓鎴愭湇鍔¢」鐩� +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["FlexJobApi.Web.Entry/FlexJobApi.Web.Entry.csproj", "FlexJobApi.Web.Entry/"] +COPY ["FlexJobApi.Application/FlexJobApi.Application.csproj", "FlexJobApi.Application/"] +COPY ["FlexJobApi.Core/FlexJobApi.Core.csproj", "FlexJobApi.Core/"] +COPY ["FlexJobApi.Database.Migrations/FlexJobApi.Database.Migrations.csproj", "FlexJobApi.Database.Migrations/"] +COPY ["FlexJobApi.EntityFramework.Core/FlexJobApi.EntityFramework.Core.csproj", "FlexJobApi.EntityFramework.Core/"] +COPY ["FlexJobApi.User.Application/FlexJobApi.User.Application.csproj", "FlexJobApi.User.Application/"] +RUN dotnet restore "./FlexJobApi.Web.Entry/FlexJobApi.Web.Entry.csproj" +COPY . . +WORKDIR "/src/FlexJobApi.Web.Entry" +RUN dotnet build "./FlexJobApi.Web.Entry.csproj" -c $BUILD_CONFIGURATION -o /app/build + +# 姝ら樁娈电敤浜庡彂甯冭澶嶅埗鍒版渶缁堥樁娈电殑鏈嶅姟椤圭洰 +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./FlexJobApi.Web.Entry.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +# 姝ら樁娈靛湪鐢熶骇涓娇鐢紝鎴栧湪甯歌妯″紡涓嬩粠 VS 杩愯鏃朵娇鐢�(鍦ㄤ笉浣跨敤璋冭瘯閰嶇疆鏃朵负榛樿鍊�) +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "FlexJobApi.Web.Entry.dll"] \ No newline at end of file -- Gitblit v1.9.1