智慧校园物联网综合管理系统 · RESTful 接口说明(基于当前线上 `api.php` / `alert_api.php`)
/admin/api.php 为管理后台专用,需先登录,本文只作索引。
{
"status": "ok",
"service": "智慧校园物联网API",
"version": "2.0",
"time": "2026-07-28 12:00:00"
}
返回统计、最近告警、用户摘要、系统状态等。
level:级别过滤(如 high / warning / info)processed / status:处理状态location:地点severity:可选返回 users 表摘要字段(id、username、nickname、联系方式、角色等)。
JSON Body 示例:
{
"event_type": "parking_access",
"location": "地下停车场入口",
"message": "检测到异常通行",
"details": "可选详情",
"alert_level": "high",
"person_type": "student"
}
成功时返回 success / id / alert_id。
JS 客户端也可使用:
smartCampus.sendAlert({
event_type: "parking_access",
location: "地下停车场入口",
person_type: "student"
});
{ "id": 123, "user": "admin" }
批量:action=alert_process_until,同样 POST { id, user }。
旧设备端可用 JSON 或表单字段:
event_type / alert_typelocationdetails / messagealert_level(critical 会映射为 high)需先访问 /admin/login.html 登录(Session / Remember Cookie)。
dashboard / stats / alerts(支持 level、processed、limit、offset 等)alert:单条查询 / 处理(GET、PUT/POST、DELETE)staff:人员 CRUD(GET/POST/PUT/DELETE)alerts_clear:DELETE 清空