# 获取小游戏外挂分级标签数据

> 接口应在服务器端调用，不可在前端（小程序、网页、APP等）直接调用，具体可参考[接口调用指南](/doc/oplatform/developers/dev/guide.md)。

接口英文名：getCheatData

本接口用于小游戏开发者拉取自己游戏内被识别为外挂的分级标签数据，可按日期区间分页查询。返回数据按"openid × 命中时间(精确到小时) × 作弊类型"展开，开发者可基于结果进行封禁、二次校验、风控等后续处理。

应用场景举例：

- 风控处置：拉取近期外挂用户名单，对账号执行封禁/限制；
- 数据分析：统计游戏内不同作弊类型的命中分布与趋势；
- 模型训练：将命中数据作为正样本，辅助开发者自有反作弊策略迭代。

## 1. 调用方式

### HTTPS 调用

```bash
GET https://api.weixin.qq.com/wxa/game/content_spam/get_cheat_data?access_token=ACCESS_TOKEN
```

### 云调用

- 本接口不支持云调用。

### 第三方调用

- 本接口不支持第三方平台调用。

## 2. 请求参数

### 查询参数 `Query String Parameters`

```json
[
  {
    "参数名": "access_token",
    "类型": "string",
    "必填": "是",
    "说明": "接口调用凭证，可使用 [access_token](/minigame/dev/api-backend/access-token/api_getaccesstoken)"
  }
]
```

### 请求体 `Request Payload`

```json
[
  {
    "参数名": "ds_begin",
    "类型": "number",
    "必填": "是",
    "说明": "查询起始日期，格式 yyyyMMdd，例如 20260601"
  },
  {
    "参数名": "duration_days",
    "类型": "number",
    "必填": "是",
    "说明": "查询时长（天数），取值范围 [1, 7]，实际查询区间为 [ds_begin, ds_begin + duration_days - 1]，闭区间"
  },
  {
    "参数名": "offset",
    "类型": "number",
    "必填": "否",
    "说明": "分页起始偏移（0-based），默认 0"
  },
  {
    "参数名": "limit",
    "类型": "number",
    "必填": "否",
    "说明": "单页条数，默认 100，最大 1000，超过则按 1000 截断"
  }
]
```

## 3. 返回参数

### 返回体 `Response Payload`

```json
[
  {
    "参数名": "errcode",
    "类型": "number",
    "说明": "错误码"
  },
  {
    "参数名": "errmsg",
    "类型": "number",
    "说明": "错误信息"
  },
  {
    "参数名": "ds_begin",
    "类型": "number",
    "说明": "实际生效的起始日期 yyyyMMdd"
  },
  {
    "参数名": "ds_end",
    "类型": "number",
    "说明": "实际生效的截止日期 yyyyMMdd（含）"
  },
  {
    "参数名": "total_count",
    "类型": "number",
    "说明": "查询区间内的总命中行数（分页前），用于调用方判断是否还有下一页"
  },
  {
    "参数名": "rows",
    "类型": "objarray",
    "说明": "当前页数据列表，长度 ≤ limit"
  }
]
```

">

### Res.rows(Array) `Object Payload`

当前页数据列表，长度 ≤ limit

```json
[
  {
    "参数名": "openid",
    "类型": "array",
    "说明": "用户在该小游戏下的 openid"
  },
  {
    "参数名": "ds",
    "类型": "number",
    "说明": "命中时间，格式 yyyyMMddHH（精确到小时）"
  },
  {
    "参数名": "cheat_type",
    "类型": "number",
    "说明": "主作弊类型枚举值，1 内存挂；2 按键挂；3 JS 注入；4 JS 修改"
  },
  {
    "参数名": "risk_level",
    "类型": "number",
    "说明": "风险等级枚举值，0 未知；1 低危；2 中危；3 高危；4 严重"
  }
]
```

## 4. 注意事项

本接口无特殊注意事项

## 5. 代码示例

请求示例

```json
{
  "appid": "wx7a727ff7d940bb3f",
  "ds_begin": 20260601,
  "duration_days": 7,
  "offset": 0,
  "limit": 100
}
```

返回示例

```json
{
  "errcode": 0,
  "errmsg": "ok",
  "ds_begin": 20260601,
  "ds_end": 20260607,
  "total_count": 2,
  "rows": [
    {
      "openid": "oABC123xxxxxxxxxxxxxxxxxxxxxxx",
      "ds": 2026060114,
      "cheat_type": 3,
      "risk_level": 2
    },
    {
      "openid": "oDEF456xxxxxxxxxxxxxxxxxxxxxxx",
      "ds": 2026060209,
      "cheat_type": 1,
      "risk_level": 3
    }
  ]
}
```

## 6. 错误码

以下是本接口的错误码列表，其他错误码可参考 [通用错误码](/doc/oplatform/developers/errCode/README.md)；调用接口遇到报错，可使用官方提供的 [API 诊断工具](https://developers.weixin.qq.com/console/devtools/debug?utm_source=api_errcode) 辅助定位和分析问题。

```json
[
  {
    "错误码": "-1",
    "错误描述": "system error",
    "解决方案": "系统繁忙，此时请开发者稍候再试"
  },
  {
    "错误码": "40001",
    "错误描述": "invalid credential",
    "解决方案": "不合法的调用凭证"
  }
]
```

## 7. 适用范围

本接口支持「小游戏」账号类型调用。其他账号类型如无特殊说明，均不可调用。
