---
url: https://wiki.awmc.team/dev/status-api.md
---

# 📊 Status API (Uptime Kuma)

::: danger ⚠️ 已废弃 (Deprecated)
AWMC 已**停止提供**本状态 API。`status.awmc.cc` 下的相关接口不再维护，随时可能返回重定向或不可用。

本页内容仅作历史存档保留，**请勿在新项目中接入**。后续舞萌服务器状态数据建议使用社区项目 [mai.chongxi.us](https://mai.chongxi.us/)：**该项目与 AWMC 没有任何关联**，由社区独立开发与维护，提供更多维度的监控数据，并支持用户自主上报状态。
:::

AWMC TEAM 使用 [Uptime Kuma](https://status.awmc.cc) 监控所有服务的运行状态。我们提供了公开的 API 端点，方便开发者获取实时的服务状态数据。

::: info 💡 免密钥访问
本页列出的所有 API 均为**公开端点**。你不需要任何 API Key 或鉴权即可直接通过浏览器或脚本请求。
:::

## 1. 状态页配置与结构

该接口用于获取状态页的标题、公告（Incidents）、维护计划以及分组结构。

* **端点**: `GET /api/status-page/[slug]`
* **完整示例**: `https://status.awmc.cc/api/status-page/maimai`

### 📢 公告与故障信息 (Incidents)

::: tip 💡 重要提示
你可以通过解析 `incidents` 数组来获取当前状态页上的置顶公告或故障说明。
:::

```json
{
  "incidents": [
    {
      "id": 16,
      "style": "info", 
      "title": "公告标题",
      "content": "公告的 Markdown 内容",
      "pin": true, 
      "active": true,
      "createdDate": "2026-03-28 07:46:17"
    }
  ]
}
```

### 🛠️ 分组与监控列表 (Public Groups)

```json
{
  "publicGroupList": [
    {
      "id": 1,
      "name": "舞萌服务组",
      "monitorList": [
        {
          "id": 12,
          "name": "Maimai DX Proxy",
          "type": "http"
        }
      ]
    }
  ]
}
```

***

## 2. 实时状态与心跳记录

由于基础接口不含实时状态，你需要调用专门的心跳接口。

* **端点**: `GET /api/status-page/heartbeat/[slug]`
* **完整示例**: `https://status.awmc.cc/api/status-page/heartbeat/maimai`

### 返回示例 (JSON)

```json
{
  "heartbeatList": {
    "12": [
      {
        "status": 1, 
        "time": "2026-03-29 15:28:18",
        "msg": "200 OK",
        "ping": 32
      }
    ]
  }
}
```

::: warning ⚠️ 状态码解析
在 `heartbeatList` 中，`status` 字段代表了服务的当前健康状况：

* **`1`**: **正常 (Up)** —— 服务响应正常，一切 OK。
* **`0`**: **离线 (Down)** —— 服务已崩溃或无法访问。
* **`2`**: **待定/异常 (Pending/Warning)** —— 服务虽然在线但可能响应极慢或返回了非预期结果。
* **`3`**: **维护中 (Maintenance)** —— 服务处于计划内的维护阶段（通常会跳过通知）。
  :::

***

## 3. 计划维护 (Maintenance)

当服务器有计划内的停机维护时，你可以通过 `maintenanceList` 获取。

::: details 📅 如何解析维护信息？
如果 `maintenanceList` 不为空，你可以获取以下关键信息：

* `title`: 维护的标题。
* `description`: 维护的详细描述。
* `start_date`: 维护开始时间。
* `end_date`: 维护预计结束时间。
  :::

```json
{
  "maintenanceList": [
    {
      "id": 5,
      "title": "数据库例行维护",
      "active": true,
      "interval": 0
    }
  ]
}
```

***

## 🌐 智能状态预览 (Smart Live Demo)

以下是使用上述 API 接口实时抓取的 **maimai** 状态预览：
::: info 💡 智能排序逻辑

1. **业务优先**：按 NET服务器 > 机台服务器 > 会员服务器 > 二维码服务器 > ALL.NET服务器 排序。
2. **运营商优先**：自动识别你的 **国内运营商**（联通/电信/移动），将匹配你线路的服务器置顶。
   :::

[//]: # "## 4. 自定义接口演示 (Custom Demo)"

[//]: #

[//]: # "你可以直接在 Markdown 中配置接口端点进行演示："

[//]: #

[//]: # "<ApiDemo "

[//]: # "  title=\"自定义测试接口\""

[//]: # "  method=\"GET\""

[//]: # "  path=\"/api/realtime\""

[//]: # "  baseUrl=\"https://stat.awmc.cc\""

[//]: # "  description=\"这是一个直接在 Markdown 中配置的示例，用于演示自定义端点和参数修改功能。\""

[//]: # "  :params=\"["

[//]: # "    { name: 'type', type: 'string', required: '必填', desc: '数据类型', value: 'req' },"

[//]: # "    { name: 'start', type: 'string', required: '必填', desc: '开始时间', value: '2026-03-30 00:00:00' }"

[//]: # "  ]\""

[//]: # "  :response=\"{ 'info': '这是预设的响应示例' }\""

[//]: # "/>"

***

### 💻 开发者如何实现“运营商优先排序”？

在开发状态页时，你可以参考以下核心代码逻辑。关键在于对服务器名称进行**关键词匹配**。

```javascript
// 1. 获取用户运营商信息 (支持跨域的方案) 
async function getUserISP() {
  try {
    // 推荐使用支持 HTTPS 的 myip.ipip.net (纯文本格式)
    const res = await fetch('https://myip.ipip.net/'); 
    const text = await res.text();
    if (text.includes('联通')) return '联通';
    if (text.includes('电信')) return '电信';
    if (text.includes('移动')) return '移动';
    return '国内线路';
  } catch (e) {
    return '识别失败';
  }
}

// 2. 定义业务类型排序权重 (数值越大越靠前) 
const TYPE_WEIGHT = {
  "NET服务器": 500,
  "机台服务器": 400,
  "会员服务器": 300,
  "二维码服务器": 200,
  "ALL.NET服务器": 100
};

// 3. 执行智能排序算法 // 
const userISP = await getUserISP();

monitors.sort((a, b) => {
  let scoreA = 0;
  let scoreB = 0;

  // A. 根据业务类型加分 // 
  Object.keys(TYPE_WEIGHT).forEach(key => {
    if (a.name.includes(key)) scoreA += TYPE_WEIGHT[key];
    if (b.name.includes(key)) scoreB += TYPE_WEIGHT[key];
  });

  // B. 如果名称包含用户运营商，大幅加分 (置顶)
  if (a.name.includes(userISP)) scoreA += 1000; 
  if (b.name.includes(userISP)) scoreB += 1000;

  return scoreB - scoreA; // 分数高的排前面
});
```

***

::: tip 🛠️ 接入建议
如果你想在自己的 App 中实现类似“服务状态灯”的功能：

1. **先获取** `status-page/maimai` 拿到 `publicGroupList`（确定有哪些服务）。
2. **再获取** `status-page/heartbeat/maimai` 拿到最新的 `status`（点亮对应的灯）。
3. **别忘了** 检查 `incidents` 数组，如果有 `active: true` 的公告，可以弹窗提醒用户。
   :::
