Bitzsoft.Integrations.Express.Kdniao 1.0.0-alpha.8

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

Bitzsoft.Integrations.Express.Kdniao

快递鸟物流服务实现,基于快递鸟 API 覆盖 2000+ 快递公司。

功能特性

  • 支持即时查询、物流跟踪订阅、电子面单、上门取件、单号识别、智选物流等全量 API
  • 认证方式:EBusinessID + AppKey,签名 = Base64(MD5(RequestData + AppKey))
  • 统一异常处理,供应商错误码自动映射为 ExpressException

安装

dotnet add package Bitzsoft.Integrations.Express.Kdniao
<PackageReference Include="Bitzsoft.Integrations.Express.Kdniao" Version="*" />

配置

{
  "Express": {
    "Kdniao": {
      "EBusinessId": "你的商户ID",
      "AppKey": "你的应用密钥",
      "BaseUrl": "https://api.kdniao.com/api/",
      "HttpClientName": "KdniaoExpress"
    }
  }
}
参数 必填 默认值 说明
EBusinessId 快递鸟商户 ID
AppKey 快递鸟应用密钥
BaseUrl https://api.kdniao.com/api/ API 基地址
HttpClientName KdniaoExpress 命名 HttpClient 名称

注册服务

// 方式一:Action 配置
services.AddBitzsoftKdniaoExpress(options =>
{
    options.EBusinessId = "your_id";
    options.AppKey = "your_key";
});

// 方式二:IConfiguration 绑定
services.AddBitzsoftKdniaoExpress(configuration, "Express:Kdniao");

第三方请求日志

内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认 NullRequestLogStore 不持久化。

// ① 默认:启用记录管道但不持久化(日志丢弃)
services.AddBitzsoftKdniaoExpress(options => { /* ... */ });

// ② 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
    opts.MaxBodyLength = 8192;
    opts.SensitiveFields.Add("mySecret");
});
services.AddBitzsoftKdniaoExpress(options => { /* ... */ });

使用示例

public class MyService
{
    private readonly IExpressProvider _express;

    public MyService(IExpressProvider express) => _express = express;

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

支持的操作

方法 API 接口 说明
TrackAsync 即时查询(1002) 实时查询物流轨迹
BatchTrackAsync 逐条调用即时查询 批量查询
SubscribeAsync 物流跟踪订阅(1008) 订阅轨迹推送
CreateShipmentAsync 上门取件(1004) 创建寄件订单
CancelShipmentAsync 电子面单取消(1147) 取消订单
GetQuoteAsync 智选物流(6001) 运费时效查询
GenerateWaybillAsync 电子面单下单(1007) 生成电子面单
DetectCarrierAsync 单号识别(2002) 自动识别快递公司

核心类型

类型 说明
KdniaoExpressProvider 快递鸟物流服务实现
KdniaoOptions 快递鸟配置选项

注意事项

  • 顺丰查询需传入 phoneSuffix 参数(手机号后四位)
  • 快递鸟有调用频率限制(3000 次/小时),建议在业务层实现缓存
  • BatchTrackAsync 通过逐条调用实现,大批量查询建议控制并发数

相关包

包名 说明
Bitzsoft.Integrations.Express 抽象层
Bitzsoft.Integrations.Express.All 聚合包
Bitzsoft.Integrations.Compatibility 基础工具库
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 (1)

Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.Express.Kdniao:

Package Downloads
Bitzsoft.Integrations.Express.All

快递物流服务聚合包 — 包含所有供应商实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.8 40 7/1/2026
1.0.0-alpha.7 63 6/16/2026
1.0.0-alpha.6 67 6/16/2026
1.0.0-alpha.5 58 6/14/2026
1.0.0-alpha.3 62 6/7/2026