Bitzsoft.Integrations.LegalDatabase.Pkulaw 1.0.0-alpha.10

This is a prerelease version of Bitzsoft.Integrations.LegalDatabase.Pkulaw.
dotnet add package Bitzsoft.Integrations.LegalDatabase.Pkulaw --version 1.0.0-alpha.10
                    
NuGet\Install-Package Bitzsoft.Integrations.LegalDatabase.Pkulaw -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.LegalDatabase.Pkulaw" 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.LegalDatabase.Pkulaw" Version="1.0.0-alpha.10" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.LegalDatabase.Pkulaw" />
                    
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.LegalDatabase.Pkulaw --version 1.0.0-alpha.10
                    
#r "nuget: Bitzsoft.Integrations.LegalDatabase.Pkulaw, 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.LegalDatabase.Pkulaw@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.LegalDatabase.Pkulaw&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.LegalDatabase.Pkulaw&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.LegalDatabase.Pkulaw

北大法宝法规案例库集成 — 支持 SSO 跳转、AlphaData API、AlphaGPT 接入,并可选启用 REST API 检索。

功能特性

  • 三种 SSO 访问模式:标准登录(MD5 签名)、AlphaData API(RSA-SHA256 签名)、AlphaGPT(RSA 加密)
  • REST API 检索:配置 ApiToken 后额外支持法律法规 / 司法案例检索与文档详情
  • 动态能力标志CapabilitiesApiToken 配置变化(仅 AccessUrlAll
  • 统一接口:实现 ILegalDatabaseProvider,与其他法律数据库供应商无缝替换

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.LegalDatabase.Pkulaw

PackageReference

<PackageReference Include="Bitzsoft.Integrations.LegalDatabase.Pkulaw" Version="1.0.0" />

配置

appsettings.json

{
  "LegalDatabase": {
    "Pkulaw": {
      "UserName": "your-login-username",
      "PrivateKey": "your-md5-private-key",
      "LibId": "law",
      "LoginUrl": "https://login.pkulaw.com/",
      "AiUrl": "https://ai.pkulaw.com/apps/lawyerAssist/search?channel=nav_ad",
      "AlphaDataApiUrl": "https://opendata.alphalawyer.cn/gateway/getToken",
      "AlphaDataAppId": "your-alpha-data-app-id",
      "AlphaDataPrivateKey": "your-pkcs8-rsa-private-key",
      "AlphaGptApiUrl": "https://similar.alphalawyer.cn/ai/api/v1/login/third",
      "AlphaGptOfficeId": "your-office-id",
      "AlphaGptPublicKey": "your-rsa-public-key",
      "ApiBaseUrl": "https://api.pkulaw.com/",
      "ApiToken": "your-rest-api-token"
    }
  }
}
配置项 说明 必填
UserName 标准登录用户名(login.pkulaw.com SSO) 标准模式
PrivateKey MD5 签名私钥:sign = MD5(yyyy-MM-dd + PrivateKey) 标准模式
LibId 数据库 ID(默认 law
LoginUrl 标准登录基础地址(默认 https://login.pkulaw.com/
AiUrl AI 平台跳转地址
AlphaDataApiUrl AlphaData 获取 Token API 地址 AlphaData 模式
AlphaDataAppId AlphaData 应用 ID AlphaData 模式
AlphaDataPrivateKey AlphaData RSA 私钥(PKCS8),用于 RSA-SHA256 签名 AlphaData 模式
AlphaGptApiUrl AlphaGPT 登录 API 地址 AlphaGPT 模式
AlphaGptOfficeId AlphaGPT 机构 ID AlphaGPT 模式
AlphaGptPublicKey AlphaGPT RSA 公钥(X509 Base64),用于 RSA 加密 AlphaGPT 模式
ApiBaseUrl REST API 基础地址(默认 https://api.pkulaw.com/
ApiToken REST API Token(非空时启用检索和文档详情) API 检索

访问模式按优先级自动选择:配置 AlphaDataAppId + AlphaDataPrivateKey 用 AlphaData;配置 AlphaGptPublicKey + AlphaGptOfficeId 用 AlphaGPT;否则用标准登录。

注册服务

从 IConfiguration 绑定(推荐)

using Bitzsoft.Integrations.LegalDatabase.Pkulaw;

builder.Services.AddBitzsoftPkulawLegalDatabase(
    builder.Configuration.GetSection("LegalDatabase:Pkulaw"));

委托配置

builder.Services.AddBitzsoftPkulawLegalDatabase(options =>
{
    // 标准登录模式
    options.UserName = "your-login-username";
    options.PrivateKey = "your-md5-private-key";

    // 如需 API 检索
    options.ApiToken = "your-rest-api-token";
});

使用示例

生成 SSO 访问链接

using Bitzsoft.Integrations.LegalDatabase;

public class LoginController : ControllerBase
{
    private readonly ILegalDatabaseProvider _provider;

    public LoginController(ILegalDatabaseProvider provider) => _provider = provider;

    [HttpGet("login/pkulaw")]
    public async Task<IActionResult> Login(string userId)
    {
        var access = await _provider.GenerateAccessUrlAsync(userId);
        return Redirect(access.Url);
    }
}

法律检索(配置 ApiToken 后可用)

using Bitzsoft.Integrations.LegalDatabase.Enums;

if ((_provider.Capabilities & LegalDatabaseCapabilities.Search) != 0)
{
    // 法规检索
    var laws = await _provider.SearchAsync("民法典", LegalSearchType.Law, 1, 20);

    // 案例检索
    var cases = await _provider.SearchAsync("合同纠纷", LegalSearchType.Case, 1, 20);

    Console.WriteLine($"共 {cases.TotalCount} 条案例");
    foreach (var doc in cases.Items)
        Console.WriteLine($"{doc.Id}  {doc.Title}");
}

文档详情(配置 ApiToken 后可用)

var doc = await _provider.GetDocumentAsync("DOC-123456");
Console.WriteLine(doc.Title);
Console.WriteLine(doc.Summary);

请求审计

内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,记录每次调用北大法宝 API 的请求与响应,默认使用 NullRequestLogStore 不持久化。

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

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

依赖

说明
Bitzsoft.Integrations.LegalDatabase 法规案例库抽象层(ILegalDatabaseProvider
Bitzsoft.Integrations.RequestLogging 出站请求记录管道
Bitzsoft.Integrations.Compatibility 基础工具库
Microsoft.Extensions.Configuration.Abstractions 配置抽象
Microsoft.Extensions.Http IHttpClientFactory
Microsoft.Extensions.Options.ConfigurationExtensions Options 配置节点绑定

相关包

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.LegalDatabase.Pkulaw:

Package Downloads
Bitzsoft.Integrations.LegalDatabase.All

法规案例库聚合包 — 一键集成威科先行、法信、聚法案例、无讼、MetaLaw、把手案例、见微数据、律商联讯、北大法宝、元典、得理法搜、incoPat

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.10 44 7/26/2026
1.0.0-alpha.9 54 7/12/2026
1.0.0-alpha.8 60 7/1/2026
1.0.0-alpha.7 76 6/16/2026
1.0.0-alpha.6 79 6/16/2026
1.0.0-alpha.5 66 6/14/2026
1.0.0-alpha.3 66 6/7/2026