Bitzsoft.Integrations.Express.ShowApi 1.0.0-alpha.10

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

Bitzsoft.Integrations.Express.ShowApi

万维易源快递物流查询服务实现 -- API 市场聚合,作为备用查询与时效预估渠道。

功能特性

  • 基于万维易源统一 API 网关,支持快递物流查询、订阅推送、快递公司识别和物流时效查询
  • 认证方式:随表单请求传递 showapi_appidshowapi_sign
  • 定位为备用聚合平台,不提供寄件下单、订单取消和电子面单能力
  • 双层错误码校验:同时检查网关层 showapi_res_code 和业务层 ret_code
  • 实现 IExpressProvider 统一契约,可无缝替换其他供应商实现

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.Express.ShowApi

PackageReference

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

配置

appsettings.json

{
  "Express": {
    "ShowApi": {
      "AppId": "你的AppId",
      "AppSecret": "你的AppSecret",
      "BaseUrl": "https://route.showapi.com",
      "HttpClientName": "ShowApiExpress"
    }
  }
}
配置项 必填 默认值 说明
AppId 万维易源 AppId,对应 showapi_appid
AppSecret 万维易源 AppSecret,用作 showapi_sign
BaseUrl https://route.showapi.com 万维易源 API 基地址
HttpClientName ShowApiExpress 命名 HttpClient 名称

注册服务

从 IConfiguration 绑定(推荐)

using Bitzsoft.Integrations.Express.ShowApi;

builder.Services.AddBitzsoftShowApiExpress(
    builder.Configuration.GetSection("Express:ShowApi"));

委托配置

builder.Services.AddBitzsoftShowApiExpress(options =>
{
    options.AppId = "your_app_id";
    options.AppSecret = "your_app_secret";
});

请求审计

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

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

// ② 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
    opts.MaxInMemoryBodyBytes = 64 * 1024; // 仅控制内存/加密临时文件切换,不截断正文
    opts.SensitiveFields.Add("AppSecret");
});
services.AddBitzsoftShowApiExpress(options => { /* ... */ });

使用示例

物流轨迹查询

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

public class TrackingService
{
    private readonly IExpressProvider _express;

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

    public async Task TrackAsync(string trackingNumber)
    {
        // 查询单个运单轨迹(未传 carrierCode 时使用 auto 自动识别)
        ExpressTrackingInfo info = await _express.TrackAsync(trackingNumber);
        Console.WriteLine($"状态: {info.State}, 轨迹数: {info.Traces.Count}");

        foreach (var step in info.Traces)
            Console.WriteLine($"[{step.Time:yyyy-MM-dd HH:mm}] {step.Description}");

        // 批量查询
        IReadOnlyList<ExpressTrackingInfo> batch =
            await _express.BatchTrackAsync(new[] { "YT001", "ZTO002" });
    }
}

单号识别与时效查询

// 自动识别快递公司
ExpressCarrierInfo carrier = await _express.DetectCarrierAsync("SF1234567890");
Console.WriteLine($"{carrier.CarrierName}(统一编码 {carrier.UnifiedCode})");

// 物流时效查询(仅返回预计用时,不返回真实运费)
IReadOnlyList<ExpressQuoteResult> quotes = await _express.GetQuoteAsync(request);

核心类型一览

类型 说明
ShowApiExpressProvider 万维易源物流服务实现(IExpressProvider
ShowApiOptions 万维易源配置选项(AppId / AppSecret / BaseUrl / HttpClientName)
IExpressProvider 通用物流操作契约(抽象层)
ExpressTrackingInfo 物流轨迹查询结果
ExpressCarrierInfo 快递公司识别结果

实现状态

方法 状态 说明
TrackAsync 已实现 调用 /64-34 按单查询快递物流
BatchTrackAsync 已实现 并发逐单查询
SubscribeAsync 已实现 调用 /64-22 设置回调地址,再调用 /64-23 批量提交订阅单号
GetQuoteAsync 部分实现 调用 /2650-12 查询物流时效,仅返回预计用时
DetectCarrierAsync 已实现 调用 /64-21 按单号识别快递公司
CreateShipmentAsync 不支持 万维易源公开物流接口未提供寄件下单能力
CancelShipmentAsync 不支持 万维易源公开物流接口未提供订单取消能力
GenerateWaybillAsync 不支持 万维易源公开物流接口未提供电子面单能力

API 端点

常量 接口 用途
PathTrack /64-34 按单查询快递物流
PathSetCallback /64-22 设置推送回调地址
PathSubscribe /64-23 批量提交订阅单号
PathDetectCarrier /64-21 单号查快递公司
PathQuote /2650-12 物流时效查询

依赖

说明
Bitzsoft.Integrations.Express 抽象层(IExpressProvider 接口与模型)
Bitzsoft.Integrations.Compatibility 基础工具库
Bitzsoft.Integrations.RequestLogging 出站请求记录管道
Microsoft.Extensions.Configuration.Abstractions 配置抽象
Microsoft.Extensions.Http IHttpClientFactory(Typed Client 连接池)
Microsoft.Extensions.Options.ConfigurationExtensions Options 配置节点绑定

注意事项

  • 万维易源定位为 API 市场,接口返回体包含网关层 showapi_res_code 和业务层 ret_code,封装会同时检查两层错误码
  • SubscribeAsync 会调用 /64-22 更新账号级回调地址;同一 App 多业务共用时需避免互相覆盖回调配置
  • GetQuoteAsync 对应物流时效查询接口,无法返回真实运费,EstimatedCost 保持默认值
  • 查询接口未传入快递公司编码时使用 auto 作为自动识别编码,具体可用性以万维易源套餐和接口返回为准
  • 不同接口的可用额度和计费策略由万维易源控制,生产使用前应在控制台确认套餐权限
  • IExpressProvider 使用 TryAddSingleton 注册,如需同时注册多个供应商请单独引用并自行解析

相关包

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.ShowApi:

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.10 43 7/26/2026
1.0.0-alpha.9 60 7/12/2026
1.0.0-alpha.8 66 7/1/2026
1.0.0-alpha.7 69 6/16/2026
1.0.0-alpha.6 73 6/16/2026
1.0.0-alpha.5 64 6/14/2026
1.0.0-alpha.3 68 6/7/2026