update server

This commit is contained in:
2026-07-30 11:12:31 +08:00
commit 4312cb878c
99 changed files with 24034 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
"""Report the ReinLoop application's Server reachability for Panel status."""
def heartbeat_device(timeout=5):
"""Refresh the current device's Server heartbeat and return its timestamp."""
import requests
from api import data_record_url, the_folder
try:
response = requests.post(data_record_url, json={
"type": "deviceHeartbeat",
"deviceId": the_folder,
}, timeout=timeout)
response.raise_for_status()
result = response.json()
except Exception as exc:
raise ValueError(f"设备心跳请求失败: {exc}") from exc
if not result.get("success"):
raise ValueError(result.get("errMsg", "设备心跳被服务端拒绝"))
return result.get("lastSeenAt")