14 lines
788 B
Bash
14 lines
788 B
Bash
|
|
#!/bin/bash
|
|||
|
|
# 能耗报表接口验证脚本(在测试服务器上执行,直连本机 :3000,绕开 nginx)
|
|||
|
|
# 用法: bash verify_endpoints.sh <JWT> [BASE]
|
|||
|
|
TOKEN="$1"
|
|||
|
|
BASE="${2:-http://127.0.0.1:3000/api}"
|
|||
|
|
echo "### BASE=$BASE"
|
|||
|
|
for path in "energy-stats/summary" "energy-stats/cabinets" "energy-stats/projects" "energy-stats/trend?granularity=day&range=30" "energy-stats/trend?granularity=week&range=30" "energy-stats/trend?granularity=month&range=30"; do
|
|||
|
|
echo "--- GET /api/$path"
|
|||
|
|
curl -s -m 20 -w "\n[HTTP %{http_code}]\n" -H "Authorization: Bearer $TOKEN" "$BASE/$path"
|
|||
|
|
echo
|
|||
|
|
done
|
|||
|
|
echo "=== 导出接口(异步任务) ==="
|
|||
|
|
curl -s -m 20 -w "\n[HTTP %{http_code}]\n" -H "Authorization: Bearer $TOKEN" "$BASE/energy-stats/export?start_date=2026-09-19&end_date=2026-09-20"
|