Bitzsoft.Integrations.Express.All 1.0.1

dotnet add package Bitzsoft.Integrations.Express.All --version 1.0.1
                    
NuGet\Install-Package Bitzsoft.Integrations.Express.All -Version 1.0.1
                    
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="Bitzsoft.Integrations.Express.All" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Express.All" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.Express.All" />
                    
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 Bitzsoft.Integrations.Express.All --version 1.0.1
                    
#r "nuget: Bitzsoft.Integrations.Express.All, 1.0.1"
                    
#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 Bitzsoft.Integrations.Express.All@1.0.1
                    
#: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=Bitzsoft.Integrations.Express.All&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.Express.All&version=1.0.1
                    
Install as a Cake Tool

Bitzsoft.Integrations.Express.All

快递物流服务聚合包 -- 一次安装包含所有供应商实现,按配置自动注册。

功能特性

  • 一次安装包含全部 7 家快递物流供应商实现,无需逐包引用
  • 按配置节自动注册供应商,未配置的子节不会加载(避免多余 HTTP 客户端)
  • 支持混合使用多个供应商(如快递鸟查询 + 顺丰函证通寄递)
  • IExpressProviderISfLegalDocumentProvider 独立注册,互不冲突
  • 各供应商共享统一的接口契约与模型,详见抽象包 Express

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.Express.All

PackageReference

<PackageReference Include="Bitzsoft.Integrations.Express.All" Version="1.0.0" />

配置

appsettings.json

{
  "Express": {
    "Kdniao": {
      "EBusinessId": "你的商户ID",
      "AppKey": "你的应用密钥"
    },
    "Kuaidi100": {
      "Key": "你的授权码",
      "Customer": "你的顾客编码"
    },
    "SfLegal": {
      "MonthlyCardNo": "你的月结卡号",
      "CustomerCode": "你的顾客编码",
      "CheckWord": "你的校验码"
    },
    "ChinaPost": {
      "SenderNo": "协议客户号",
      "Authorization": "测试或生产授权码"
    },
    "Cainiao": {
      "AppKey": "菜鸟提供的对接码",
      "AppSecret": "双方约定的secretKey"
    },
    "Zto": {
      "AppKey": "你的AppKey",
      "AppSecret": "你的AppSecret"
    },
    "ShowApi": {
      "AppId": "你的AppId",
      "AppSecret": "你的AppSecret"
    }
  }
}

每个供应商使用独立的配置子节,仅注册配置中存在的子节,未配置的不会加载。各子节的详细字段见对应实现包文档。

配置节 供应商 必填字段 文档
Express:Kdniao 快递鸟 EBusinessId / AppKey 文档
Express:Kuaidi100 快递100 Key / Customer 文档
Express:SfLegal 顺丰函证通 MonthlyCardNo / CustomerCode / CheckWord 文档
Express:ChinaPost 中国邮政 SenderNo / Authorization 文档
Express:Cainiao 菜鸟速递 AppKey / AppSecret 文档
Express:Zto 中通快递 AppKey / AppSecret 文档
Express:ShowApi 万维易源 AppId / AppSecret 文档

注册服务

从 IConfiguration 绑定(推荐)

using Bitzsoft.Integrations.Express.All;

builder.Services.AddBitzsoftExpressAll(builder.Configuration);
// 等价于 builder.Services.AddBitzsoftExpressAll(builder.Configuration, "Express");

AddBitzsoftExpressAll 仅接受 IConfiguration(按子节存在性自动注册),无 Action 重载。如需委托配置单个供应商,请直接引用对应实现包的 AddBitzsoft* 方法。

请求审计

聚合包本身不发起请求,其引用的各实现包内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认使用 NullRequestLogStore 不持久化。

// 宿主注册 IRequestLogStore 实现后,所有已注册供应商的出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
    opts.MaxInMemoryBodyBytes = 64 * 1024; // 只控制内存/加密临时文件切换,不截断正文
    opts.SensitiveFields.Add("AppKey");
    opts.SensitiveFields.Add("CheckWord");
});
services.AddBitzsoftExpressAll(builder.Configuration);

使用示例

通用物流查询

using Bitzsoft.Integrations.Express.Interfaces;
using Bitzsoft.Integrations.Express.Models;
using Bitzsoft.Integrations.Core;

public class TrackingService
{
    private readonly IIntegrationProviderResolver<IExpressProvider> _providers;

    public TrackingService(IIntegrationProviderResolver<IExpressProvider> providers)
        => _providers = providers;

    public async Task TrackAsync(string trackingNumber)
    {
        var express = _providers.GetRequired("kdniao");
        ExpressTrackingInfo info = await express.TrackAsync(trackingNumber);
        Console.WriteLine($"状态: {info.State}, 轨迹数: {info.Traces.Count}");
    }
}

顺丰函证通寄递(独立接口,可与上述查询共存)

using Bitzsoft.Integrations.Express.Interfaces;

public class LegalService
{
    private readonly ISfLegalDocumentProvider _legal;

    public LegalService(ISfLegalDocumentProvider legal) => _legal = legal;

    public async Task TrackAsync(string documentId)
    {
        var result = await _legal.TrackDocumentAsync(documentId);
        Console.WriteLine($"函件 {result.DocumentId} 状态: {result.Status}");
    }
}

核心类型一览

类型 说明
AddBitzsoftExpressAll 聚合注册扩展方法(Express.All.ServiceCollectionExtensions
IIntegrationProviderResolver<IExpressProvider> 按 Provider ID 路由通用物流能力
IExpressProvider 通用物流操作契约(轨迹 / 订阅 / 寄件 / 运费 / 面单 / 识别)
ISfLegalDocumentProvider 顺丰函证通法律函件寄递契约

包含的供应商

实现包 类型 实现类 说明
Express.Kdniao 聚合平台 KdniaoExpressProvider 快递鸟,覆盖 2000+ 快递公司
Express.Kuaidi100 聚合平台 Kuaidi100ExpressProvider 快递100,覆盖 2100+ 快递公司
Express.SfLegal 独立接口 SfLegalDocumentProvider 顺丰函证通法律函件寄递
Express.ChinaPost 直连承运商 ChinaPostExpressProvider 中国邮政/EMS
Express.Cainiao 直连承运商 CainiaoExpressProvider 菜鸟速递 EDI
Express.Zto 直连承运商 ZtoExpressProvider 中通快递
Express.ShowApi 聚合平台 ShowApiExpressProvider 万维易源,备用查询渠道

注意事项

  • 多个 IExpressProvider 可同时注册,使用 IIntegrationProviderResolver<IExpressProvider> 按稳定 ID 解析
  • ISfLegalDocumentProvider 独立注册,不与 IExpressProvider 冲突,可放心混用
  • Provider 与 typed client 使用 Transient,底层 HttpMessageHandler 连接池由 IHttpClientFactory 管理并相互隔离

依赖

说明
Bitzsoft.Integrations.Express 抽象层
Bitzsoft.Integrations.Express.Kdniao 快递鸟实现
Bitzsoft.Integrations.Express.Kuaidi100 快递100 实现
Bitzsoft.Integrations.Express.SfLegal 顺丰函证通实现
Bitzsoft.Integrations.Express.ChinaPost 中国邮政实现
Bitzsoft.Integrations.Express.Cainiao 菜鸟物流实现
Bitzsoft.Integrations.Express.Zto 中通快递实现
Bitzsoft.Integrations.Express.ShowApi 万维易源实现
Microsoft.Extensions.Configuration.Abstractions 配置抽象

相关包

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 is compatible.  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 89 8/3/2026
1.0.0 90 8/2/2026
1.0.0-alpha.10 48 7/26/2026
1.0.0-alpha.9 52 7/12/2026
1.0.0-alpha.8 59 7/1/2026
1.0.0-alpha.7 68 6/16/2026
1.0.0-alpha.6 71 6/16/2026
1.0.0-alpha.5 60 6/14/2026
1.0.0-alpha.3 67 6/7/2026