脚本面板「题库地址」填下面这个(不要带 /api/answer):
https://dt.eehao.cn
如果 config.php 里设置了 token,脚本面板「访问令牌」填同一个字符串。
| 接口 | 方法 | 说明 |
|---|---|---|
/api/answer | POST | 批量答题(油猴脚本使用) |
/api/answer?q=题干 | GET | 单题查询,调试用 |
/api/health | GET | 健康检查 |
/api/query | POST | 批量查题(本页“查题”用) |
/api/extract | POST | 从试卷文本提取题干 |
/api/import | POST | 提交题库(文本或 JSON 数组) |
/api/list | GET | 分页浏览 / 搜索 |
/api/delete | POST | 删除单条 |
/api/stats | GET | 统计 |
/api/export | GET | 下载题库 JSON |
把 /api/xxx 换成 api.php?a=xxx 也能访问,不依赖服务器重写规则。
# 健康检查
curl https://dt.eehao.cn/api/health
# 单题查询
curl "https://dt.eehao.cn/api/answer?q=每年()为植树节"
# 批量答题(与油猴脚本同一格式)
curl -X POST https://dt.eehao.cn/api/answer \
-H "Content-Type: application/json" \
-H "Authorization: Bearer 你的令牌" \
-d '{"questions":[{"id":"q1","type":"single","title":"每年()为植树节","options":["A","B","C","D"]}]}'