功能:扩展开放平台氢耗溯源与合作站数据
This commit is contained in:
@@ -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>核验半径,单位米;1–100,默认 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> 可设为 1–100 米,省略时为 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>0–100,越高表示匹配越充分</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' \\
|
||||
|
||||
Reference in New Issue
Block a user