BD.FeishuSDK.Approval 1.0.1-dev6

This is a prerelease version of BD.FeishuSDK.Approval.
dotnet add package BD.FeishuSDK.Approval --version 1.0.1-dev6
                    
NuGet\Install-Package BD.FeishuSDK.Approval -Version 1.0.1-dev6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BD.FeishuSDK.Approval" Version="1.0.1-dev6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BD.FeishuSDK.Approval" Version="1.0.1-dev6" />
                    
Directory.Packages.props
<PackageReference Include="BD.FeishuSDK.Approval" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BD.FeishuSDK.Approval --version 1.0.1-dev6
                    
#r "nuget: BD.FeishuSDK.Approval, 1.0.1-dev6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BD.FeishuSDK.Approval@1.0.1-dev6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BD.FeishuSDK.Approval&version=1.0.1-dev6&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=BD.FeishuSDK.Approval&version=1.0.1-dev6&prerelease
                    
Install as a Cake Tool

BD.FeishuSDK.Approval

NuGet License: MIT .NET

极简的飞书审批集成方案 - 三步完成企业级审批系统搭建

为什么选择我们?

容易配置 - 三行代码完成集成,无复杂配置
结构清晰 - 请求类 + 处理器,业务逻辑一目了然
界面操作 - 开箱即用的管理界面,无需前端开发

三分钟上手

1. 安装包

dotnet add package BD.FeishuSDK.Approval

2. 注册服务

var builder = WebApplication.CreateBuilder(args);

// 一行代码集成飞书审批
builder.Services.AddFeishuApproval("Data Source=app.db", "sqlite");

var app = builder.Build();
app.MapControllers();
app.MapFeishuDashboardV2(); // 管理界面

app.Run();

3. 定义审批流程

请求类 - 定义表单字段:

[ApprovalCode("your-approval-code")]
public class LeaveRequest : FeishuApprovalRequestBase
{
    [JsonPropertyName("widget_name")]
    public string Name { get; set; }
    
    [JsonPropertyName("widget_days")]
    public int Days { get; set; }
}

处理器 - 实现业务逻辑:

public class LeaveHandler : ApprovalHandlerBase<LeaveRequest>
{
    public override async Task HandleApprovalApprovedAsync(ApprovalContext<LeaveRequest> context)
    {
        // 审批通过 - 你的业务逻辑
        var request = context.FormData;
        await UpdateLeaveStatus(request.Name, "approved");
    }

    public override async Task HandleApprovalRejectedAsync(ApprovalContext<LeaveRequest> context)
    {
        // 审批拒绝 - 你的业务逻辑
        await UpdateLeaveStatus(context.FormData.Name, "rejected");
    }
}

就这么简单! 访问 /feishu 进入管理界面,系统自动处理所有底层细节。

文件布局

清晰的项目结构,易于理解和维护:

你的项目/
├── FeishuApprovals/
│   └── LeaveRequests          
│       └── LeaveRequest.cs          # 审批请求类
│       └── LeaveRequest.cs          # 审批处理器
│   └── OtherRequests          
│       └── OtherRequest.cs          # 审批请求类
│       └── OtherRequest.cs          # 审批处理器
│
└── Program.cs                   # 三行代码完成集成

核心特性

🎯 极简 API

// 发起审批 - 一行代码
await approvalService.CreateAsync(new LeaveRequest { Name = "张三", Days = 3 });

// 批量操作
await batchService.CreateManyAsync(requests);

// 健康检查
var health = await healthService.CheckAsync();

🗄️ 多数据库支持

// 自动检测数据库类型
services.AddFeishuApprovalWithAutoDetectDb(connectionString);

// 或手动指定
services.AddFeishuApprovalWithMySql(connectionString);
services.AddFeishuApprovalWithSqlServer(connectionString);
services.AddFeishuApprovalWithPostgreSql(connectionString);
services.AddFeishuApprovalWithSQLite(connectionString);

🎨 管理界面

内置美观的管理界面,支持:

  • 📊 系统概览和统计
  • ⚙️ 飞书应用配置
  • 📋 审批实例管理
  • 🔍 健康状态监控
  • 📝 实时日志查看
  • 🛠️ 代码自动生成
// 使用默认界面
app.MapFeishuDashboardV2();

// 自定义界面模板
builder.Services.AddFeishuDashboardTemplatesForDevelopment("./templates");

生产环境配置

安全配置

builder.Services.AddFeishuApproval(connectionString, "mysql", options =>
{
    options.AppId = Environment.GetEnvironmentVariable("FEISHU_APP_ID");
    options.AppSecret = Environment.GetEnvironmentVariable("FEISHU_APP_SECRET");
    options.EncryptKey = Environment.GetEnvironmentVariable("FEISHU_ENCRYPT_KEY");
    options.VerificationToken = Environment.GetEnvironmentVariable("FEISHU_VERIFICATION_TOKEN");
});

性能优化

// 生产环境模板配置
builder.Services.AddFeishuDashboardTemplatesForProduction();

// 启用请求/响应日志
options.EnableRequestLogging = true;
options.EnableResponseLogging = true;

完整示例

查看 samples/FeishuApproval.SampleWeb 获取完整的示例项目,包含:

  • 完整的请假审批流程
  • 自定义验证和业务逻辑
  • 管理界面集成
  • 数据库配置

文档

许可证

MIT License - 详见 LICENSE

支持


⭐ 如果这个项目对你有帮助,请给一个 Star!

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1-dev6 118 9/8/2025
1.0.1-dev5 121 9/8/2025
1.0.1-dev4 116 9/8/2025
1.0.1-dev3 118 9/8/2025
1.0.1-dev2 288 9/8/2025

## 为什么选择我们?

✅ **容易配置** - 三行代码完成集成,无复杂配置  
✅ **结构清晰** - 请求类 + 处理器,业务逻辑一目了然  
✅ **界面操作** - 开箱即用的管理界面,无需前端开发