功能:扩展开放平台氢耗溯源与合作站数据

This commit is contained in:
lingniu
2026-09-02 14:05:34 +08:00
parent 8759668d39
commit c6875fbb98
33 changed files with 5692 additions and 475 deletions
@@ -4,12 +4,12 @@ import { Icon, navigate } from "./ui";
type Topic =
| "overview" | "quickstart" | "auth" | "errors" | "limits"
| "hydrogen" | "mileage" | "mileage-range" | "total-mileage"
| "hydrogen" | "mileage" | "mileage-range" | "total-mileage" | "stationary"
| "vehicle-auth" | "key-rotation" | "quality" | "checklist";
const groups: Array<{ title: string; items: Array<[Topic, string]> }> = [
{ title: "开始使用", items: [["overview", "平台概览"], ["quickstart", "五分钟接入"], ["auth", "鉴权方式"], ["errors", "错误码与重试"], ["limits", "请求边界"]] },
{ title: "接口参考", items: [["hydrogen", "车辆日用氢量"], ["mileage", "车辆日里程"], ["mileage-range", "车辆区间日里程"], ["total-mileage", "指定时刻总里程"]] },
{ title: "接口参考", items: [["hydrogen", "车辆日用氢量"], ["mileage", "车辆日里程"], ["mileage-range", "车辆区间日里程"], ["total-mileage", "指定时刻总里程"], ["stationary", "加氢车辆停留核验"]] },
{ title: "最佳实践", items: [["vehicle-auth", "车辆授权"], ["key-rotation", "密钥轮换"], ["quality", "数据质量"], ["checklist", "上线检查清单"]] }
];
@@ -38,6 +38,7 @@ function TopicContent({ topic }: { topic: Topic }) {
if (topic === "hydrogen" || topic === "mileage") return <APIReference kind={topic} />;
if (topic === "mileage-range") return <MileageRangeReference />;
if (topic === "total-mileage") return <TotalMileageReference />;
if (topic === "stationary") return <StationaryVehicleReference />;
if (topic === "overview") return <Overview />;
if (topic === "auth") return <AuthGuide />;
if (topic === "errors") return <ErrorGuide />;
@@ -227,6 +228,23 @@ function TotalMileageReference() {
</>;
}
function StationaryVehicleReference() {
return <>
<h1></h1><p className="docs-lead"></p>
<Endpoint method="POST" path="/api/v1/vehicles/stationary/query" />
<h2 id="请求参数"></h2><table className="docs-table"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>startTime</code></td><td></td><td> YYYY-MM-DD HH:mm:ss</td></tr><tr><td><code>endTime</code></td><td></td><td> 24 </td></tr><tr><td><code>longitude</code></td><td></td><td> WGS-84 </td></tr><tr><td><code>latitude</code></td><td></td><td> WGS-84 </td></tr><tr><td><code>radiusMeters</code></td><td></td><td>1100 5</td></tr><tr><td><code>plateNumbers</code></td><td></td><td></td></tr></tbody></table>
<h2 id="请求示例"></h2><CodeBlock language="json" value={`{
"startTime": "2026-08-06 10:00:00",
"endTime": "2026-08-06 12:00:00",
"longitude": 120.752312,
"latitude": 30.746281,
"radiusMeters": 8
}`} />
<h2 id="核验口径"></h2><p>使 WGS-84/GPS <code>radiusMeters</code> 1100 5 3 km/h 2 60 10 <code>matchScore</code> </p>
<h2 id="响应字段"></h2><table className="docs-table"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>stayStartTime</code> / <code>stayEndTime</code></td><td></td></tr><tr><td><code>stayDurationSeconds</code> / <code>stayDurationMinutes</code></td><td></td></tr><tr><td><code>matchScore</code></td><td>0100</td></tr><tr><td><code>averageDistanceMeters</code> / <code>maxDistanceMeters</code></td><td></td></tr><tr><td><code>averageSpeedKmh</code> / <code>maxSpeedKmh</code></td><td></td></tr><tr><td><code>matchedSamples</code> / <code>sourceProtocols</code></td><td></td></tr></tbody></table>
</>;
}
function VehicleAuthGuide() {
return <>
<h1></h1><p className="docs-lead"> VIN/</p>
@@ -304,6 +322,7 @@ function tocFor(topic: Topic) {
mileage: ["请求参数", "请求示例", "响应字段", "响应示例"],
"mileage-range": ["请求参数", "首次请求", "游标翻页", "响应示例", "性能口径"],
"total-mileage": ["请求参数", "请求示例", "协议口径", "响应示例"],
stationary: ["请求参数", "请求示例", "核验口径", "响应字段"],
"vehicle-auth": ["授权关系", "配置步骤"],
"key-rotation": ["推荐流程", "权限要求"],
quality: ["状态定义", "统计口径"],
@@ -41,6 +41,16 @@ export const products: Product[] = [
path: "/api/v1/vehicles/total-mileage/query",
unit: "km"
},
{
code: "stationary_vehicle_verification",
name: "加氢车辆停留核验",
description: "按加氢站坐标与时间区间核验授权车辆的 5 米内低速停留,并按匹配度排序。",
version: "v1",
status: "available",
method: "POST",
path: "/api/v1/vehicles/stationary/query",
unit: "辆"
},
{
code: "realtime_vehicle",
name: "车辆实时位置与状态",
@@ -83,6 +93,17 @@ export const curlExample = (product: Product) => {
"time": "2026-07-21 09:30:00",
"protocol": "GB32960"
}'`;
if (product.code === "stationary_vehicle_verification") return `curl --request POST \\
--url https://open.d.lnoneos.com${product.path} \\
--header 'Authorization: Bearer YOUR_APP_KEY' \\
--header 'Content-Type: application/json' \\
--data '{
"startTime": "2026-08-06 10:00:00",
"endTime": "2026-08-06 12:00:00",
"longitude": 120.752312,
"latitude": 30.746281,
"radiusMeters": 5
}'`;
if (product.code === "mileage_range") return `curl --request POST \\
--url https://open.d.lnoneos.com${product.path} \\
--header 'Authorization: Bearer YOUR_APP_KEY' \\