猜灯谜 是一款轻量级、无数据库依赖的在线答题接口,提供随机出题、答案验证、题目解析、收藏管理、答题统计等完整功能。支持按节日(元宵 / 中秋)、难度(简单 / 中等 / 困难)筛选题目,接口返回统一 JSON 格式,支持跨域,接入简单,可直接用于节日活动、小程序、H5 游戏、校园答题工具等场景。
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| uid | string | 是 | 用户唯一标识(自定义,如用户名/设备ID) | 1828222534 |
| action | string | 是 | 操作类型:random(随机出题)、verify(验证答案)、analysis(查看解析)、next(下一题)、collect(收藏/取消收藏)、collect_list(收藏列表)、stat(答题统计) | random |
| answer | string | 否 | 用户填写的答案(仅verify时必填) | 研 |
| rid | string | 否 | 灯谜ID(仅analysis、collect时必填) | 7 |
| festival | string | 否 | 节日类型:lantern(元宵)、midautumn(中秋) | lantern |
| difficulty | string | 否 | 难度类型:easy(简单)、medium(中等)、hard(困难) | easy |
| is_collect | string | 否 | 收藏操作:1(收藏),0(取消收藏),默认0 | 0 |
[
{
"name": "uid",
"type": "string",
"required": true,
"description": "用户唯一标识(自定义,如用户名/设备ID)",
"example": "1828222534"
},
{
"name": "action",
"type": "string",
"required": true,
"description": "操作类型:random(随机出题)、verify(验证答案)、analysis(查看解析)、next(下一题)、collect(收藏/取消收藏)、collect_list(收藏列表)、stat(答题统计)",
"example": "random"
},
{
"name": "answer",
"type": "string",
"required": false,
"description": "用户填写的答案(仅verify时必填)",
"example": "研"
},
{
"name": "rid",
"type": "string",
"required": false,
"description": "灯谜ID(仅analysis、collect时必填)",
"example": "7"
},
{
"name": "festival",
"type": "string",
"required": false,
"description": "节日类型:lantern(元宵)、midautumn(中秋)",
"example": "lantern"
},
{
"name": "difficulty",
"type": "string",
"required": false,
"description": "难度类型:easy(简单)、medium(中等)、hard(困难)",
"example": "easy"
},
{
"name": "is_collect",
"type": "string",
"required": false,
"description": "收藏操作:1(收藏),0(取消收藏),默认0",
"example": "0"
}
]
{"openapi":"3.1.1","info":{"title":"猜灯谜","description":"猜灯谜 是一款轻量级、无数据库依赖的在线答题接口,提供随机出题、答案验证、题目解析、收藏管理、答题统计等完整功能。支持按节日(元宵 / 中秋)、难度(简单 / 中等 / 困难)筛选题目,接口返回统一 JSON 格式,支持跨域,接入简单,可直接用于节日活动、小程序、H5 游戏、校园答题工具等场景。","version":"1.0.0"},"paths":{"/v1/game_cdm.php":{"get":{"summary":"猜灯谜","description":"猜灯谜 是一款轻量级、无数据库依赖的在线答题接口,提供随机出题、答案验证、题目解析、收藏管理、答题统计等完整功能。支持按节日(元宵 / 中秋)、难度(简单 / 中等 / 困难)筛选题目,接口返回统一 JSON 格式,支持跨域,接入简单,可直接用于节日活动、小程序、H5 游戏、校园答题工具等场景。","parameters":[{"name":"uid","in":"query","required":true,"schema":{"type":"string","example":"1828222534"},"description":"用户唯一标识(自定义,如用户名/设备ID)"},{"name":"action","in":"query","required":true,"schema":{"type":"string","example":"random"},"description":"操作类型:random(随机出题)、verify(验证答案)、analysis(查看解析)、next(下一题)、collect(收藏/取消收藏)、collect_list(收藏列表)、stat(答题统计)"},{"name":"answer","in":"query","required":false,"schema":{"type":"string","example":"研"},"description":"用户填写的答案(仅verify时必填)"},{"name":"rid","in":"query","required":false,"schema":{"type":"string","example":"7"},"description":"灯谜ID(仅analysis、collect时必填)"},{"name":"festival","in":"query","required":false,"schema":{"type":"string","example":"lantern"},"description":"节日类型:lantern(元宵)、midautumn(中秋)"},{"name":"difficulty","in":"query","required":false,"schema":{"type":"string","example":"easy"},"description":"难度类型:easy(简单)、medium(中等)、hard(困难)"},{"name":"is_collect","in":"query","required":false,"schema":{"type":"string","example":"0"},"description":"收藏操作:1(收藏),0(取消收藏),默认0"}],"responses":{"200":{"description":"成功","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"猜灯谜","description":"猜灯谜 是一款轻量级、无数据库依赖的在线答题接口,提供随机出题、答案验证、题目解析、收藏管理、答题统计等完整功能。支持按节日(元宵 / 中秋)、难度(简单 / 中等 / 困难)筛选题目,接口返回统一 JSON 格式,支持跨域,接入简单,可直接用于节日活动、小程序、H5 游戏、校园答题工具等场景。","parameters":[{"name":"uid","in":"query","required":true,"schema":{"type":"string","example":"1828222534"},"description":"用户唯一标识(自定义,如用户名/设备ID)"},{"name":"action","in":"query","required":true,"schema":{"type":"string","example":"random"},"description":"操作类型:random(随机出题)、verify(验证答案)、analysis(查看解析)、next(下一题)、collect(收藏/取消收藏)、collect_list(收藏列表)、stat(答题统计)"},{"name":"answer","in":"query","required":false,"schema":{"type":"string","example":"研"},"description":"用户填写的答案(仅verify时必填)"},{"name":"rid","in":"query","required":false,"schema":{"type":"string","example":"7"},"description":"灯谜ID(仅analysis、collect时必填)"},{"name":"festival","in":"query","required":false,"schema":{"type":"string","example":"lantern"},"description":"节日类型:lantern(元宵)、midautumn(中秋)"},{"name":"difficulty","in":"query","required":false,"schema":{"type":"string","example":"easy"},"description":"难度类型:easy(简单)、medium(中等)、hard(困难)"},{"name":"is_collect","in":"query","required":false,"schema":{"type":"string","example":"0"},"description":"收藏操作:1(收藏),0(取消收藏),默认0"}],"responses":{"200":{"description":"成功","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"servers":[{"url":"http://xiaoapi.cn","description":"当前访问入口(http)"}]}
{
"code": 200,
"data": {
"id": 7,
"title": "石达开(打一字)",
"type": "字谜",
"festival": "lantern",
"difficulty": "easy"
},
"tips": "慕名API:http://xiaoapi.cn"
}
猜灯谜是一款面向节日活动场景的文字答题接口,提供随机出题、答案验证、题目解析、收藏管理及答题统计等完整功能。支持按元宵、中秋等节日类型及简单、中等、困难难度筛选题目,适用于小程序、H5 游戏、校园答题等互动场景接入。
/v1/game_cdm.php
GET、POST
无需密钥,接入即可使用。
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| uid | string | 是 | 用户唯一标识(自定义,如用户名/设备ID) |
| action | string | 是 | 操作类型 |
| answer | string | 否 | 用户填写的答案(仅verify时必填) |
| rid | string | 否 | 灯谜ID(仅analysis、collect时必填) |
| festival | string | 否 | 节日类型 |
| difficulty | string | 否 | 难度类型 |
| is_collect | string | 否 | 收藏操作 |
| 值 | 说明 |
|---|---|
| random | 随机出题 |
| verify | 验证答案 |
| analysis | 查看解析 |
| next | 下一题 |
| collect | 收藏/取消收藏 |
| collect_list | 收藏列表 |
| stat | 答题统计 |
| 值 | 说明 |
|---|---|
| lantern | 元宵 |
| midautumn | 中秋 |
| 值 | 说明 |
|---|---|
| easy | 简单 |
| medium | 中等 |
| hard | 困难 |
| 值 | 说明 |
|---|---|
| 1 | 收藏 |
| 0 | 取消收藏(默认) |
{
"code": 200,
"data": {
"id": 7,
"title": "石达开(打一字)",
"type": "字谜",
"festival": "lantern",
"difficulty": "easy"
},
"tips": "慕名API:http://xiaoapi.cn"
}
| 字段名 | 类型 | 说明 |
|---|---|---|
| code | integer | 状态码,200 表示请求成功 |
| data | object | 返回数据对象,内容随 action 参数变化 |
| data.id | integer | 灯谜题目 ID |
| data.title | string | 灯谜题目内容 |
| data.type | string | 谜语类型,如"字谜" |
| data.festival | string | 节日类型,lantern 表示元宵,midautumn 表示中秋 |
| data.difficulty | string | 难度等级,easy 为简单,medium 为中等,hard 为困难 |
| tips | string | 接口提示信息 |
{
"code": 0,
"msg": "未提供调用密钥",
"errcode": 11001
}
{
"code": 0,
"msg": "积分余额不足",
"errcode": 11004
}
{
"code": 0,
"msg": "请求过于频繁,请稍后重试",
"errcode": 11005
}
| 错误码 | 说明 |
|---|---|
| 11001 | 未提供调用密钥 |
| 11002 | 密钥错误 |
| 11003 | 密钥已禁用 |
| 11004 | 积分余额不足 |
| 11005 | 请求过于频繁(QPM 限制) |
| 11006 | 接口维护中 |
| 11007 | 接口已禁用 |
| 11008 | 接口不可用 |
| 11009 | 密钥校验暂不可用 |
| 11010 | 积分系统暂不可用 |
| 11011 | 收费接口须提供有效密钥 |
| 11012 | 鉴权方式错误 |
| 11013 | 接口不存在 |
| 11014 | ***地址无效 |
| 11015 | ***地址不允许 |
| 11016 | ***请求失败 |
| 11017 | 服务暂不可用 |
| 11018 | 请求方式不允许 |
| 11019 | 当前IP不在白名单内 |
| 11020 | 启用出口代理须提供有效密钥 |
| 11021 | 未配置可用出口代理 |
| 11022 | 出口代理不可用 |
随机出题(按节日与难度筛选)
curl -X GET "http://xiaoapi.cn/v1/game_cdm.php?uid=1828222534&action=random&festival=lantern&difficulty=easy"
验证答案
curl -X GET "http://xiaoapi.cn/v1/game_cdm.php?uid=1828222534&action=verify&answer=研&rid=7"
查看解析
curl -X GET "http://xiaoapi.cn/v1/game_cdm.php?uid=1828222534&action=analysis&rid=7"
// 随机出题
$url = "http://xiaoapi.cn/v1/game_cdm.php?uid=1828222534&action=random&festival=lantern&difficulty=easy";
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data);
// 验证答案
$url = "http://xiaoapi.cn/v1/game_cdm.php?uid=1828222534&action=verify&answer=研&rid=7";
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data);
// 查看解析
$url = "http://xiaoapi.cn/v1/game_cdm.php?uid=1828222534&action=analysis&rid=7";
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data);
random 和 verify 外,其他 action 均需配合对应参数使用。analysis 和 collect 操作需传入对应灯谜的 rid;collect 操作需明确 is_collect 参数值(1 收藏 / 0 取消)。verify 校验答案时,answer 参数必填,答案内容需与谜底完全匹配,不区分全角/半角。festival)仅支持 lantern(元宵)和 midautumn(中秋);难度类型(difficulty)仅支持 easy、medium、hard。不传参时默认返回全部类型。curl -X POST "https://xiaoapi.cn/v1/game_cdm.php" -d "uid=1828222534&action=random&festival=lantern&difficulty=easy"
curl -X POST "https://xiaoapi.cn/v1/game_cdm.php" -d "uid=1828222534&action=verify&rid=7&answer=研"
curl -X POST "https://xiaoapi.cn/v1/game_cdm.php" -d "uid=1828222534&action=analysis&rid=7"
curl -X GET "https://xiaoapi.cn/v1/game_cdm.php?uid=1828222534&action=collect_list"
// 结果将在此处显示