remove /api support

This commit is contained in:
2026-07-31 14:19:48 +08:00
parent 46c69607c5
commit 6330b99860
11 changed files with 75 additions and 67 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ base_url = os.environ.get(
).rstrip("/")
server_api_url = os.environ.get(
"REINLOOP_API_URL",
f"{base_url}/api",
base_url,
)
# Compatibility alias used by existing modules. It points to the ReinLoop
# Express server API, not a cloud-function endpoint.
+4 -4
View File
@@ -5,11 +5,11 @@
## 约定
- 业务服务端地址由 `REINLOOP_API_URL` 指定,未设置时使用
`REINLOOP_SERVER_URL + /api`;默认地址为
`https://ReinLoop.dominatedconvergence.com/api`
`REINLOOP_SERVER_URL`;默认地址为
`https://ReinLoop.dominatedconvergence.com`
- 新许可证的设备标识为 `<company_code>/<production_line_code>`,在代码中通过
`api.the_folder` 使用。旧许可证才回退到 `REINLOOP_DEVICE_ID`
- 所有服务端业务请求均使用 `POST /api`,通过请求体的 `type` 字段分发。
- 所有服务端业务请求均使用 `POST /`,通过请求体的 `type` 字段分发。
- 公司、产线、许可证签发/撤销、模型删除、审核反馈及配置提交均为
ControlPanel 管理端能力,客户端不提供对应的管理接口。旧微信云函数和其管理脚本
已移除。
@@ -148,7 +148,7 @@ RL 模式下,`ControlEngine` 使用模型根据流量、当前压力和压力
## 客户端服务端协议
所有业务请求都发送至 `POST /api`。业务成功响应应至少包含 `success: true`
所有业务请求都发送至 `POST /`。业务成功响应应至少包含 `success: true`
| `type` | 请求关键字段 | 用途 |
| --- | --- | --- |
+1 -1
View File
@@ -276,7 +276,7 @@ def _api_url():
base_url = os.environ.get(
"REINLOOP_SERVER_URL", "https://ReinLoop.dominatedconvergence.com"
).rstrip("/")
return os.environ.get("REINLOOP_API_URL", f"{base_url}/api")
return os.environ.get("REINLOOP_API_URL", base_url)
def _offline_limit_seconds():
+1 -1
View File
@@ -14,7 +14,7 @@ MODULE_PATH = Path(__file__).resolve().parents[1] / "core" / "data_collector.py"
def load_data_collector_module():
api = types.ModuleType("api")
api.base_url = "https://cloud.example"
api.data_record_url = "https://cloud.example/api"
api.data_record_url = "https://cloud.example"
api.the_folder = "customer-a/line-1"
requests = types.ModuleType("requests")
+2 -2
View File
@@ -30,12 +30,12 @@ class DeviceHeartbeatTests(unittest.TestCase):
requests_module.post = post
api_module = types.ModuleType("api")
api_module.data_record_url = "https://server.example/api"
api_module.data_record_url = "https://server.example"
api_module.the_folder = "company/line"
with patch.dict(sys.modules, {"requests": requests_module, "api": api_module}):
timestamp = HEARTBEAT.heartbeat_device(timeout=7)
self.assertEqual(timestamp, "2026-07-28T00:00:00.000Z")
self.assertEqual(calls, [("https://server.example/api", {
self.assertEqual(calls, [("https://server.example", {
"type": "deviceHeartbeat", "deviceId": "company/line"
}, 7)])