基于契约锁开放平台 API 实现,采用 MD5 签名头鉴权机制。
包信息
- NuGet 包:
Bitzsoft.Integrations.ElectronicSignature.Qiyuesuo - 接口:
IElectronicSignatureProvider - 鉴权:MD5(AppToken + AppSecret + timestamp + nonce) 签名头
- Provider ID:
Qiyuesuo
配置
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
AppToken | string | 是 | — | 应用 AppToken |
AppSecret | string | 是 | — | 应用 AppSecret(参与签名计算,不传输) |
BaseUrl | string | 否 | https://openapi.qiyuesuo.com | API 基地址(沙箱 https://openapi.qiyuesuo.cn) |
HttpClientName | string | 否 | QiyuesuoElectronicSignatureProvider | 命名 HttpClient 标识 |
{ "Qiyuesuo": { "AppToken": "your-app-token", "AppSecret": "your-app-secret", "BaseUrl": "https://openapi.qiyuesuo.com" }}注册
using Bitzsoft.Integrations.ElectronicSignature.Qiyuesuo;
// 方式一:IConfiguration(默认读取 "Qiyuesuo" 配置节)services.AddBitzsoftQiyuesuoElectronicSignature(configuration);
// 方式二:委托配置services.AddBitzsoftQiyuesuoElectronicSignature(options =>{ options.AppToken = "your-app-token"; options.AppSecret = "your-app-secret"; options.BaseUrl = "https://openapi.qiyuesuo.com";});使用示例
var createResult = await provider.CreateContractAsync(new SimpleContractRequest{ Title = "销售合同", FileName = "contract.pdf", FileData = await File.ReadAllBytesAsync("contract.pdf"), SignerName = "王五", SignerPhone = "13700000000"});
var contractId = createResult.Data!;var detail = await provider.GetContractDetailAsync(contractId);var templates = await provider.ListTemplatesAsync();鉴权机制
- 每个请求生成 timestamp 和 nonce(随机串),将 AppToken、AppSecret、timestamp、nonce 拼接后做 MD5 摘要,以签名头形式发送。
已知限制
QiyuesuoOptions 不含 Timeout 字段;超时由 HttpClient 默认值控制。统一接口覆盖极简场景,复杂业务通过 partial class 扩展。