sunpengfei
2025-08-01 5b8a7043b39853e2a533273fc051fd1a11b8b02c
fix:修复日志目录被git屏蔽
8个文件已添加
1个文件已修改
343 ■■■■■ 已修改文件
.dockerignore 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Entities/LogRecord/ConsoleLog.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Entities/LogRecord/DbAuditLog.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Entities/LogRecord/ExceptionLog.cs 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Entities/LogRecord/QueueLog.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Entities/LogRecord/SmsLog.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Core/Entities/LogRecord/WebApiLog.cs 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.User.Application/Menus/Queries/MenuAllQueryHandler.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
FlexJobApi.Web.Entry/Dockerfile 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.dockerignore
New file
@@ -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/**
FlexJobApi.Core/Entities/LogRecord/ConsoleLog.cs
New file
@@ -0,0 +1,47 @@
using 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; }
    }
}
FlexJobApi.Core/Entities/LogRecord/DbAuditLog.cs
New file
@@ -0,0 +1,42 @@
using 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; }
    }
}
FlexJobApi.Core/Entities/LogRecord/ExceptionLog.cs
New file
@@ -0,0 +1,37 @@
using 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>
        /// 代码
        /// </summary>
        [MaxLength(32)]
        public string Code { get; set; }
        /// <summary>
        /// 消息
        /// </summary>
        public string Message { get; set; }
        /// <summary>
        /// 堆栈跟踪
        /// </summary>
        public string StackTrace { get; set; }
    }
}
FlexJobApi.Core/Entities/LogRecord/QueueLog.cs
New file
@@ -0,0 +1,43 @@
using 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; }
    }
}
FlexJobApi.Core/Entities/LogRecord/SmsLog.cs
New file
@@ -0,0 +1,49 @@
using 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>
        /// 模板代码
        /// </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; }
    }
}
FlexJobApi.Core/Entities/LogRecord/WebApiLog.cs
New file
@@ -0,0 +1,58 @@
using 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>
        /// 客户端IP地址
        /// </summary>
        public string ClientIpAddress { get; set; }
        /// <summary>
        /// 耗时毫秒数
        /// </summary>
        public long ElapsedMilliseconds { get; set; }
    }
}
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, >
FlexJobApi.Web.Entry/Dockerfile
New file
@@ -0,0 +1,35 @@
# 请参阅 https://aka.ms/customizecontainer 以了解如何自定义调试容器,以及 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"]