diff --git a/CHANGELOG.md b/CHANGELOG.md index 278e7c9..02edf0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. --- + + ## [1.3.1] - 2026-03-29 ### 修复 diff --git a/ht/API_投票.md b/ht/API_投票.md deleted file mode 100644 index 51e480a..0000000 --- a/ht/API_投票.md +++ /dev/null @@ -1,1315 +0,0 @@ -# 投票系统 API 接口文档 - -## 概述 - -本文档描述了投票系统的所有API接口,包括用户管理、投票操作、投票主题管理、管理员功能和文件上传等功能。该API支持GET和POST两种请求方式,并支持JSON格式的请求体。 - -## 基础信息 - -- **基础URL**: `https://poe.vogov.cn/toupiao/` -- **请求方式**: GET / POST -- **数据格式**: JSON -- **字符编码**: UTF-8 -- **跨域支持**: 已启用CORS - -## 通用响应格式 - -所有接口返回统一的JSON格式: - -```json -{ - "code": 0, - "msg": "操作成功", - "data": {} -} -``` - -### 响应字段说明 - -| 字段名 | 类型 | 说明 | -|--------|------|------| -| code | int | 状态码,0表示成功,非0表示失败 | -| msg | string | 提示信息 | -| data | object/array | 返回数据,具体内容根据接口而定 | - ---- - -# 数据库结构 - -## 1. 用户表 (tp_users) - -| 字段名 | 类型 | 说明 | -|--------|------|------| -| id | int(11) | 用户ID,主键,自增 | -| username | varchar(255) | 用户账号(手机号/邮箱/微信号) | -| password | varchar(255) | 密码(加密存储) | -| irole | tinyint(1) | 角色(0:普通用户, 1:管理员) | -| status | tinyint(1) | 状态(0:禁用, 1:正常) | -| regtime | datetime | 注册时间 | -| logtime | datetime | 最后登录时间 | -| user_identifier | varchar(100) | 用户标识(可选) | - -## 2. 投票主题表 (tp_vote) - -| 字段名 | 类型 | 说明 | -|--------|------|------| -| id | int(11) | 主题ID,主键,自增 | -| title | varchar(255) | 投票标题 | -| idesc | text | 投票描述 | -| statime | datetime | 开始时间 | -| endtime | datetime | 结束时间 | -| status | tinyint(1) | 状态(0:禁用, 1:正常) | -| itype | tinyint(1) | 类型(0:单选, 1:多选) | -| maxtime | int(11) | 多选时最多可选几项 | -| addtime | datetime | 创建时间 | -| adduser | int(11) | 创建用户ID | -| iview | int(11) | 查看次数 | - -## 3. 投票选项表 (tp_xuan) - -| 字段名 | 类型 | 说明 | -|--------|------|------| -| id | int(11) | 选项ID,主键,自增 | -| topic_id | int(11) | 所属投票主题ID | -| name | varchar(255) | 选项名称 | -| idesc | text | 选项描述 | -| imgs | varchar(255) | 选项图片 | -| sort | int(11) | 排序值 | -| addtime | datetime | 创建时间 | -| adduser | int(11) | 创建用户ID | - -## 4. 投票记录表 (tp_recs) - -| 字段名 | 类型 | 说明 | -|--------|------|------| -| id | int(11) | 记录ID,主键,自增 | -| topic_id | int(11) | 投票主题ID | -| user_id | int(11) | 用户ID | -| option_id | int(11) | 选项ID | -| vote_time | datetime | 投票时间 | -| ip | varchar(50) | 投票IP | - -## 5. 系统日志表 (tp_logs) - -| 字段名 | 类型 | 说明 | -|--------|------|------| -| id | int(11) | 日志ID,主键,自增 | -| user_id | int(11) | 用户ID | -| action | varchar(50) | 操作类型 | -| idesc | text | 操作描述 | -| ip | varchar(50) | 操作IP | -| logtime | datetime | 操作时间 | - ---- - -# 一、用户API (tapi.php) - -**接口地址**: `/tapi.php` - -## 1.1 用户登录 - -**接口描述**: 用户使用账号(手机号/邮箱/微信号)和密码登录系统 - -**请求方式**: GET / POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:login | -| username | string | 是 | 用户账号,支持手机号、邮箱或微信号 | -| password | string | 是 | 用户密码 | - -**请求示例**: - -``` -POST /tapi.php -Content-Type: application/json - -{ - "act": "login", - "username": "13800138000", - "password": "123456" -} -``` - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "登录成功", - "data": { - "id": 1, - "username": "13800138000", - "irole": 0, - "status": 1, - "regtime": "2026-03-27 10:00:00", - "logtime": "2026-03-27 14:30:00", - "user_identifier": "user123" - } -} -``` - -**错误码说明**: - -| 错误码 | 说明 | -|--------|------| -| 1 | 账号和密码不能为空 | -| 1 | 账号或密码错误 | -| 1 | 账号已被禁用,请联系管理员 | - ---- - -## 1.2 用户注册 - -**接口描述**: 新用户注册账号,支持手机号、邮箱或微信号作为账号 - -**请求方式**: GET / POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:register | -| username | string | 是 | 用户账号,支持手机号、邮箱或微信号 | -| password | string | 是 | 用户密码,长度不少于6位 | -| user_identifier | string | 否 | 用户标识(可选) | - -**账号格式要求**: - -- **手机号**: 以1开头,第二位为3-9,共11位数字 -- **邮箱**: 标准邮箱格式,如 user@example.com -- **微信号**: 6-20位字母、数字、下划线或连字符 - -**请求示例**: - -``` -POST /tapi.php -Content-Type: application/json - -{ - "act": "register", - "username": "13800138000", - "password": "123456", - "user_identifier": "user123" -} -``` - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "注册成功", - "data": {} -} -``` - -**错误码说明**: - -| 错误码 | 说明 | -|--------|------| -| 1 | 账号和密码不能为空 | -| 1 | 请输入正确的手机号、邮箱或微信号 | -| 1 | 密码长度不能少于6位 | -| 1 | 该账号已被注册 | -| 1 | 注册失败,请稍后重试 | - ---- - -## 1.3 获取用户信息 - -**接口描述**: 获取当前登录用户的详细信息 - -**请求方式**: GET / POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getUserInfo | - -**请求示例**: - -``` -GET /tapi.php?act=getUserInfo -``` - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "获取成功", - "data": { - "id": 1, - "username": "13800138000", - "irole": 0, - "status": 1, - "regtime": "2026-03-27 10:00:00", - "logtime": "2026-03-27 14:30:00", - "user_identifier": "user123" - } -} -``` - -**注意**: 此接口需要用户已登录,否则会返回错误。 - ---- - -## 1.4 用户登出 - -**接口描述**: 用户退出登录,清除session - -**请求方式**: GET / POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:logout | - -**请求示例**: - -``` -GET /tapi.php?act=logout -``` - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "登出成功", - "data": {} -} -``` - ---- - -## 1.5 更新用户标识 - -**接口描述**: 更新当前登录用户的标识信息 - -**请求方式**: GET / POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:updateUserIdentifier | -| user_identifier | string | 否 | 用户标识(可选),长度不超过100个字符 | - -**请求示例**: - -``` -POST /tapi.php -Content-Type: application/json - -{ - "act": "updateUserIdentifier", - "user_identifier": "new_identifier" -} -``` - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "更新成功", - "data": { - "id": 1, - "username": "13800138000", - "irole": 0, - "status": 1, - "regtime": "2026-03-27 10:00:00", - "logtime": "2026-03-27 14:30:00", - "user_identifier": "new_identifier" - } -} -``` - -**注意**: 此接口需要用户已登录,否则会返回错误。 - ---- - -# 二、投票API (vote_api.php) - -**接口地址**: `/vote_api.php` - -## 2.1 获取投票列表 - -**接口描述**: 获取投票列表,支持分页和筛选 - -**请求方式**: GET / POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getVoteList | -| page | int | 否 | 当前页码,默认1 | -| pageSize | int | 否 | 每页记录数,默认10 | -| status | int | 否 | 状态筛选,-1表示全部,0表示禁用,1表示正常 | -| type | int | 否 | 类型筛选,-1表示全部,0表示单选,1表示多选 | - -**请求示例**: - -``` -GET /vote_api.php?act=getVoteList&page=1&pageSize=10 -``` - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "获取成功", - "data": { - "list": [ - { - "id": 1, - "title": "最喜欢的水果", - "idesc": "请选择您最喜欢的水果", - "itype": 0, - "maxtime": 1, - "status": 1, - "iview": 14, - "addtime": "2026-03-25 22:25:46", - "statime": "2026-03-24 22:25:46", - "endtime": "2026-04-01 22:25:46", - "status_text": "进行中", - "status_class": "vote-status-active" - } - ], - "pagination": { - "total": 1, - "page": 1, - "pageSize": 10, - "totalPage": 1, - "offset": 0 - } - } -} -``` - -### 投票项字段说明 (VoteItem) - -| 字段名 | 类型 | 说明 | -|--------|------|------| -| id | int | 投票ID | -| title | string | 投票标题 | -| idesc | string | 投票描述 | -| itype | int | 类型(0:单选, 1:多选) | -| maxtime | int | 多选时最多可选几项 | -| status | int | 状态(0:禁用, 1:正常) | -| iview | int | 查看次数 | -| addtime | string | 创建时间 | -| statime | string | 开始时间 | -| endtime | string | 结束时间 | -| status_text | string | 状态文本(进行中/已结束/未开始/已禁用) | -| status_class | string | 状态样式类 | - -### 状态说明 - -| status_text | status_class | 说明 | -|-------------|--------------|------| -| 进行中 | vote-status-active | 投票正在进行中 | -| 已结束 | vote-status-ended | 投票已结束 | -| 未开始 | vote-status-pending | 投票尚未开始 | -| 已禁用 | vote-status-disabled | 投票已被禁用 | - ---- - -## 2.2 获取投票详情 - -**接口描述**: 获取投票详情和选项信息 - -**请求方式**: GET / POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getVoteDetail | -| id | int | 是 | 投票ID | - -**请求示例**: - -``` -GET /vote_api.php?act=getVoteDetail&id=1 -``` - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "获取成功", - "data": { - "vote": { - "id": 1, - "title": "最喜欢的水果", - "idesc": "请选择您最喜欢的水果", - "itype": 0, - "maxtime": 1, - "status": 1, - "iview": 15, - "addtime": "2026-03-25 22:25:46", - "statime": "2026-03-24 22:25:46", - "endtime": "2026-04-01 22:25:46", - "status_text": "进行中", - "status_class": "vote-status-active" - }, - "options": [ - { - "id": 1, - "topic_id": 1, - "name": "苹果", - "idesc": "红富士苹果", - "imgs": "", - "sort": 0 - }, - { - "id": 2, - "topic_id": 1, - "name": "香蕉", - "idesc": "进口香蕉", - "imgs": "", - "sort": 1 - } - ], - "hasVoted": false, - "userVotes": [], - "canVote": true - } -} -``` - -### 响应字段说明 - -| 字段名 | 类型 | 说明 | -|--------|------|------| -| vote | object | 投票详情 | -| options | array | 选项列表 | -| hasVoted | bool | 当前用户是否已投票 | -| userVotes | array | 当前用户已投的选项ID列表 | -| canVote | bool | 是否可以投票 | - -### 选项字段说明 (VoteOption) - -| 字段名 | 类型 | 说明 | -|--------|------|------| -| id | int | 选项ID | -| topic_id | int | 所属投票主题ID | -| name | string | 选项名称 | -| idesc | string | 选项描述 | -| imgs | string | 选项图片URL | -| sort | int | 排序值 | - -**错误码说明**: - -| 错误码 | 说明 | -|--------|------| -| 1 | 参数错误 | -| 1 | 投票不存在 | - ---- - -## 2.3 提交投票 - -**接口描述**: 提交用户的投票选择 - -**请求方式**: GET / POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:submitVote | -| topic_id | int | 是 | 投票ID | -| options | array/string | 是 | 选项ID数组或逗号分隔的字符串 | - -**请求示例**: - -``` -POST /vote_api.php -Content-Type: application/json - -{ - "act": "submitVote", - "topic_id": 1, - "options": [1, 2] -} -``` - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "投票成功", - "data": {} -} -``` - -**错误码说明**: - -| 错误码 | 说明 | -|--------|------| -| 1 | 请先登录 | -| 1 | 参数错误 | -| 1 | 请至少选择一个选项 | -| 1 | 投票不存在 | -| 1 | 该投票已被禁用 | -| 1 | 该投票尚未开始 | -| 1 | 该投票已经结束 | -| 1 | 您已经参与过该投票 | -| 1 | 最多只能选择 X 项 | -| 1 | 选项不存在 | -| 1 | 提交投票失败 | - -**注意**: 此接口需要用户已登录,否则会返回错误。 - ---- - -## 2.4 获取投票结果 - -**接口描述**: 获取投票结果和统计数据 - -**请求方式**: GET / POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getVoteResult | -| id | int | 是 | 投票ID | - -**请求示例**: - -``` -GET /vote_api.php?act=getVoteResult&id=1 -``` - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "获取成功", - "data": { - "vote": { - "id": 1, - "title": "最喜欢的水果", - "idesc": "请选择您最喜欢的水果", - "itype": 0, - "maxtime": 1, - "status": 1, - "iview": 15, - "addtime": "2026-03-25 22:25:46", - "statime": "2026-03-24 22:25:46", - "endtime": "2026-04-01 22:25:46" - }, - "options": [ - { - "id": 1, - "name": "苹果", - "idesc": "红富士苹果", - "imgs": "", - "count": 50, - "percentage": 50 - }, - { - "id": 2, - "name": "香蕉", - "idesc": "进口香蕉", - "imgs": "", - "count": 30, - "percentage": 30 - }, - { - "id": 3, - "name": "橙子", - "idesc": "新鲜橙子", - "imgs": "", - "count": 20, - "percentage": 20 - } - ], - "totalVotes": 100, - "hasVoted": true, - "userVotes": [1] - } -} -``` - -### 结果选项字段说明 (VoteResultOption) - -| 字段名 | 类型 | 说明 | -|--------|------|------| -| id | int | 选项ID | -| name | string | 选项名称 | -| idesc | string | 选项描述 | -| imgs | string | 选项图片URL | -| count | int | 投票数量 | -| percentage | float | 投票百分比 | - -**错误码说明**: - -| 错误码 | 说明 | -|--------|------| -| 1 | 参数错误 | -| 1 | 投票不存在 | -| 1 | 暂无投票选项 | - ---- - -## 2.5 获取用户投票记录 - -**接口描述**: 获取用户参与过的投票记录 - -**请求方式**: GET / POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getUserVotes | -| page | int | 否 | 当前页码,默认1 | -| pageSize | int | 否 | 每页记录数,默认10 | - -**请求示例**: - -``` -GET /vote_api.php?act=getUserVotes&page=1&pageSize=10 -``` - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "获取成功", - "data": { - "list": [ - { - "id": 1, - "title": "最喜欢的水果", - "idesc": "请选择您最喜欢的水果", - "itype": 0, - "maxtime": 1, - "status": 1, - "iview": 15, - "addtime": "2026-03-25 22:25:46", - "statime": "2026-03-24 22:25:46", - "endtime": "2026-04-01 22:25:46", - "status_text": "进行中", - "status_class": "vote-status-active" - } - ], - "pagination": { - "total": 1, - "page": 1, - "pageSize": 10, - "totalPage": 1, - "offset": 0 - } - } -} -``` - -**注意**: 此接口需要用户已登录,否则会返回错误。 - ---- - -# 三、用户API (api/user.php) - -**接口地址**: `/api/user.php` - -## 3.1 用户登录 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:login | -| username | string | 是 | 用户账号 | -| password | string | 是 | 用户密码 | - ---- - -## 3.2 用户注册 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:register | -| username | string | 是 | 用户账号 | -| password | string | 是 | 用户密码 | -| user_identifier | string | 否 | 用户标识 | - ---- - -## 3.3 用户登出 - -**请求方式**: GET/POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:logout | - -**注意**: 登出后会重定向到首页。 - ---- - -## 3.4 获取用户信息 - -**请求方式**: GET/POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getUserInfo | - ---- - -## 3.5 更新用户信息(修改密码) - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:updateUserInfo | -| new_password | string | 是 | 新密码 | -| confirm_password | string | 是 | 确认密码 | - ---- - -## 3.6 更新用户标识 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:updateUserIdentifier | -| user_identifier | string | 否 | 用户标识 | - ---- - -# 四、投票操作API (api/vote.php) - -**接口地址**: `/api/vote.php` - -## 4.1 提交投票 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:submit | -| topic_id | int | 是 | 投票ID | -| options | string | 是 | 选项ID,多个用逗号分隔 | - ---- - -## 4.2 检查是否已投票 - -**请求方式**: GET/POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:checkVoted | -| topic_id | int | 是 | 投票ID | - -**响应示例**: -```json -{ - "code": 0, - "msg": "查询成功", - "data": { - "hasVoted": true - } -} -``` - ---- - -## 4.3 获取投票结果 - -**请求方式**: GET/POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getResult | -| topic_id | int | 是 | 投票ID | - ---- - -# 五、投票主题管理API (api/topic.php) - -**接口地址**: `/api/topic.php` - -**注意**: 大部分接口需要管理员权限 - -## 5.1 获取投票主题列表 - -**请求方式**: GET/POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getList | -| page | int | 否 | 当前页码,默认1 | -| page_size | int | 否 | 每页记录数,默认10 | -| status | int | 否 | 状态筛选 | -| type | int | 否 | 类型筛选 | -| keyword | string | 否 | 关键词搜索 | - -**权限要求**: 管理员 - ---- - -## 5.2 获取投票主题详情 - -**请求方式**: GET/POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getDetail | -| id | int | 是 | 投票ID | - ---- - -## 5.3 添加投票主题 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:add | -| title | string | 是 | 投票标题 | -| desc | string | 否 | 投票描述 | -| statime | string | 是 | 开始时间 | -| endtime | string | 是 | 结束时间 | -| type | int | 否 | 类型(0:单选, 1:多选),默认0 | -| maxtime | int | 否 | 多选时最多可选几项,默认1 | -| status | int | 否 | 状态,默认1 | - -**权限要求**: 管理员 - ---- - -## 5.4 更新投票主题 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:update | -| id | int | 是 | 投票ID | -| title | string | 是 | 投票标题 | -| desc | string | 否 | 投票描述 | -| statime | string | 是 | 开始时间 | -| endtime | string | 是 | 结束时间 | -| type | int | 否 | 类型 | -| maxtime | int | 否 | 多选时最多可选几项 | -| status | int | 否 | 状态 | - -**权限要求**: 管理员 - ---- - -## 5.5 删除投票主题 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:delete | -| id | int | 是 | 投票ID | - -**权限要求**: 管理员 - -**注意**: 删除投票主题会同时删除相关的选项和投票记录。 - ---- - -## 5.6 获取投票选项 - -**请求方式**: GET/POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getOptions | -| topic_id | int | 是 | 投票ID | - ---- - -## 5.7 添加投票选项 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:addOption | -| topic_id | int | 是 | 投票ID | -| name | string | 是 | 选项名称 | -| imgs | string | 否 | 选项图片URL | -| desc | string | 否 | 选项描述 | -| sort | int | 否 | 排序值,默认0 | - -**权限要求**: 管理员 - ---- - -## 5.8 更新投票选项 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:updateOption | -| id | int | 是 | 选项ID | -| name | string | 是 | 选项名称 | -| imgs | string | 否 | 选项图片URL | -| desc | string | 否 | 选项描述 | -| sort | int | 否 | 排序值 | - -**权限要求**: 管理员 - ---- - -## 5.9 删除投票选项 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:deleteOption | -| id | int | 是 | 选项ID | - -**权限要求**: 管理员 - -**注意**: 删除选项会同时删除相关的投票记录。 - ---- - -# 六、管理员API (api/admin.php) - -**接口地址**: `/api/admin.php` - -**权限要求**: 所有接口都需要管理员权限 - -## 6.1 添加用户 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:addUser | -| username | string | 是 | 用户名(手机号) | -| password | string | 是 | 密码 | -| role | int | 否 | 角色(0:普通用户, 1:管理员),默认0 | - ---- - -## 6.2 更新用户信息 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:updateUser | -| id | int | 是 | 用户ID | -| role | int | 否 | 角色 | -| status | int | 否 | 状态 | - ---- - -## 6.3 重置用户密码 - -**请求方式**: POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:resetPassword | -| id | int | 是 | 用户ID | -| password | string | 是 | 新密码 | - ---- - -## 6.4 获取投票统计数据 - -**请求方式**: GET/POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getVoteStats | -| topic_id | int | 否 | 投票ID,不传则返回所有投票统计 | - -**响应示例** (指定投票): -```json -{ - "code": 0, - "msg": "获取成功", - "data": { - "vote": { ... }, - "options": [ - { - "id": 1, - "name": "苹果", - "count": 50, - "percentage": 50 - } - ], - "totalVotes": 100, - "participants": [ - { - "username": "13800138000", - "vote_time": "2026-03-27 10:00:00", - "ip": "127.0.0.1" - } - ] - } -} -``` - ---- - -## 6.5 获取系统日志 - -**请求方式**: GET/POST - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| act | string | 是 | 操作类型,固定值:getLogs | -| page | int | 否 | 当前页码,默认1 | -| page_size | int | 否 | 每页记录数,默认20 | -| user_id | int | 否 | 用户ID筛选 | -| action | string | 否 | 操作类型筛选 | -| start_date | string | 否 | 开始日期 | -| end_date | string | 否 | 结束日期 | - ---- - -# 七、文件上传API (api/upload.php) - -**接口地址**: `/api/upload.php` - -**权限要求**: 需要用户登录 - -## 7.1 上传图片 - -**请求方式**: POST (multipart/form-data) - -**请求参数**: - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| image | file | 是 | 图片文件 | - -**支持的图片格式**: JPG, PNG, GIF, WEBP - -**文件大小限制**: 最大10MB - -**图片处理**: 宽度大于1280px的图片会自动调整为1024px宽度 - -**响应示例** (成功): -```json -{ - "code": 0, - "msg": "上传成功", - "data": { - "url": "uploads/img_123456789_20260329.jpg", - "width": 1024, - "height": 768 - } -} -``` - -**错误码说明**: - -| 错误码 | 说明 | -|--------|------| -| 1001 | 请先登录 | -| 1002 | 请求方法错误 | -| 1003 | 上传失败 | -| 1004 | 只允许上传JPG、PNG、GIF和WEBP格式的图片 | -| 1005 | 文件大小超过限制,最大允许10MB | -| 1006 | 无效的图片文件 | -| 1007 | 不支持的图片格式 | -| 1008 | 文件保存失败 | - ---- - -# 八、跨域支持 - -本API已启用CORS,支持跨域请求。相关响应头: - -``` -Access-Control-Allow-Origin: * -Access-Control-Allow-Methods: GET, POST, OPTIONS -Access-Control-Allow-Headers: Content-Type, Authorization -``` - -对于OPTIONS预检请求,API会直接返回200状态码。 - ---- - -# 九、注意事项 - -1. **Session管理**: 登录成功后,服务器会创建session,后续请求需要携带session cookie -2. **密码安全**: 密码使用PHP的password_hash()函数加密存储 -3. **参数验证**: 所有输入参数都经过安全过滤,防止SQL注入和XSS攻击 -4. **错误处理**: 所有接口都有完善的错误处理机制,返回明确的错误信息 -5. **日志记录**: 重要操作(登录、注册、登出、投票)都会记录到系统日志中 -6. **投票限制**: 每个用户对每个投票只能投一次 -7. **权限控制**: 管理员接口需要验证用户角色(irole=1) - ---- - -# 十、使用示例 - -## JavaScript (Fetch API) - -```javascript -// 登录示例 -fetch('https://poe.vogov.cn/toupiao/tapi.php', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - act: 'login', - username: '13800138000', - password: '123456' - }), - credentials: 'include' // 携带cookie -}) -.then(response => response.json()) -.then(data => { - if (data.code === 0) { - console.log('登录成功', data.data); - } else { - console.error('登录失败', data.msg); - } -}); - -// 获取投票列表 -fetch('https://poe.vogov.cn/toupiao/vote_api.php?act=getVoteList&page=1&pageSize=10', { - credentials: 'include' -}) -.then(response => response.json()) -.then(data => { - if (data.code === 0) { - console.log('投票列表', data.data.list); - } -}); - -// 提交投票 -fetch('https://poe.vogov.cn/toupiao/vote_api.php', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - act: 'submitVote', - topic_id: 1, - options: [1, 2] - }), - credentials: 'include' -}) -.then(response => response.json()) -.then(data => { - if (data.code === 0) { - console.log('投票成功'); - } -}); -``` - -## Flutter (Dio) - -```dart -import 'package:dio/dio.dart'; - -final dio = Dio(BaseOptions( - baseUrl: 'https://poe.vogov.cn/toupiao/', - headers: { - 'Content-Type': 'application/json', - }, -)); - -// 登录 -final response = await dio.post('tapi.php', data: { - 'act': 'login', - 'username': '13800138000', - 'password': '123456', -}); - -if (response.data['code'] == 0) { - print('登录成功: ${response.data['data']}'); -} - -// 获取投票列表 -final voteResponse = await dio.get('vote_api.php', queryParameters: { - 'act': 'getVoteList', - 'page': 1, - 'pageSize': 10, -}); - -if (voteResponse.data['code'] == 0) { - final list = voteResponse.data['data']['list']; - print('投票列表: $list'); -} -``` - ---- - -# 十一、版本历史 - -- **V1.3** (2026-03-29): 完善API文档,添加数据库结构说明,添加所有API接口详细文档 -- **V1.2** (2026-03-27): 添加了更新用户标识接口,允许用户在登录后更新自己的用户标识 -- **V1.1** (2026-03-27): 添加了用户标识字段(user_identifier),允许用户在注册时提供可选的用户标识 -- **V1.0** (2026-03-27): 初始版本,提供用户登录、注册、获取用户信息和登出功能 - ---- - -*最后更新时间: 2026-03-29* diff --git a/ht/API使用文档.md b/ht/API使用文档.md new file mode 100644 index 0000000..38ecc8b --- /dev/null +++ b/ht/API使用文档.md @@ -0,0 +1,545 @@ +# 诗词收录系统 - API 使用文档 + +## 概述 + +本文档描述诗词收录系统的 API 接口使用方法。 + +## 基础信息 + +- **API 地址**: `api.php` +- **请求方式**: GET/POST +- **返回格式**: JSON +- **字符编码**: UTF-8 + +## API 接口 + +### 1. 获取分类列表 + +获取所有可用的诗词分类。 + +**接口地址**: `api.php?api=categories` + +**请求方式**: GET + +**请求参数**: 无 + +**返回示例**: + +```json +{ + "ok": true, + "categories": [ + { + "id": "1", + "sid": "1", + "icon": "fa-paper-plane", + "catename": "诗词句", + "alias": null, + "create_time": "2026-03-12 04:17:50", + "update_time": "2026-03-13 02:12:54" + } + ], + "debug": { + "current_dir": "/www/wwwroot/yy.vogov.cn/api/app", + "categories_count": 3 + } +} +``` + +--- + +### 2. 检查诗词名称是否存在 + +检查指定的诗词名称是否已存在于数据库中(支持相似度检查)。 + +**接口地址**: `api.php?api=check-name` + +**请求方式**: POST + +**请求参数**: + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| name | string | 是 | 诗词名称/参考语句 | +| threshold | int | 否 | 相似度阈值(0-100),默认 80 | + +**请求示例**: + +```javascript +const formData = new FormData(); +formData.append('name', '盈盈一水间,脉脉不得语'); +formData.append('threshold', 80); + +const response = await fetch('api.php?api=check-name', { + method: 'POST', + body: formData +}); + +const data = await response.json(); +``` + +**返回示例**: + +**无相似内容**: +```json +{ + "ok": true, + "exists": false, + "similar_count": 0, + "max_similarity": 0, + "threshold": 80 +} +``` + +**发现相似内容**: +```json +{ + "ok": true, + "exists": true, + "similar_count": 2, + "max_similarity": 95, + "threshold": 80 +} +``` + +**返回字段说明**: + +| 字段名 | 类型 | 说明 | +|--------|------|------| +| ok | boolean | 请求是否成功 | +| exists | boolean | 是否存在相似内容,true=存在,false=不存在 | +| similar_count | int | 相似内容条数 | +| max_similarity | float | 最高相似度百分比(0-100) | +| threshold | int | 使用的相似度阈值 | + +--- + +### 3. 提交诗词收录申请 + +提交诗词收录申请到数据库。 + +**接口地址**: `api.php?api=submit` + +**请求方式**: POST + +**请求参数**: + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| name | string | 是 | 诗词名称/参考语句 | +| catename | string | 是 | 分类名称 | +| url | string | 是 | 诗人和标题 | +| keywords | string | 是 | 关键词,多个用逗号分隔 | +| introduce | string | 是 | 诗词介绍 | +| img | string | 否 | 平台/配图,默认值: 'default' | +| captcha | string | 是 | 人机验证码 | +| threshold | int | 否 | 相似度阈值(0-100),默认 80 | + +**请求示例**: + +```javascript +const formData = new FormData(); +formData.append('name', '盈盈一水间,脉脉不得语'); +formData.append('catename', '诗词句'); +formData.append('url', '古诗十九首'); +formData.append('keywords', '爱情,古诗,离别'); +formData.append('introduce', '《迢迢牵牛星》是产生于汉代的一首文人五言诗...'); +formData.append('img', 'iOS Swift'); +formData.append('captcha', '1234'); +formData.append('threshold', 80); + +const response = await fetch('api.php?api=submit', { + method: 'POST', + body: formData +}); + +const data = await response.json(); +``` + +**返回示例**: + +**成功**: +```json +{ + "ok": true, + "message": "✅ 提交成功!等待审核", + "debug": { + "input_data": {...}, + "insert_result": true, + "last_insert_id": "123" + } +} +``` + +**失败**: +```json +{ + "ok": false, + "error": "该诗词已存在!", + "debug": {...} +} +``` + +**返回字段说明**: + +| 字段名 | 类型 | 说明 | +|--------|------|------| +| ok | boolean | 请求是否成功 | +| message | string | 成功消息(仅成功时返回) | +| error | string | 错误消息(仅失败时返回) | +| debug | object | 调试信息 | + +--- + +## 在 App 中的使用方法 + +### Android (Kotlin) + +```kotlin +// 获取分类 +suspend fun getCategories(): List { + val response = OkHttpClient().newCall( + Request.Builder() + .url("https://your-domain.com/api.php?api=categories") + .build() + ).execute() + + val json = JSONObject(response.body?.string()) + val categoriesArray = json.getJSONArray("categories") + + val categories = mutableListOf() + for (i in 0 until categoriesArray.length()) { + val cat = categoriesArray.getJSONObject(i) + categories.add(Category(cat.getString("catename"))) + } + + return categories +} + +// 检查名称 +suspend fun checkName(name: String, threshold: Int = 80): CheckResult { + val formBody = FormBody.Builder() + .add("name", name) + .add("threshold", threshold.toString()) + .build() + + val response = OkHttpClient().newCall( + Request.Builder() + .url("https://your-domain.com/api.php?api=check-name") + .post(formBody) + .build() + ).execute() + + val json = JSONObject(response.body?.string()) + return CheckResult( + exists = json.getBoolean("exists"), + similarCount = json.getInt("similar_count"), + maxSimilarity = json.getDouble("max_similarity"), + threshold = json.getInt("threshold") + ) +} + +// 提交收录 +suspend fun submitPoem(data: PoemData): Boolean { + val formBody = FormBody.Builder() + .add("name", data.name) + .add("catename", data.catename) + .add("url", data.url) + .add("keywords", data.keywords) + .add("introduce", data.introduce) + .add("img", data.img ?: "default") + .add("captcha", data.captcha) + .add("threshold", data.threshold?.toString() ?: "80") + .build() + + val response = OkHttpClient().newCall( + Request.Builder() + .url("https://your-domain.com/api.php?api=submit") + .post(formBody) + .build() + ).execute() + + val json = JSONObject(response.body?.string()) + return json.getBoolean("ok") +} +``` + +### iOS (Swift) + +```swift +// 获取分类 +func getCategories(completion: @escaping ([String]?, Error?) -> Void) { + guard let url = URL(string: "https://your-domain.com/api.php?api=categories") else { + completion(nil, NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey: "Invalid URL"])) + return + } + + URLSession.shared.dataTask(with: url) { data, response, error in + if let error = error { + completion(nil, error) + return + } + + guard let data = data else { + completion(nil, NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey: "No data"])) + return + } + + do { + if let json = try JSONSerialization.jsonObject(with: data) as? [String: Any], + let categories = json["categories"] as? [[String: Any]] { + let categoryNames = categories.compactMap { $0["catename"] as? String } + completion(categoryNames, nil) + } + } catch { + completion(nil, error) + } + }.resume() +} + +// 检查名称 +func checkName(name: String, threshold: Int = 80, completion: @escaping (CheckResult?, Error?) -> Void) { + guard let apiUrl = URL(string: "https://your-domain.com/api.php?api=check-name") else { + completion(nil, NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey: "Invalid URL"])) + return + } + + var request = URLRequest(url: apiUrl) + request.httpMethod = "POST" + + let parameters = [ + "name": name, + "threshold": "\(threshold)" + ] + + request.httpBody = parameters.percentEncoded() + + URLSession.shared.dataTask(with: request) { data, response, error in + if let error = error { + completion(nil, error) + return + } + + guard let data = data else { + completion(nil, NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey: "No data"])) + return + } + + do { + if let json = try JSONSerialization.jsonObject(with: data) as? [String: Any], + let exists = json["exists"] as? Bool, + let similarCount = json["similar_count"] as? Int, + let maxSimilarity = json["max_similarity"] as? Double, + let threshold = json["threshold"] as? Int { + let result = CheckResult( + exists: exists, + similarCount: similarCount, + maxSimilarity: maxSimilarity, + threshold: threshold + ) + completion(result, nil) + } + } catch { + completion(nil, error) + } + }.resume() +} + +// 提交收录 +func submitPoem(name: String, catename: String, url: String, keywords: String, introduce: String, img: String?, captcha: String, threshold: Int = 80, completion: @escaping (Bool, String?) -> Void) { + guard let apiUrl = URL(string: "https://your-domain.com/api.php?api=submit") else { + completion(false, "Invalid URL") + return + } + + var request = URLRequest(url: apiUrl) + request.httpMethod = "POST" + + let parameters = [ + "name": name, + "catename": catename, + "url": url, + "keywords": keywords, + "introduce": introduce, + "img": img ?? "default", + "captcha": captcha, + "threshold": "\(threshold)" + ] + + request.httpBody = parameters.percentEncoded() + + URLSession.shared.dataTask(with: request) { data, response, error in + if let error = error { + completion(false, error.localizedDescription) + return + } + + guard let data = data else { + completion(false, "No data") + return + } + + do { + if let json = try JSONSerialization.jsonObject(with: data) as? [String: Any], + let ok = json["ok"] as? Bool { + let message = json["message"] as? String ?? json["error"] as? String + completion(ok, message) + } + } catch { + completion(false, error.localizedDescription) + } + }.resume() +} + +extension Dictionary { + func percentEncoded() -> Data? { + return map { key, value in + let escapedKey = "\(key)".addingPercentEncoding(withAllowedCharacters: .urlQueryValueAllowed) ?? "" + let escapedValue = "\(value)".addingPercentEncoding(withAllowedCharacters: .urlQueryValueAllowed) ?? "" + return escapedKey + "=" + escapedValue + } + .joined(separator: "&") + .data(using: .utf8) + } +} + +extension CharacterSet { + static let urlQueryValueAllowed: CharacterSet = { + let generalDelimitersToEncode = ":#[]@" + let subDelimitersToEncode = "!$&'()*+,;=" + + var allowed = CharacterSet.urlQueryAllowed + allowed.remove(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)") + return allowed + }() +} +``` + +### Flutter (Dart) + +```dart +import 'package:http/http.dart' as http; +import 'dart:convert'; + +// 获取分类 +Future> getCategories() async { + final response = await http.get( + Uri.parse('https://your-domain.com/api.php?api=categories'), + ); + + if (response.statusCode == 200) { + final data = json.decode(response.body); + final List categories = data['categories']; + return categories.map((cat) => cat['catename'] as String).toList(); + } else { + throw Exception('Failed to load categories'); + } +} + +// 检查名称 +Future checkName({ + required String name, + int threshold = 80, +}) async { + final response = await http.post( + Uri.parse('https://your-domain.com/api.php?api=check-name'), + body: { + 'name': name, + 'threshold': threshold.toString(), + }, + ); + + if (response.statusCode == 200) { + final data = json.decode(response.body); + return CheckResult( + exists: data['exists'] as bool, + similarCount: data['similar_count'] as int, + maxSimilarity: (data['max_similarity'] as num).toDouble(), + threshold: data['threshold'] as int, + ); + } else { + throw Exception('Failed to check name'); + } +} + +// 提交收录 +Future submitPoem({ + required String name, + required String catename, + required String url, + required String keywords, + required String introduce, + String? img, + required String captcha, + int threshold = 80, +}) async { + final response = await http.post( + Uri.parse('https://your-domain.com/api.php?api=submit'), + body: { + 'name': name, + 'catename': catename, + 'url': url, + 'keywords': keywords, + 'introduce': introduce, + 'img': img ?? 'default', + 'captcha': captcha, + 'threshold': threshold.toString(), + }, + ); + + if (response.statusCode == 200) { + final data = json.decode(response.body); + return data['ok'] as bool; + } else { + throw Exception('Failed to submit'); + } +} +``` + +--- + +## 错误码说明 + +| 错误信息 | 说明 | +|----------|------| +| 缺少必填字段:xxx | 必填字段未填写 | +| 该诗词已存在! | 诗词名称已在数据库中,或相似度超过阈值 | +| ❌ 数据库写入失败:无法插入数据 | 数据库插入失败 | +| 验证码错误,请重新输入 | 人机验证码错误 | +| 提交过于频繁,请稍后再试 | 频率限制,1分钟内只能提交3次 | + +--- + +## 相似度说明 + +系统使用 **Levenshtein 距离算法** 计算文本相似度: + +1. **文本清理**:自动去除标点符号和空格后比较 +2. **阈值设置**:0-100%,默认 80% +3. **判断规则**:相似度 ≥ 阈值 则认为是重复内容 + +**示例**: +- "盈盈一水间,脉脉不得语" +- "盈盈一水间,脉脉不得语。"(相似度约 95%) +- "盈盈一水间,脉脉不得"(相似度约 85%) + +--- + +## 注意事项 + +1. **字符编码**: 所有请求和响应都使用 UTF-8 编码 +2. **人机验证**: 提交接口必须提供正确的验证码 +3. **频率限制**: 同一 IP 1分钟内最多提交 3 次 +4. **相似度检查**: check-name 和 submit 接口都会进行相似度检查 +5. **数据安全**: 所有用户输入都会经过安全处理 +6. **调试信息**: API 返回包含 debug 字段,方便开发调试,生产环境可忽略 + +--- + +## 更新日志 + +- **v1.0.12**: 添加相似度验证功能,支持可配置阈值 +- **v1.0.11**: 修改验证表为 pre_site +- **v1.0.10**: 添加人机验证功能和频率限制 +- **v1.0.9**: 添加结果Modal对话框 +- **v1.0.8**: 添加检测按钮和提交前确认 diff --git a/ht/README.md b/ht/README.md deleted file mode 100644 index 11554b7..0000000 --- a/ht/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# 查立得出品费心投票PHP+MySQL轻量级投票系统 - -一个简洁实用的投票系统,基于PHP7+MySQL5.6开发,使用原生代码实现,不依赖外部框架。 -非常适合初学者入门学习源码,及满足你的基本投票需求(初始1.0版本请测试可用再实际应用)。 - -## 功能特点 - -- 用户注册与登录(手机号为用户名) -- 投票主题创建与管理 -- 支持单选和多选投票 -- 投票结果实时统计与展示 -- 管理员后台管理 -- 日志记录与统计分析 - -## 安装说明 - -### 系统要求 - -- PHP 7.0及以上版本 -- MySQL 5.6及以上版本 -- Web服务器(如Apache、Nginx等)推荐宝塔环境 - -### 安装步骤 - -1. **准备数据库** - - 使用宝塔/phpMyAdmin等工具导入`install.sql`文件。 - -2. **配置数据库连接** - - 修改`inc/conn.php`文件中的数据库配置信息: - -3. **上传文件** - - 将所有文件上传到Web服务器的根目录或子目录。 - -4. **设置文件权限** - - 确保Web服务器对以下目录有写入权限: - - assets/img/(如果需要上传图片) - -5. **访问网站** - - 通过浏览器访问您的网站地址,系统已准备就绪。 - -## 默认账号 - -系统初始安装后,会自动创建一个管理员账号: - -- 用户名:13800000000 -- 密码:admin123 - -请登录后立即修改默认密码。 - -## 目录结构 - -``` -/toupiao/ - ├── index.php // 网站首页,显示投票列表 - ├── login.php // 登录页面 - ├── reger.php // 注册页面 - ├── vote.php // 投票页面 - ├── admin.php // 管理员面板入口 - ├── install.sql // 数据库安装脚本 - ├── inc/ // 公共文件目录 - │ ├── conn.php // 数据库连接及站点配置 - │ ├── pubs.php // 公共函数 - │ ├── js.js // 公共JS函数 - │ ├── css.css // 公共CSS样式 - │ └── sqls.php // 数据库操作类 - ├── admin/ // 管理功能目录 - │ ├── index.php // 管理后台首页 - │ ├── topic.php // 投票主题管理 - │ ├── topic_form.php // 投票主题编辑表单 - │ ├── topic_options.php // 投票选项管理 - │ ├── user.php // 用户管理 - │ ├── stat.php // 投票统计 - │ └── logs.php // 日志管理 - ├── api/ // 接口目录 - │ ├── topic.php // 投票主题相关接口 - │ ├── vote.php // 投票操作接口 - │ ├── user.php // 用户相关接口 - │ └── admin.php // 管理相关接口 - └── assets/ // 静态资源目录 - ├── css/ // 自定义CSS - ├── js/ // 自定义JS - └── img/ // 图片资源 -``` - -## 使用说明 - -### 前台用户 - -1. **注册/登录** - - 使用手机号注册新账号 - - 使用已注册的手机号和密码登录 - -2. **浏览投票** - - 在首页可以查看所有可用的投票 - - 可以按类型和状态筛选投票 - -3. **参与投票** - - 点击投票详情进入投票页面 - - 选择您喜欢的选项并提交 - - 提交后可以查看实时投票结果 - -4. **查看我的投票** - - 在"我的投票"页面查看已参与的投票 - -### 管理员 - -1. **管理投票** - - 创建新投票主题 - - 编辑现有投票的信息和状态 - - 为投票添加、编辑或删除选项 - -2. **用户管理** - - 查看用户列表 - - 添加新用户 - - 编辑用户角色和状态 - - 重置用户密码 - -3. **数据统计** - - 查看总体投票统计 - - 查看每个投票的详细统计 - - 查看参与用户明细 - -4. **日志管理** - - 查看系统操作日志 - - 按用户、操作类型和时间筛选日志 - - 导出日志数据 - -## 技术特点 - -- HTML5 + CSS3 + JavaScript原生代码实现 -- PHP7 面向对象编程 -- MySQL数据库优化设计 -- AJAX异步通信 -- 响应式页面设计,适配各种设备 - -## 联系方式 -初始1.0版本请测试可用再实际应用 -意见建议,BUG反馈,可联系15058593138@qq.com。 diff --git a/ht/admin.php b/ht/admin.php deleted file mode 100644 index da8afbf..0000000 --- a/ht/admin.php +++ /dev/null @@ -1,20 +0,0 @@ -count('users'); -// 2. 投票主题总数 -$totalTopics = $db->count('vote'); -// 3. 进行中的投票数 -$now = date('Y-m-d H:i:s'); -$activeTopics = $db->count('vote', "status = 1 AND statime <= '$now' AND endtime >= '$now'"); -// 4. 总投票记录数 -$totalVotes = $db->count('recs'); - -// 最近投票记录 -$recentVotes = []; -$sql = "SELECT r.*, u.username, v.title - FROM " . $db->table('recs') . " r - LEFT JOIN " . $db->table('users') . " u ON r.user_id = u.id - LEFT JOIN " . $db->table('vote') . " v ON r.topic_id = v.id - ORDER BY r.vote_time DESC LIMIT 10"; -$result = $db->query($sql); -if ($result) { - while ($row = $result->fetch_assoc()) { - $recentVotes[] = $row; - } -} - -// 最近操作日志 -$recentLogs = []; -$sql = "SELECT l.*, u.username - FROM " . $db->table('logs') . " l - LEFT JOIN " . $db->table('users') . " u ON l.user_id = u.id - ORDER BY l.logtime DESC LIMIT 10"; -$result = $db->query($sql); -if ($result) { - while ($row = $result->fetch_assoc()) { - $recentLogs[] = $row; - } -} - -// 页面标题 -$pageTitle = "管理后台"; -?> - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
-
- - -
-
- - -
- - - - -
-
-

系统概况

-
- 欢迎您, -
-
- - -
-
-
-
用户总数
-
- -
-
-
投票主题总数
-
- -
-
-
进行中的投票
-
- -
-
-
总投票记录数
-
-
- - -
-

最近投票记录

- - - - - - - - - - - - - - - - - - - - - - - - - -
用户投票主题投票时间IP地址
暂无投票记录
-
- - -
-

最近操作日志

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
用户操作类型操作内容IP地址时间
暂无操作日志
-
-
-
- - - - diff --git a/ht/admin/logs.php b/ht/admin/logs.php deleted file mode 100644 index 6df10a8..0000000 --- a/ht/admin/logs.php +++ /dev/null @@ -1,360 +0,0 @@ -getAll('users', '', 'id, username', 'id ASC'); - -// 获取所有操作类型,用于筛选 -$sql = "SELECT DISTINCT action FROM " . $db->table('logs'); -$result = $db->query($sql); -$actionTypes = []; - -if ($result) { - while ($row = $result->fetch_assoc()) { - $actionTypes[] = $row['action']; - } -} - -// 页面标题 -$pageTitle = "系统日志"; -?> - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
-
- - -
-
- - -
- - - - -
-
-

系统日志

-
- -
-
- - -
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-
-
加载中...
-
- - - -
-
-
- - - - - diff --git a/ht/admin/stat.php b/ht/admin/stat.php deleted file mode 100644 index a6b3040..0000000 --- a/ht/admin/stat.php +++ /dev/null @@ -1,499 +0,0 @@ -getAll('vote', '', 'id, title', 'addtime DESC'); - -// 页面标题 -$pageTitle = "数据统计"; -?> - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
-
- - -
-
- - -
- - - - -
-
-

数据统计

-
- - -
-
-
- - -
-
- -
-
-
- - -
- -
- - -
- -
-
-
- - - - - diff --git a/ht/admin/topic.php b/ht/admin/topic.php deleted file mode 100644 index 531950d..0000000 --- a/ht/admin/topic.php +++ /dev/null @@ -1,420 +0,0 @@ -getOne('vote', "id = $id"); - if (!$vote) { - header('Location: topic.php'); - exit; - } - - include 'topic_form.php'; - break; - - // 管理选项页面 - case 'options': - $pageTitle = "管理选项"; - $id = isset($_GET['id']) ? intval($_GET['id']) : 0; - - if (!$id) { - header('Location: topic.php'); - exit; - } - - // 获取投票信息 - $vote = $db->getOne('vote', "id = $id"); - if (!$vote) { - header('Location: topic.php'); - exit; - } - - // 获取选项列表 - $options = $db->getAll('xuan', "topic_id = $id", '*', 'sort ASC, id ASC'); - - include 'topic_options.php'; - break; - - // 投票列表页面(默认) - default: - $pageTitle = "投票管理"; - - // 获取分页参数 - $page = isset($_GET['page']) ? intval($_GET['page']) : 1; - $pageSize = 10; - - // 获取筛选参数 - $status = isset($_GET['status']) ? intval($_GET['status']) : -1; - $type = isset($_GET['type']) ? intval($_GET['type']) : -1; - $keyword = isset($_GET['keyword']) ? safeFilter($_GET['keyword']) : ''; - - // 构建查询条件 - $whereConditions = []; - if ($status >= 0) { - $whereConditions[] = "status = $status"; - } - if ($type >= 0) { - $whereConditions[] = "itype = $type"; - } - if ($keyword) { - $whereConditions[] = "(title LIKE '%$keyword%' OR idesc LIKE '%$keyword%')"; - } - - $whereStr = !empty($whereConditions) ? implode(' AND ', $whereConditions) : ''; - - // 获取总记录数 - $total = $db->count('vote', $whereStr); - - // 计算分页信息 - $pagination = getPagination($total, $page, $pageSize); - - // 获取投票列表 - $orderBy = "addtime DESC"; - $limit = "{$pagination['offset']}, {$pagination['pageSize']}"; - $voteList = $db->getAll('vote', $whereStr, '*', $orderBy, $limit); - - // 页面标题 - $pageTitle = "投票管理"; - ?> - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
-
- - -
-
- - -
- - - - -
-
-
- - -
-
-
-
- - -
-
- - -
-
- - -
-
- - 重置 - 添加投票 -
-
-
-
- - -
- - - - - - - - - - - - - - - - - $now) { - $voteStatus = '未开始'; - $statusClass = 'vote-status-pending'; - } elseif ($vote['endtime'] < $now) { - $voteStatus = '已结束'; - $statusClass = 'vote-status-ended'; - } else { - $voteStatus = '进行中'; - $statusClass = 'vote-status-active'; - } - } - ?> - - - - - - - - - - - - - - - - - - -
ID标题类型开始时间结束时间状态浏览量创建时间操作
- 查看 - 选项 - 编辑 - -
暂无投票数据
-
- - - -
-
- - - - - - 0, - 'title' => '', - 'idesc' => '', - 'statime' => date('Y-m-d H:i:s', strtotime('+1 hour')), - 'endtime' => date('Y-m-d H:i:s', strtotime('+7 days')), - 'itype' => 0, - 'maxtime' => 1, - 'status' => 1 -]; - -// 如果是编辑模式,加载现有数据 -if ($action == 'edit' && isset($vote)) { - $formData = array_merge($formData, $vote); -} -?> - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
-
- - -
-
- - -
- - - - -
-
-

- -
- - -
-
- - - - -
- - -
- -
- - -
- -
- - -
- -
- - > -
- -
- - -
- -
- - -
- -
- - -
- -
- - 取消 -
-
-
-
-
- - - - - diff --git a/ht/admin/topic_options.php b/ht/admin/topic_options.php deleted file mode 100644 index d97eaf8..0000000 --- a/ht/admin/topic_options.php +++ /dev/null @@ -1,569 +0,0 @@ - - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
-
- - -
-
- - -
- - - - -
-
-

管理投票选项

- -
- - -
-

-

类型:

-

时间:

-

状态:

-
- - -
-

现有选项(

- - - -
-
- - -
- -

- - -
<?php echo htmlspecialchars($option['name']); ?>
- - - -

- - -

排序:

-
- - -
-
-

暂无选项数据

-
-
- -
- - -
-

添加新选项

-
- - - -
- - -
- -
- -
- - -
- - -
- -
- - -
- -
- - -
- -
- - -
-
-
-
-
- - - - - diff --git a/ht/admin/user.php b/ht/admin/user.php deleted file mode 100644 index b7c346d..0000000 --- a/ht/admin/user.php +++ /dev/null @@ -1,698 +0,0 @@ -= 0) { - $whereConditions[] = "status = $status"; -} -if ($role >= 0) { - $whereConditions[] = "irole = $role"; -} -if ($keyword) { - $whereConditions[] = "username LIKE '%$keyword%'"; -} - -$whereStr = !empty($whereConditions) ? implode(' AND ', $whereConditions) : ''; - -// 获取总记录数 -$total = $db->count('users', $whereStr); - -// 计算分页信息 -$pagination = getPagination($total, $page, $pageSize); - -// 获取用户列表 -$orderBy = "id ASC"; -$limit = "{$pagination['offset']}, {$pagination['pageSize']}"; -$userList = $db->getAll('users', $whereStr, '*', $orderBy, $limit); - -// 页面标题 -$pageTitle = "用户管理"; -?> - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
-
- - -
-
- - -
- - - - -
-
-

用户管理

-
- -
-
- - -
-
-
-
- - -
-
- - -
-
- - -
-
- - 重置 -
-
-
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ID用户名角色状态注册时间最后登录操作
- - 管理员 - - 普通用户 - - - - 正常 - - 禁用 - - - - - - - - - - - - -
暂无用户数据
-
- - - -
-
- - - - - diff --git a/ht/api.php b/ht/api.php new file mode 100644 index 0000000..0255b4a --- /dev/null +++ b/ht/api.php @@ -0,0 +1,317 @@ + true, + 'num1' => $num1, + 'num2' => $num2 + ], JSON_UNESCAPED_UNICODE); + exit; + } + + if ($api === 'categories') { + try { + $categories = []; + $debug_info['DB_findAll_exists'] = method_exists($DB, 'findAll') ? 'yes' : 'no'; + + if ($DB && method_exists($DB, 'findAll')) { + $categories = $DB->findAll('category', '*', null, 'sid asc'); + $debug_info['categories_count'] = count($categories); + } + + if (empty($categories)) { + $categories = [ + ['catename' => '唐诗'], + ['catename' => '宋词'], + ['catename' => '元曲'], + ['catename' => '诗词句'], + ['catename' => '现代诗'] + ]; + $debug_info['used_fallback'] = 'yes'; + } + + echo json_encode([ + 'ok' => true, + 'categories' => $categories, + 'debug' => $debug_info + ], JSON_UNESCAPED_UNICODE); + } catch (Exception $e) { + $debug_info['exception'] = $e->getMessage(); + echo json_encode([ + 'ok' => true, + 'categories' => [ + ['catename' => '唐诗'], + ['catename' => '宋词'], + ['catename' => '元曲'], + ['catename' => '诗词句'], + ['catename' => '现代诗'] + ], + 'debug' => $debug_info + ], JSON_UNESCAPED_UNICODE); + } + exit; + } + + if ($api === 'check-name') { + if (!isset($_POST['name'])) { + echo json_encode(['ok' => false, 'error' => '缺少name参数']); + exit; + } + + try { + $name = trim($_POST['name']); + $exists = false; + $similar_count = 0; + $max_similarity = 0; + $threshold = isset($_POST['threshold']) ? intval($_POST['threshold']) : 80; + $threshold = max(0, min(100, $threshold)); + + if ($DB && method_exists($DB, 'findAll')) { + $tables_to_check = ['site', 'apply']; + + foreach ($tables_to_check as $table) { + $all_records = $DB->findAll($table, 'name'); + + if ($all_records) { + foreach ($all_records as $record) { + $db_name = trim($record['name']); + + if ($db_name === $name) { + $exists = true; + $max_similarity = 100; + $similar_count = 1; + break 2; + } + + $similarity = calculateSimilarity($name, $db_name); + if ($similarity >= $threshold) { + $similar_count++; + if ($similarity > $max_similarity) { + $max_similarity = $similarity; + } + } + } + } + } + } + + if ($max_similarity >= $threshold) { + $exists = true; + } + + echo json_encode([ + 'ok' => true, + 'exists' => $exists, + 'similar_count' => $similar_count, + 'max_similarity' => $max_similarity, + 'threshold' => $threshold + ], JSON_UNESCAPED_UNICODE); + } catch (Exception $e) { + echo json_encode([ + 'ok' => true, + 'exists' => false, + 'similar_count' => 0, + 'max_similarity' => 0, + 'threshold' => 80 + ], JSON_UNESCAPED_UNICODE); + } + exit; + } + + if ($api === 'submit') { + $submit_debug = []; + + session_start(); + $client_ip = $_SERVER['REMOTE_ADDR'] ?? 'unknown'; + $rate_limit_key = 'submit_rate_' . $client_ip; + + if (!isset($_SESSION[$rate_limit_key])) { + $_SESSION[$rate_limit_key] = []; + } + + $current_time = time(); + $_SESSION[$rate_limit_key] = array_filter($_SESSION[$rate_limit_key], function($time) use ($current_time) { + return ($current_time - $time) < 60; + }); + + if (count($_SESSION[$rate_limit_key]) >= 3) { + echo json_encode(['ok' => false, 'error' => '提交过于频繁,请稍后再试']); + exit; + } + + $required = ['name', 'catename', 'url', 'keywords', 'introduce', 'captcha']; + foreach ($required as $field) { + if (!isset($_POST[$field]) || empty(trim($_POST[$field]))) { + echo json_encode(['ok' => false, 'error' => "缺少必填字段:{$field}"]); + exit; + } + } + + $captcha = trim($_POST['captcha']); + $captcha_key = 'captcha_' . session_id(); + if (!isset($_SESSION[$captcha_key]) || $_SESSION[$captcha_key] != $captcha) { + echo json_encode(['ok' => false, 'error' => '验证码错误,请重新输入']); + exit; + } + unset($_SESSION[$captcha_key]); + + try { + $name = trim($_POST['name']); + $threshold = isset($_POST['threshold']) ? intval($_POST['threshold']) : 80; + $threshold = max(0, min(100, $threshold)); + + $similar_exists = false; + if ($DB && method_exists($DB, 'findAll')) { + $tables_to_check = ['site', 'apply']; + + foreach ($tables_to_check as $table) { + $all_records = $DB->findAll($table, 'name'); + + if ($all_records) { + foreach ($all_records as $record) { + $db_name = trim($record['name']); + + if ($db_name === $name) { + $similar_exists = true; + break 2; + } + + $similarity = calculateSimilarity($name, $db_name); + if ($similarity >= $threshold) { + $similar_exists = true; + break 2; + } + } + } + } + } + + if ($similar_exists) { + echo json_encode(['ok' => false, 'error' => '该诗词已存在!']); + exit; + } + $catename = trim($_POST['catename']); + $url = trim($_POST['url']); + $keywords = trim($_POST['keywords']); + $introduce = trim($_POST['introduce']); + $img = isset($_POST['img']) ? trim($_POST['img']) : 'default'; + + $submit_debug['input_data'] = [ + 'name' => $name, + 'catename' => $catename, + 'url' => $url, + 'keywords' => $keywords, + 'introduce' => $introduce, + 'img' => $img + ]; + + $data = [ + 'name' => $name, + 'img' => $img, + 'catename' => $catename, + 'url' => $url, + 'keywords' => $keywords, + 'introduce' => $introduce, + 'reject' => 0, + 'create_time' => date('Y-m-d H:i:s'), + 'update_time' => date('Y-m-d H:i:s') + ]; + + $submit_debug['insert_data'] = $data; + $submit_debug['DB_insert_exists'] = method_exists($DB, 'insert') ? 'yes' : 'no'; + + $result = false; + $db_error = ''; + if ($DB && method_exists($DB, 'insert')) { + $result = $DB->insert('apply', $data); + $submit_debug['insert_result'] = $result; + if (method_exists($DB, 'error')) { + $db_error = $DB->error(); + $submit_debug['db_error'] = $db_error; + } + if (method_exists($DB, 'lastInsertId')) { + $submit_debug['last_insert_id'] = $DB->lastInsertId(); + } + } + + if ($result) { + $_SESSION[$rate_limit_key][] = $current_time; + + echo json_encode([ + 'ok' => true, + 'message' => '✅ 提交成功!等待审核', + 'debug' => $submit_debug + ], JSON_UNESCAPED_UNICODE); + } else { + echo json_encode([ + 'ok' => false, + 'error' => '❌ 数据库写入失败:无法插入数据', + 'debug' => $submit_debug + ], JSON_UNESCAPED_UNICODE); + } + } catch (Exception $e) { + $submit_debug['exception'] = $e->getMessage(); + $submit_debug['trace'] = $e->getTraceAsString(); + echo json_encode([ + 'ok' => false, + 'error' => $e->getMessage(), + 'debug' => $submit_debug + ], JSON_UNESCAPED_UNICODE); + } + exit; + } +} + +function calculateSimilarity($str1, $str2) { + $str1 = preg_replace('/[^\p{L}\p{N}\s]/u', '', $str1); + $str2 = preg_replace('/[^\p{L}\p{N}\s]/u', '', $str2); + $str1 = preg_replace('/\s+/', '', $str1); + $str2 = preg_replace('/\s+/', '', $str2); + + $len1 = mb_strlen($str1, 'UTF-8'); + $len2 = mb_strlen($str2, 'UTF-8'); + + if ($len1 === 0 || $len2 === 0) { + return 0; + } + + $maxLen = max($len1, $len2); + $distance = levenshtein($str1, $str2); + + if ($distance === 0) { + return 100; + } + + $similarity = round((1 - $distance / $maxLen) * 100, 2); + return max(0, min(100, $similarity)); +} + +echo json_encode(['ok' => false, 'error' => '无效的API请求']); diff --git a/ht/api/admin.php b/ht/api/admin.php deleted file mode 100644 index f2d8edf..0000000 --- a/ht/api/admin.php +++ /dev/null @@ -1,379 +0,0 @@ -getOne('users', "username = '$username'"); - if ($existUser) { - ajaxReturn(1, '该手机号已被注册'); - } - - // 密码加密 - $hashedPassword = password_hash($password, PASSWORD_DEFAULT); - - // 添加用户 - $userId = $db->insert('users', [ - 'username' => $username, - 'password' => $hashedPassword, - 'irole' => $role, - 'status' => 1, - 'regtime' => date('Y-m-d H:i:s') - ]); - - if (!$userId) { - ajaxReturn(1, '添加失败,请稍后重试'); - } - - // 记录日志 - writeLog($admin['id'], 'add_user', "添加用户:$username"); - - ajaxReturn(0, '添加成功', ['id' => $userId]); - break; - - // 更新用户信息 - case 'updateUser': - // 验证管理员权限 - $admin = checkAuth('updateUser', true); - if (!$admin) { - exit; - } - - // 获取参数 - $id = isset($_POST['id']) ? intval($_POST['id']) : 0; - $role = isset($_POST['role']) ? intval($_POST['role']) : null; - $status = isset($_POST['status']) ? intval($_POST['status']) : null; - - // 参数验证 - if (empty($id)) { - ajaxReturn(1, '参数错误'); - } - - // 获取用户信息 - $targetUser = $db->getOne('users', "id = $id"); - if (!$targetUser) { - ajaxReturn(1, '用户不存在'); - } - - // 不能禁用自己的账号 - if ($id == $admin['id'] && $status === 0) { - ajaxReturn(1, '不能禁用当前登录的账号'); - } - - // 准备更新数据 - $updateData = []; - - if ($role !== null) { - $updateData['irole'] = $role; - } - - if ($status !== null) { - $updateData['status'] = $status; - } - - if (empty($updateData)) { - ajaxReturn(1, '没有要更新的数据'); - } - - // 更新用户信息 - $result = $db->update('users', $updateData, "id = $id"); - if (!$result) { - ajaxReturn(1, '更新失败,请稍后重试'); - } - - // 记录日志 - $logContent = "更新用户信息:" . $targetUser['username']; - writeLog($admin['id'], 'update_user', $logContent); - - ajaxReturn(0, '更新成功'); - break; - - // 重置用户密码 - case 'resetPassword': - // 验证管理员权限 - $admin = checkAuth('resetPassword', true); - if (!$admin) { - exit; - } - - // 获取参数 - $id = isset($_POST['id']) ? intval($_POST['id']) : 0; - $password = isset($_POST['password']) ? $_POST['password'] : ''; - - // 参数验证 - if (empty($id) || empty($password)) { - ajaxReturn(1, '参数错误'); - } - - // 验证密码长度 - if (strlen($password) < 6) { - ajaxReturn(1, '密码长度不能少于6位'); - } - - // 获取用户信息 - $targetUser = $db->getOne('users', "id = $id"); - if (!$targetUser) { - ajaxReturn(1, '用户不存在'); - } - - // 密码加密 - $hashedPassword = password_hash($password, PASSWORD_DEFAULT); - - // 更新密码 - $result = $db->update('users', [ - 'password' => $hashedPassword - ], "id = $id"); - - if (!$result) { - ajaxReturn(1, '重置失败,请稍后重试'); - } - - // 记录日志 - $logContent = "重置用户密码:" . $targetUser['username']; - writeLog($admin['id'], 'reset_password', $logContent); - - ajaxReturn(0, '密码重置成功'); - break; - - // 获取投票统计数据 - case 'getVoteStats': - // 验证管理员权限 - $admin = checkAuth('getVoteStats', true); - if (!$admin) { - exit; - } - - // 获取参数 - $topicId = isset($_REQUEST['topic_id']) ? intval($_REQUEST['topic_id']) : 0; - - // 如果指定了特定投票 - if ($topicId) { - // 获取投票信息 - $vote = $db->getOne('vote', "id = $topicId"); - if (!$vote) { - ajaxReturn(1, '投票不存在'); - } - - // 获取选项列表 - $options = $db->getAll('xuan', "topic_id = $topicId", '*', 'sort ASC, id ASC'); - - // 获取每个选项的投票数 - $voteCounts = []; - $sql = "SELECT option_id, COUNT(*) as vote_count FROM " . $db->table('recs') . " WHERE topic_id = $topicId GROUP BY option_id"; - $result = $db->query($sql); - - if ($result) { - while ($row = $result->fetch_assoc()) { - $voteCounts[$row['option_id']] = $row['vote_count']; - } - } - - // 统计总票数 - $totalVotes = array_sum($voteCounts); - - // 格式化选项数据 - $formattedOptions = []; - foreach ($options as $option) { - $count = isset($voteCounts[$option['id']]) ? $voteCounts[$option['id']] : 0; - $percentage = $totalVotes > 0 ? round(($count / $totalVotes) * 100, 1) : 0; - - $formattedOptions[] = [ - 'id' => $option['id'], - 'name' => $option['name'], - 'count' => $count, - 'percentage' => $percentage - ]; - } - - // 获取参与用户 - $participants = []; - $sql = "SELECT DISTINCT u.username, r.vote_time, r.ip - FROM " . $db->table('recs') . " r - LEFT JOIN " . $db->table('users') . " u ON r.user_id = u.id - WHERE r.topic_id = $topicId - ORDER BY r.vote_time DESC"; - $result = $db->query($sql); - - if ($result) { - while ($row = $result->fetch_assoc()) { - $participants[] = [ - 'username' => $row['username'], - 'vote_time' => $row['vote_time'], - 'ip' => $row['ip'] - ]; - } - } - - ajaxReturn(0, '获取成功', [ - 'vote' => $vote, - 'options' => $formattedOptions, - 'totalVotes' => $totalVotes, - 'participants' => $participants - ]); - } else { - // 获取所有投票的统计信息 - $voteStats = []; - - // 获取所有投票 - $votes = $db->getAll('vote', '', '*', 'addtime DESC'); - - foreach ($votes as $vote) { - // 获取该投票的总票数 - $totalVotes = $db->count('recs', "topic_id = {$vote['id']}"); - - // 获取参与人数 - $sql = "SELECT COUNT(DISTINCT user_id) as user_count FROM " . $db->table('recs') . " WHERE topic_id = {$vote['id']}"; - $result = $db->query($sql); - $userCount = 0; - - if ($result && $row = $result->fetch_assoc()) { - $userCount = $row['user_count']; - } - - $voteStats[] = [ - 'id' => $vote['id'], - 'title' => $vote['title'], - 'start_time' => $vote['statime'], - 'end_time' => $vote['endtime'], - 'total_votes' => $totalVotes, - 'user_count' => $userCount, - 'view_count' => $vote['iview'] - ]; - } - - ajaxReturn(0, '获取成功', [ - 'voteStats' => $voteStats - ]); - } - break; - - // 获取系统日志 - case 'getLogs': - // 验证管理员权限 - $admin = checkAuth('getLogs', true); - if (!$admin) { - exit; - } - - // 获取分页参数 - $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; - $pageSize = isset($_REQUEST['page_size']) ? intval($_REQUEST['page_size']) : 20; - - // 获取筛选参数 - $userId = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0; - $action = isset($_REQUEST['action']) ? safeFilter($_REQUEST['action']) : ''; - $startDate = isset($_REQUEST['start_date']) ? $_REQUEST['start_date'] : ''; - $endDate = isset($_REQUEST['end_date']) ? $_REQUEST['end_date'] : ''; - - // 构建查询条件 - $whereConditions = []; - - if ($userId) { - $whereConditions[] = "user_id = $userId"; - } - - if ($action) { - $whereConditions[] = "action = '$action'"; - } - - if ($startDate) { - $whereConditions[] = "logtime >= '$startDate 00:00:00'"; - } - - if ($endDate) { - $whereConditions[] = "logtime <= '$endDate 23:59:59'"; - } - - $whereStr = !empty($whereConditions) ? implode(' AND ', $whereConditions) : ''; - - // 获取总记录数 - $total = $db->count('logs', $whereStr); - - // 计算分页信息 - $pagination = getPagination($total, $page, $pageSize); - - // 获取日志列表 - $orderBy = "logtime DESC"; - $limit = "{$pagination['offset']}, {$pagination['pageSize']}"; - - $sql = "SELECT l.*, u.username - FROM " . $db->table('logs') . " l - LEFT JOIN " . $db->table('users') . " u ON l.user_id = u.id - " . ($whereStr ? "WHERE $whereStr" : "") . " - ORDER BY $orderBy - LIMIT $limit"; - - $result = $db->query($sql); - $logs = []; - - if ($result) { - while ($row = $result->fetch_assoc()) { - $logs[] = $row; - } - } - - // 获取所有操作类型,用于筛选 - $sql = "SELECT DISTINCT action FROM " . $db->table('logs'); - $result = $db->query($sql); - $actionTypes = []; - - if ($result) { - while ($row = $result->fetch_assoc()) { - $actionTypes[] = $row['action']; - } - } - - ajaxReturn(0, '获取成功', [ - 'logs' => $logs, - 'pagination' => $pagination, - 'actionTypes' => $actionTypes - ]); - break; - - // 未知操作 - default: - ajaxReturn(1, '未知操作'); - break; -} diff --git a/ht/api/topic.php b/ht/api/topic.php deleted file mode 100644 index 3dedbff..0000000 --- a/ht/api/topic.php +++ /dev/null @@ -1,425 +0,0 @@ -count('vote', $whereStr); - - // 计算分页信息 - $pagination = getPagination($total, $page, $pageSize); - - // 获取投票列表 - $orderBy = "addtime DESC"; - $limit = "{$pagination['offset']}, {$pagination['pageSize']}"; - $voteList = $db->getAll('vote', $whereStr, '*', $orderBy, $limit); - - // 格式化日期 - foreach ($voteList as &$vote) { - $vote['statime_formatted'] = date('Y-m-d H:i', strtotime($vote['statime'])); - $vote['endtime_formatted'] = date('Y-m-d H:i', strtotime($vote['endtime'])); - $vote['addtime_formatted'] = date('Y-m-d H:i', strtotime($vote['addtime'])); - } - - ajaxReturn(0, '获取成功', [ - 'list' => $voteList, - 'pagination' => $pagination - ]); - break; - - // 获取投票主题详情 - case 'getDetail': - // 获取参数 - $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; - - // 参数验证 - if (empty($id)) { - ajaxReturn(1, '参数错误'); - } - - // 获取投票详情 - $vote = $db->getOne('vote', "id = $id"); - if (!$vote) { - ajaxReturn(1, '投票不存在'); - } - - // 获取选项列表 - $options = $db->getAll('xuan', "topic_id = $id", '*', 'sort ASC, id ASC'); - - ajaxReturn(0, '获取成功', [ - 'vote' => $vote, - 'options' => $options - ]); - break; - - // 添加投票主题 - case 'add': - // 验证管理员权限 - $user = checkAuth('add', true); - if (!$user) { - exit; - } - - // 获取参数 - $title = isset($_POST['title']) ? safeFilter($_POST['title']) : ''; - $desc = isset($_POST['desc']) ? safeFilter($_POST['desc']) : ''; - $statime = isset($_POST['statime']) ? $_POST['statime'] : ''; - $endtime = isset($_POST['endtime']) ? $_POST['endtime'] : ''; - $type = isset($_POST['type']) ? intval($_POST['type']) : 0; - $maxtime = isset($_POST['maxtime']) ? intval($_POST['maxtime']) : 1; - $status = isset($_POST['status']) ? intval($_POST['status']) : 1; - - // 参数验证 - if (empty($title)) { - ajaxReturn(1, '请输入投票标题'); - } - - if (empty($statime) || empty($endtime)) { - ajaxReturn(1, '请选择开始和结束时间'); - } - - if (strtotime($statime) >= strtotime($endtime)) { - ajaxReturn(1, '结束时间必须晚于开始时间'); - } - - if ($type == 1 && $maxtime < 2) { - ajaxReturn(1, '多选投票最少可选2项'); - } - - // 添加投票主题 - $topicId = $db->insert('vote', [ - 'title' => $title, - 'idesc' => $desc, - 'statime' => $statime, - 'endtime' => $endtime, - 'itype' => $type, - 'maxtime' => $maxtime, - 'status' => $status, - 'addtime' => date('Y-m-d H:i:s'), - 'adduser' => $user['id'], - 'iview' => 0 - ]); - - if (!$topicId) { - ajaxReturn(1, '添加失败,请稍后重试'); - } - - // 记录日志 - writeLog($user['id'], 'add_topic', "添加投票:$title"); - - ajaxReturn(0, '添加成功', ['id' => $topicId]); - break; - - // 更新投票主题 - case 'update': - // 验证管理员权限 - $user = checkAuth('update', true); - if (!$user) { - exit; - } - - // 获取参数 - $id = isset($_POST['id']) ? intval($_POST['id']) : 0; - $title = isset($_POST['title']) ? safeFilter($_POST['title']) : ''; - $desc = isset($_POST['desc']) ? safeFilter($_POST['desc']) : ''; - $statime = isset($_POST['statime']) ? $_POST['statime'] : ''; - $endtime = isset($_POST['endtime']) ? $_POST['endtime'] : ''; - $type = isset($_POST['type']) ? intval($_POST['type']) : 0; - $maxtime = isset($_POST['maxtime']) ? intval($_POST['maxtime']) : 1; - $status = isset($_POST['status']) ? intval($_POST['status']) : 1; - - // 参数验证 - if (empty($id)) { - ajaxReturn(1, '参数错误'); - } - - if (empty($title)) { - ajaxReturn(1, '请输入投票标题'); - } - - if (empty($statime) || empty($endtime)) { - ajaxReturn(1, '请选择开始和结束时间'); - } - - if (strtotime($statime) >= strtotime($endtime)) { - ajaxReturn(1, '结束时间必须晚于开始时间'); - } - - if ($type == 1 && $maxtime < 2) { - ajaxReturn(1, '多选投票最少可选2项'); - } - - // 检查投票是否存在 - $vote = $db->getOne('vote', "id = $id"); - if (!$vote) { - ajaxReturn(1, '投票不存在'); - } - - // 更新投票主题 - $result = $db->update('vote', [ - 'title' => $title, - 'idesc' => $desc, - 'statime' => $statime, - 'endtime' => $endtime, - 'itype' => $type, - 'maxtime' => $maxtime, - 'status' => $status - ], "id = $id"); - - if (!$result) { - ajaxReturn(1, '更新失败,请稍后重试'); - } - - // 记录日志 - writeLog($user['id'], 'update_topic', "更新投票:$title"); - - ajaxReturn(0, '更新成功'); - break; - - // 删除投票主题 - case 'delete': - // 验证管理员权限 - $user = checkAuth('delete', true); - if (!$user) { - exit; - } - - // 获取参数 - $id = isset($_POST['id']) ? intval($_POST['id']) : 0; - - // 参数验证 - if (empty($id)) { - ajaxReturn(1, '参数错误'); - } - - // 检查投票是否存在 - $vote = $db->getOne('vote', "id = $id"); - if (!$vote) { - ajaxReturn(1, '投票不存在'); - } - - // 开始事务 - $db->startTransaction(); - - try { - // 删除相关记录 - $db->delete('recs', "topic_id = $id"); - $db->delete('xuan', "topic_id = $id"); - $db->delete('vote', "id = $id"); - - // 记录日志 - writeLog($user['id'], 'delete_topic', "删除投票:{$vote['title']}"); - - // 提交事务 - $db->commit(); - - ajaxReturn(0, '删除成功'); - } catch (Exception $e) { - // 回滚事务 - $db->rollback(); - ajaxReturn(1, '删除失败:' . $e->getMessage()); - } - break; - - // 获取投票选项 - case 'getOptions': - // 获取参数 - $topicId = isset($_REQUEST['topic_id']) ? intval($_REQUEST['topic_id']) : 0; - - // 参数验证 - if (empty($topicId)) { - ajaxReturn(1, '参数错误'); - } - - // 获取选项列表 - $options = $db->getAll('xuan', "topic_id = $topicId", '*', 'sort ASC, id ASC'); - - ajaxReturn(0, '获取成功', $options); - break; - - // 添加投票选项 - case 'addOption': - // 验证管理员权限 - $user = checkAuth('addOption', true); - if (!$user) { - exit; - } - - // 获取参数 - $topicId = isset($_POST['topic_id']) ? intval($_POST['topic_id']) : 0; - $name = isset($_POST['name']) ? safeFilter($_POST['name']) : ''; - $imgs = isset($_POST['imgs']) ? safeFilter($_POST['imgs']) : ''; - $desc = isset($_POST['desc']) ? safeFilter($_POST['desc']) : ''; - $sort = isset($_POST['sort']) ? intval($_POST['sort']) : 0; - - // 参数验证 - if (empty($topicId) || empty($name)) { - ajaxReturn(1, '请填写必要参数'); - } - - // 检查投票是否存在 - $vote = $db->getOne('vote', "id = $topicId"); - if (!$vote) { - ajaxReturn(1, '投票不存在'); - } - - // 添加选项 - $optionId = $db->insert('xuan', [ - 'topic_id' => $topicId, - 'name' => $name, - 'imgs' => $imgs, - 'idesc' => $desc, - 'sort' => $sort, - 'addtime' => date('Y-m-d H:i:s'), - 'adduser' => $user['id'] - ]); - - if (!$optionId) { - ajaxReturn(1, '添加失败,请稍后重试'); - } - - // 记录日志 - writeLog($user['id'], 'add_option', "添加投票选项:$name"); - - ajaxReturn(0, '添加成功', ['id' => $optionId]); - break; - - // 更新投票选项 - case 'updateOption': - // 验证管理员权限 - $user = checkAuth('updateOption', true); - if (!$user) { - exit; - } - - // 获取参数 - $id = isset($_POST['id']) ? intval($_POST['id']) : 0; - $name = isset($_POST['name']) ? safeFilter($_POST['name']) : ''; - $imgs = isset($_POST['imgs']) ? safeFilter($_POST['imgs']) : ''; - $desc = isset($_POST['desc']) ? safeFilter($_POST['desc']) : ''; - $sort = isset($_POST['sort']) ? intval($_POST['sort']) : 0; - - // 参数验证 - if (empty($id) || empty($name)) { - ajaxReturn(1, '请填写必要参数'); - } - - // 检查选项是否存在 - $option = $db->getOne('xuan', "id = $id"); - if (!$option) { - ajaxReturn(1, '选项不存在'); - } - - // 更新选项 - $result = $db->update('xuan', [ - 'name' => $name, - 'imgs' => $imgs, - 'idesc' => $desc, - 'sort' => $sort - ], "id = $id"); - - if (!$result) { - ajaxReturn(1, '更新失败,请稍后重试'); - } - - // 记录日志 - writeLog($user['id'], 'update_option', "更新投票选项:$name"); - - ajaxReturn(0, '更新成功'); - break; - - // 删除投票选项 - case 'deleteOption': - // 验证管理员权限 - $user = checkAuth('deleteOption', true); - if (!$user) { - exit; - } - - // 获取参数 - $id = isset($_POST['id']) ? intval($_POST['id']) : 0; - - // 参数验证 - if (empty($id)) { - ajaxReturn(1, '参数错误'); - } - - // 检查选项是否存在 - $option = $db->getOne('xuan', "id = $id"); - if (!$option) { - ajaxReturn(1, '选项不存在'); - } - - // 开始事务 - $db->startTransaction(); - - try { - // 删除投票记录 - $db->delete('recs', "option_id = $id"); - - // 删除选项 - $db->delete('xuan', "id = $id"); - - // 记录日志 - writeLog($user['id'], 'delete_option', "删除投票选项:{$option['name']}"); - - // 提交事务 - $db->commit(); - - ajaxReturn(0, '删除成功'); - } catch (Exception $e) { - // 回滚事务 - $db->rollback(); - ajaxReturn(1, '删除失败:' . $e->getMessage()); - } - break; - - // 未知操作 - default: - ajaxReturn(1, '未知操作'); - break; -} diff --git a/ht/api/upload.php b/ht/api/upload.php deleted file mode 100644 index 2088a1a..0000000 --- a/ht/api/upload.php +++ /dev/null @@ -1,203 +0,0 @@ - 1001, - 'msg' => '请先登录' - ])); -} - -// 检查请求方法 -if ($_SERVER['REQUEST_METHOD'] !== 'POST') { - exit(json_encode([ - 'code' => 1002, - 'msg' => '请求方法错误' - ])); -} - -// 检查是否有文件上传 -if (!isset($_FILES['image']) || $_FILES['image']['error'] !== UPLOAD_ERR_OK) { - exit(json_encode([ - 'code' => 1003, - 'msg' => '上传失败: ' . uploadErrorMessage($_FILES['image']['error']) - ])); -} - -// 验证文件类型 -$allowedTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']; -$fileType = $_FILES['image']['type']; - -if (!in_array($fileType, $allowedTypes)) { - exit(json_encode([ - 'code' => 1004, - 'msg' => '只允许上传JPG、PNG、GIF和WEBP格式的图片' - ])); -} - -// 验证文件大小(最大10MB) -$maxFileSize = 10 * 1024 * 1024; // 10MB -if ($_FILES['image']['size'] > $maxFileSize) { - exit(json_encode([ - 'code' => 1005, - 'msg' => '文件大小超过限制,最大允许10MB' - ])); -} - -// 准备上传路径 -$uploadDir = '../uploads/'; -if (!file_exists($uploadDir)) { - mkdir($uploadDir, 0777, true); -} - -// 生成唯一文件名 -$extension = pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION); -$fileName = uniqid('img_') . '_' . date('Ymd') . '.' . $extension; -$uploadPath = $uploadDir . $fileName; -$relativeUrl = 'uploads/' . $fileName; - -// 处理图片上传 -$uploaded = false; - -// 获取图片信息 -$imageInfo = getimagesize($_FILES['image']['tmp_name']); -if (!$imageInfo) { - exit(json_encode([ - 'code' => 1006, - 'msg' => '无效的图片文件' - ])); -} - -$width = $imageInfo[0]; -$height = $imageInfo[1]; - -// 如果图片宽度大于1280,则调整为1024宽度(尽管前端已经处理,这里作为后端保障) -if ($width > 1280) { - // 计算新高度,保持比例 - $newWidth = 1024; - $newHeight = intval($height * ($newWidth / $width)); - - // 根据图片类型创建图像 - switch ($imageInfo[2]) { - case IMAGETYPE_JPEG: - $source = imagecreatefromjpeg($_FILES['image']['tmp_name']); - break; - case IMAGETYPE_PNG: - $source = imagecreatefrompng($_FILES['image']['tmp_name']); - break; - case IMAGETYPE_GIF: - $source = imagecreatefromgif($_FILES['image']['tmp_name']); - break; - case IMAGETYPE_WEBP: - $source = imagecreatefromwebp($_FILES['image']['tmp_name']); - break; - default: - exit(json_encode([ - 'code' => 1007, - 'msg' => '不支持的图片格式' - ])); - } - - // 创建新图像 - $thumb = imagecreatetruecolor($newWidth, $newHeight); - - // 保持PNG和WebP的透明度 - if ($imageInfo[2] == IMAGETYPE_PNG || $imageInfo[2] == IMAGETYPE_WEBP) { - imagealphablending($thumb, false); - imagesavealpha($thumb, true); - $transparent = imagecolorallocatealpha($thumb, 255, 255, 255, 127); - imagefilledrectangle($thumb, 0, 0, $newWidth, $newHeight, $transparent); - } - - // 调整图像大小 - imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); - - // 保存图像 - switch ($imageInfo[2]) { - case IMAGETYPE_JPEG: - $uploaded = imagejpeg($thumb, $uploadPath, 90); - break; - case IMAGETYPE_PNG: - $uploaded = imagepng($thumb, $uploadPath, 9); - break; - case IMAGETYPE_GIF: - $uploaded = imagegif($thumb, $uploadPath); - break; - case IMAGETYPE_WEBP: - $uploaded = imagewebp($thumb, $uploadPath, 90); - break; - } - - // 释放内存 - imagedestroy($source); - imagedestroy($thumb); -} else { - // 直接移动上传的文件 - $uploaded = move_uploaded_file($_FILES['image']['tmp_name'], $uploadPath); -} - -// 检查上传是否成功 -if (!$uploaded) { - exit(json_encode([ - 'code' => 1008, - 'msg' => '文件保存失败' - ])); -} - -// 记录日志 -$user = $_SESSION['user']; -$ip = "".$_SERVER['REMOTE_ADDR']; -$db = new DB(); -$db->insert('logs', [ - 'user_id' => $user['id'], - 'action' => '上传图片', - 'idesc' => '上传了图片: ' . $fileName, - 'ip' => $ip, - 'logtime' => date('Y-m-d H:i:s') -]); - -// 返回成功信息和图片URL -exit(json_encode([ - 'code' => 0, - 'msg' => '上传成功', - 'data' => [ - 'url' => $relativeUrl, - 'width' => $width, - 'height' => $height - ] -])); - -/** - * 获取上传错误消息 - * @param int $errorCode 上传错误代码 - * @return string 错误消息 - */ -function uploadErrorMessage($errorCode) { - switch ($errorCode) { - case UPLOAD_ERR_INI_SIZE: - return '上传的文件超过了php.ini中upload_max_filesize指令限制的大小'; - case UPLOAD_ERR_FORM_SIZE: - return '上传的文件超过了HTML表单中MAX_FILE_SIZE指令指定的大小'; - case UPLOAD_ERR_PARTIAL: - return '文件只有部分被上传'; - case UPLOAD_ERR_NO_FILE: - return '没有文件被上传'; - case UPLOAD_ERR_NO_TMP_DIR: - return '找不到临时文件夹'; - case UPLOAD_ERR_CANT_WRITE: - return '文件写入失败'; - case UPLOAD_ERR_EXTENSION: - return '文件上传被PHP扩展程序中断'; - default: - return '未知上传错误'; - } -} diff --git a/ht/api/user.php b/ht/api/user.php deleted file mode 100644 index fb42fe0..0000000 --- a/ht/api/user.php +++ /dev/null @@ -1,238 +0,0 @@ -getOne('users', "username = '$username'"); - - // 验证用户和密码 - if (!$user || !password_verify($password, $user['password'])) { - ajaxReturn(1, '用户名或密码错误'); - } - - // 验证用户状态 - if ($user['status'] != 1) { - ajaxReturn(1, '账号已被禁用,请联系管理员'); - } - - // 更新最后登录时间 - $db->update('users', [ - 'logtime' => date('Y-m-d H:i:s') - ], "id = {$user['id']}"); - - // 记录登录日志 - writeLog($user['id'], 'login', '用户登录'); - - // 存储session - session_start(); - $_SESSION['user'] = $user; - - ajaxReturn(0, '登录成功', $user); - break; - - // 用户注册 - case 'register': - // 获取参数 - $username = isset($_POST['username']) ? safeFilter($_POST['username']) : ''; - $password = isset($_POST['password']) ? $_POST['password'] : ''; - $userIdentifier = isset($_POST['user_identifier']) ? safeFilter($_POST['user_identifier']) : ''; - - // 参数验证 - if (empty($username) || empty($password)) { - ajaxReturn(1, '账号和密码不能为空'); - } - - // 验证账号格式(手机号/邮箱/微信号) - $phoneRegex = '/^1[3456789]\d{9}$/'; - $emailRegex = '/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/'; - $wechatRegex = '/^[a-zA-Z0-9_-]{6,20}$/'; - - if (!preg_match($phoneRegex, $username) && !preg_match($emailRegex, $username) && !preg_match($wechatRegex, $username)) { - ajaxReturn(1, '请输入正确的手机号、邮箱或微信号'); - } - - // 验证密码长度 - if (strlen($password) < 6) { - ajaxReturn(1, '密码长度不能少于6位'); - } - - // 检查用户名是否已存在 - $existUser = $db->getOne('users', "username = '$username'"); - if ($existUser) { - ajaxReturn(1, '该账号已被注册'); - } - - // 密码加密 - $hashedPassword = password_hash($password, PASSWORD_DEFAULT); - - // 添加用户 - $userId = $db->insert('users', [ - 'username' => $username, - 'password' => $hashedPassword, - 'irole' => 0, // 普通用户 - 'status' => 1, // 正常状态 - 'regtime' => date('Y-m-d H:i:s'), - 'user_identifier' => $userIdentifier - ]); - - if (!$userId) { - ajaxReturn(1, '注册失败,请稍后重试'); - } - - // 记录注册日志 - writeLog($userId, 'register', '用户注册'); - - ajaxReturn(0, '注册成功'); - break; - - // 用户登出 - case 'logout': - session_start(); - - // 记录登出日志 - if (isset($_SESSION['user']) && !empty($_SESSION['user']['id'])) { - writeLog($_SESSION['user']['id'], 'logout', '用户登出'); - } - - // 清除session - unset($_SESSION['user']); - session_destroy(); - - // 跳转到首页 - header('Location: ../index.php'); - exit; - break; - - // 获取用户信息 - case 'getUserInfo': - // 验证权限 - $user = checkAuth('getUserInfo'); - if (!$user) { - exit; - } - - // 移除敏感信息 - unset($user['password']); - - ajaxReturn(0, '获取成功', $user); - break; - - // 更新用户信息 - case 'updateUserInfo': - // 验证权限 - $user = checkAuth('updateUserInfo'); - if (!$user) { - exit; - } - - // 获取参数 - $newPassword = isset($_POST['new_password']) ? $_POST['new_password'] : ''; - $confirmPassword = isset($_POST['confirm_password']) ? $_POST['confirm_password'] : ''; - - // 如果要更新密码 - if (!empty($newPassword)) { - // 验证密码长度 - if (strlen($newPassword) < 6) { - ajaxReturn(1, '密码长度不能少于6位'); - } - - // 验证两次密码是否一致 - if ($newPassword !== $confirmPassword) { - ajaxReturn(1, '两次输入的密码不一致'); - } - - // 更新密码 - $hashedPassword = password_hash($newPassword, PASSWORD_DEFAULT); - - // 更新用户信息 - $result = $db->update('users', [ - 'password' => $hashedPassword - ], "id = {$user['id']}"); - - if (!$result) { - ajaxReturn(1, '更新失败,请稍后重试'); - } - - // 记录日志 - writeLog($user['id'], 'update_password', '修改密码'); - - // 更新 session 中的用户信息 - $updatedUser = $db->getOne('users', "id = {$user['id']}"); - $_SESSION['user'] = $updatedUser; - - ajaxReturn(0, '密码更新成功'); - } else { - ajaxReturn(1, '请输入新密码'); - } - break; - - // 更新用户标识 - case 'updateUserIdentifier': - // 验证权限 - $user = checkAuth('updateUserIdentifier'); - if (!$user) { - exit; - } - - // 获取参数 - $userIdentifier = isset($_POST['user_identifier']) ? safeFilter($_POST['user_identifier']) : ''; - - // 验证用户标识长度 - if (strlen($userIdentifier) > 100) { - ajaxReturn(1, '用户标识长度不能超过100个字符'); - } - - // 更新用户标识 - $result = $db->update('users', [ - 'user_identifier' => $userIdentifier - ], "id = {$user['id']}"); - - if (!$result) { - ajaxReturn(1, '更新失败,请稍后重试'); - } - - // 记录日志 - writeLog($user['id'], 'update_identifier', '更新用户标识'); - - // 获取更新后的用户信息 - $updatedUser = $db->getOne('users', "id = {$user['id']}"); - - // 移除敏感信息 - unset($updatedUser['password']); - - // 更新 session 中的用户信息 - $_SESSION['user'] = $updatedUser; - - ajaxReturn(0, '更新成功', $updatedUser); - break; - - // 未知操作 - default: - ajaxReturn(1, '未知操作'); - break; -} diff --git a/ht/api/vote.php b/ht/api/vote.php deleted file mode 100644 index 5ee2849..0000000 --- a/ht/api/vote.php +++ /dev/null @@ -1,219 +0,0 @@ -getOne('vote', "id = $topicId"); - if (!$vote) { - ajaxReturn(1, '投票不存在'); - } - - // 验证投票状态 - $now = date('Y-m-d H:i:s'); - if ($vote['status'] != 1) { - ajaxReturn(1, '该投票已被禁用'); - } - - if ($vote['statime'] > $now) { - ajaxReturn(1, '该投票尚未开始'); - } - - if ($vote['endtime'] < $now) { - ajaxReturn(1, '该投票已经结束'); - } - - // 检查用户是否已投票 - $hasVoted = $db->count('recs', "topic_id = $topicId AND user_id = {$user['id']}"); - if ($hasVoted > 0) { - ajaxReturn(1, '您已经参与过该投票'); - } - - // 验证选项数量 - if ($vote['itype'] == 1 && count($options) > $vote['maxtime']) { - ajaxReturn(1, "最多只能选择 {$vote['maxtime']} 项"); - } - - // 验证选项是否存在 - foreach ($options as $optionId) { - $option = $db->getOne('xuan', "id = $optionId AND topic_id = $topicId"); - if (!$option) { - ajaxReturn(1, '选项不存在'); - } - } - - // 开始事务 - $db->startTransaction(); - - try { - // 添加投票记录 - $ip = $_SERVER['REMOTE_ADDR']; - $time = date('Y-m-d H:i:s'); - - foreach ($options as $optionId) { - $result = $db->insert('recs', [ - 'topic_id' => $topicId, - 'user_id' => $user['id'], - 'option_id' => $optionId, - 'vote_time' => $time, - 'ip' => $ip - ]); - - if (!$result) { - throw new Exception('提交投票失败'); - } - } - - // 记录日志 - writeLog($user['id'], 'vote', "参与投票:{$vote['title']}"); - - // 提交事务 - $db->commit(); - - ajaxReturn(0, '投票成功'); - } catch (Exception $e) { - // 回滚事务 - $db->rollback(); - ajaxReturn(1, $e->getMessage()); - } - break; - - // 检查是否已投票 - case 'checkVoted': - // 验证权限 - $user = checkAuth('checkVoted'); - if (!$user) { - exit; - } - - // 获取参数 - $topicId = isset($_REQUEST['topic_id']) ? intval($_REQUEST['topic_id']) : 0; - - // 参数验证 - if (empty($topicId)) { - ajaxReturn(1, '参数错误'); - } - - // 检查用户是否已投票 - $hasVoted = $db->count('recs', "topic_id = $topicId AND user_id = {$user['id']}"); - - ajaxReturn(0, '查询成功', ['hasVoted' => $hasVoted > 0]); - break; - - // 获取投票结果 - case 'getResult': - // 获取参数 - $topicId = isset($_REQUEST['topic_id']) ? intval($_REQUEST['topic_id']) : 0; - - // 参数验证 - if (empty($topicId)) { - ajaxReturn(1, '参数错误'); - } - - // 获取投票信息 - $vote = $db->getOne('vote', "id = $topicId"); - if (!$vote) { - ajaxReturn(1, '投票不存在'); - } - - // 获取选项列表 - $options = $db->getAll('xuan', "topic_id = $topicId", '*', 'sort ASC, id ASC'); - if (empty($options)) { - ajaxReturn(1, '暂无投票选项'); - } - - // 获取投票结果 - $sql = "SELECT option_id, COUNT(*) as vote_count FROM " . $db->table('recs') . " WHERE topic_id = $topicId GROUP BY option_id"; - $result = $db->query($sql); - - $voteResults = []; - $totalVotes = 0; - - if ($result) { - while ($row = $result->fetch_assoc()) { - $voteResults[$row['option_id']] = $row['vote_count']; - $totalVotes += $row['vote_count']; - } - } - - // 格式化结果 - $formattedResults = []; - foreach ($options as $option) { - $voteCount = isset($voteResults[$option['id']]) ? $voteResults[$option['id']] : 0; - $percentage = $totalVotes > 0 ? round(($voteCount / $totalVotes) * 100, 1) : 0; - - $formattedResults[] = [ - 'id' => $option['id'], - 'name' => $option['name'], - 'count' => $voteCount, - 'percentage' => $percentage - ]; - } - - // 用户是否已投票 - $hasVoted = false; - $userVotes = []; - - if (isset($_SESSION['user']) && !empty($_SESSION['user']['id'])) { - $userId = $_SESSION['user']['id']; - $userVoteRecords = $db->getAll('recs', "topic_id = $topicId AND user_id = $userId"); - - if (!empty($userVoteRecords)) { - $hasVoted = true; - foreach ($userVoteRecords as $record) { - $userVotes[] = $record['option_id']; - } - } - } - - ajaxReturn(0, '获取成功', [ - 'vote' => $vote, - 'options' => $options, - 'results' => $formattedResults, - 'totalVotes' => $totalVotes, - 'hasVoted' => $hasVoted, - 'userVotes' => $userVotes - ]); - break; - - // 未知操作 - default: - ajaxReturn(1, '未知操作'); - break; -} diff --git a/ht/docs/superpowers/specs/2026-03-27-poetry-quiz-frontend-design.md b/ht/docs/superpowers/specs/2026-03-27-poetry-quiz-frontend-design.md deleted file mode 100644 index d17ee2a..0000000 --- a/ht/docs/superpowers/specs/2026-03-27-poetry-quiz-frontend-design.md +++ /dev/null @@ -1,111 +0,0 @@ -# 古诗文答题系统前端设计文档 - -## 概述 -为 `p1/api.php` API 创建一个古风风格的前端答题页面,包含题目获取、答案提交、提示功能和答题统计。 - -## 设计决策 - -### 布局风格 -- **选择**: 单卡片居中布局 -- **原因**: 答题系统一次只显示一道题,居中卡片布局更专注 - -### 配色方案 -- **选择**: 古风配色 -- **原因**: 符合古诗文主题,营造文化氛围 - -### 功能模块 -- 答题统计(答对/总题数) -- 题目导航(数字按钮) -- 题目详情(作者、朝代、年级、类型) - -## 页面架构 - -``` -┌─────────────────────────────────────────────┐ -│ 页面头部 │ -│ 📜 古诗文答题 · 统计信息 │ -├─────────────────────────────────────────────┤ -│ ┌─────────────────┐ │ -│ │ 题目导航条 │ │ -│ │ 1 2 3 4 5 ... │ │ -│ └─────────────────┘ │ -│ │ -│ ┌─────────────────┐ │ -│ │ 题目卡片 │ │ -│ │ (宣纸质感) │ │ -│ │ [选项按钮] │ │ -│ │ 💡 提示按钮 │ │ -│ └─────────────────┘ │ -│ │ -│ ┌─────────────────┐ │ -│ │ 题目详情 │ │ -│ │ 作者·朝代·年级 │ │ -│ └─────────────────┘ │ -└─────────────────────────────────────────────┘ -``` - -## 配色方案 - -```css ---bg-primary: #f5f0e6; /* 米色背景 */ ---bg-card: #fffef9; /* 宣纸白 */ ---text-primary: #5d4e37; /* 棕色文字 */ ---text-secondary: #8b7355; /* 浅棕色 */ ---accent: #c94c4c; /* 朱红色(印章色) */ ---border: #d4c5a9; /* 边框色 */ ---success: #4a7c59; /* 正确提示绿 */ ---error: #c94c4c; /* 错误提示红 */ -``` - -## 视觉元素 - -- 卡片圆角: 12px -- 选项按钮: 印章风格,方形圆角,悬停时微微放大 -- 动画: 平滑过渡 0.3s -- 字体: 题目使用「楷体」,选项使用「微软雅黑」 - -## 交互流程 - -1. 页面初始化 → 从 URL 获取 id 参数(默认 id=1) -2. 调用 API 获取题目 → 显示题目卡片 -3. 用户选择选项 → 提交答案 -4. API 返回结果 → 显示反馈 - - 正确: 显示成功动画,自动加载下一题 - - 错误: 显示错误提示,可点击「提示」按钮 - - 提示: 显示提示信息 - -## API 调用 - -```javascript -// 获取题目 -GET api.php?id=1 - -// 提交答案 -GET api.php?id=1&msg=1 - -// 获取提示 -GET api.php?id=1&msg=提示 -``` - -## 状态管理 - -- `currentId`: 当前题目 ID -- `correctCount`: 答对题数 -- `totalCount`: 总答题数 -- `selectedOption`: 当前选中选项 - -## 文件结构 - -``` -p1/ -├── index.html # 页面结构 -├── api.js # API 调用与交互逻辑 -├── api.php # 后端 API -└── API文档.md # API 文档 -``` - -## 错误处理 - -- 网络错误: 显示友好提示,提供重试按钮 -- API 错误: 显示错误信息 -- 题目不存在: 提示用户 diff --git a/ht/inc/conn.php b/ht/inc/conn.php deleted file mode 100644 index b593be8..0000000 --- a/ht/inc/conn.php +++ /dev/null @@ -1,78 +0,0 @@ - '简约投票简洁投票系统', - - // 数据库配置 - 'db' => [ - 'host' => 'localhost', - 'user' => 'toupiao', - 'pass' => 'toupiao', - 'name' => 'toupiao', - 'port' => 3306, - 'prefix' => 'tp_', - 'charset' => 'utf8' - ], - - // 资源文件缓存控制(修改版本号可更新前端缓存) - 'version' => [ - 'css' => '1.0.0', - 'js' => '1.0.0' - ] -]; - -// 数据库连接 -function dbConnect() { - global $CONFIG; - - $conn = new mysqli( - $CONFIG['db']['host'], - $CONFIG['db']['user'], - $CONFIG['db']['pass'], - $CONFIG['db']['name'], - $CONFIG['db']['port'] - ); - - // 检查连接 - if ($conn->connect_error) { - die("数据库连接失败: " . $conn->connect_error); - } - - // 设置字符集 - $conn->set_charset($CONFIG['db']['charset']); - - return $conn; -} - -// 数据表前缀函数 -function getTable($table) { - global $CONFIG; - return $CONFIG['db']['prefix'] . $table; -} - -// 获取带版本号的CSS路径 -function getCssPath($file) { - global $CONFIG; - return "/assets/css/{$file}?v=" . $CONFIG['version']['css']; -} - -// 获取带版本号的JS路径 -function getJsPath($file) { - global $CONFIG; - return "/assets/js/{$file}?v=" . $CONFIG['version']['js']; -} - -// 获取网站标题 -function getSiteTitle() { - global $CONFIG; - return $CONFIG['site_title']; -} diff --git a/ht/inc/css.css b/ht/inc/css.css deleted file mode 100644 index d29e6ed..0000000 --- a/ht/inc/css.css +++ /dev/null @@ -1,495 +0,0 @@ -/** - * 公共CSS样式 - */ - -/* 全局重置 */ -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - font-family: 'Microsoft YaHei', Arial, sans-serif; - font-size: 14px; - line-height: 1.5; - color: #333; - background-color: #f5f5f5; -} - -/* 顶部菜单样式 */ -.header { - background-color: #2c3e50; - color: #fff; - position: fixed; - width: 100%; - top: 0; - left: 0; - z-index: 100; - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); -} - -.header-container { - display: flex; - justify-content: space-between; - align-items: center; - max-width: 1200px; - margin: 0 auto; - padding: 0 15px; - height: 60px; -} - -.logo { - font-size: 20px; - font-weight: bold; -} - -.nav { - display: flex; -} - -.nav-item { - margin-left: 20px; - color: #fff; - text-decoration: none; - transition: color 0.3s; -} - -.nav-item:hover { - color: #3498db; -} - -.active { - color: #3498db; -} - -/* 主体内容 */ -.main { - max-width: 1200px; - margin: 80px auto 20px; - padding: 20px; - background-color: #fff; - border-radius: 5px; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); -} - -/* 遮罩层样式 */ -.mask-container { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.5); - display: flex; - justify-content: center; - align-items: center; - z-index: 1000; -} - -.mask-dialog { - position: relative; - background-color: #fff; - border-radius: 5px; - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); - width: 80%; - max-width: 600px; - display: flex; - flex-direction: column; - max-height: 90vh; -} - -.mask-title { - display: flex; - justify-content: space-between; - align-items: center; - padding: 15px 20px; - border-bottom: 1px solid #eee; -} - -.mask-title h3 { - margin: 0; - font-size: 18px; -} - -.mask-close { - font-size: 24px; - cursor: pointer; - color: #999; - transition: color 0.3s; -} - -.mask-close:hover { - color: #333; -} - -.mask-content { - padding: 20px; - overflow-y: auto; - flex: 1; -} - -.mask-buttons { - padding: 15px 20px; - border-top: 1px solid #eee; - display: flex; - justify-content: flex-end; - position: sticky; - bottom: 0; - background-color: #fff; - border-radius: 0 0 5px 5px; -} - -.mask-button { - padding: 8px 15px; - margin-left: 10px; - border: none; - border-radius: 3px; - cursor: pointer; - transition: background-color 0.3s; -} - -.btn-primary { - background-color: #3498db; - color: #fff; -} - -.btn-primary:hover { - background-color: #2980b9; -} - -.btn-default { - background-color: #f5f5f5; - color: #333; -} - -.btn-default:hover { - background-color: #e0e0e0; -} - -.btn-danger { - background-color: #e74c3c; - color: #fff; -} - -.btn-danger:hover { - background-color: #c0392b; -} - -/* 表格通用样式 */ -.table-container { - width: 100%; - overflow-x: auto; - margin-bottom: 20px; -} - -table { - width: 100%; - border-collapse: collapse; - border: 1px solid #ddd; -} - -th, td { - padding: 12px 15px; - text-align: left; - border-bottom: 1px solid #ddd; -} - -th { - background-color: #f8f8f8; - font-weight: bold; - cursor: pointer; - position: relative; -} - -th.sort-asc::after { - content: '↑'; - margin-left: 5px; -} - -th.sort-desc::after { - content: '↓'; - margin-left: 5px; -} - -tr:hover { - background-color: #f5f5f5; -} - -/* 表单通用样式 */ -.form-container { - max-width: 600px; - margin: 0 auto; -} - -.form-group { - margin-bottom: 15px; -} - -.form-label { - display: block; - margin-bottom: 5px; - font-weight: bold; -} - -.form-control { - width: 100%; - padding: 10px; - border: 1px solid #ddd; - border-radius: 3px; - font-size: 14px; - transition: border-color 0.3s; -} - -.form-control:focus { - border-color: #3498db; - outline: none; -} - -.form-error { - color: #e74c3c; - font-size: 12px; - margin-top: 5px; -} - -.form-submit { - background-color: #3498db; - color: #fff; - border: none; - padding: 10px 15px; - border-radius: 3px; - cursor: pointer; - transition: background-color 0.3s; -} - -.form-submit:hover { - background-color: #2980b9; -} - -/* 分页样式 */ -.pagination { - display: flex; - align-items: center; - justify-content: center; - margin: 20px 0; -} - -.pagination.disabled { - display: none; -} - -.page-item { - padding: 8px 12px; - margin: 0 3px; - border: 1px solid #ddd; - border-radius: 3px; - color: #333; - text-decoration: none; - transition: background-color 0.3s; -} - -.page-item:hover:not(.disabled) { - background-color: #f5f5f5; -} - -.page-item.disabled { - color: #ccc; - cursor: not-allowed; - background-color: #f5f5f5; -} - -.page-select { - margin: 0 10px; - padding: 8px; - border: 1px solid #ddd; - border-radius: 3px; -} - -/* 提示框样式 */ -.suggest-container { - position: absolute; - background-color: #fff; - border: 1px solid #ddd; - border-top: none; - border-radius: 0 0 3px 3px; - box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1); - z-index: 100; - max-height: 300px; - overflow-y: auto; -} - -.suggest-item { - padding: 10px; - cursor: pointer; - transition: background-color 0.3s; -} - -.suggest-item:hover { - background-color: #f5f5f5; -} - -.suggest-close { - padding: 10px; - text-align: right; - color: #999; - cursor: pointer; - border-bottom: 1px solid #eee; -} - -/* 按钮通用样式 */ -.btn { - display: inline-block; - padding: 8px 15px; - border: none; - border-radius: 3px; - cursor: pointer; - text-decoration: none; - transition: background-color 0.3s; - margin-right: 5px; -} - -.btn-sm { - padding: 5px 10px; - font-size: 12px; -} - -.btn-lg { - padding: 12px 20px; - font-size: 16px; -} - -.btn-blue { - background-color: #3498db; - color: #fff; -} - -.btn-blue:hover { - background-color: #2980b9; -} - -.btn-green { - background-color: #2ecc71; - color: #fff; -} - -.btn-green:hover { - background-color: #27ae60; -} - -.btn-red { - background-color: #e74c3c; - color: #fff; -} - -.btn-red:hover { - background-color: #c0392b; -} - -.btn-gray { - background-color: #95a5a6; - color: #fff; -} - -.btn-gray:hover { - background-color: #7f8c8d; -} - -/* 卡片样式 */ -.card { - background-color: #fff; - border-radius: 5px; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); - margin-bottom: 20px; - overflow: hidden; -} - -.card-header { - padding: 15px; - border-bottom: 1px solid #eee; - background-color: #f8f8f8; -} - -.card-title { - margin: 0; - font-size: 18px; -} - -.card-body { - padding: 15px; -} - -.card-footer { - padding: 15px; - border-top: 1px solid #eee; - background-color: #f8f8f8; -} - -/* 投票选项样式 */ -.vote-option { - border: 1px solid #ddd; - border-radius: 3px; - padding: 15px; - margin-bottom: 10px; - transition: all 0.3s; - cursor: pointer; -} - -.vote-option:hover { - border-color: #3498db; - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); -} - -.vote-option.selected { - border-color: #3498db; - background-color: #ebf5fb; -} - -.vote-option-img { - max-width: 100%; - height: auto; - margin-bottom: 10px; -} - -.vote-result { - margin-top: 5px; -} - -.vote-bar { - height: 20px; - background-color: #eee; - border-radius: 10px; - overflow: hidden; - margin-top: 5px; -} - -.vote-bar-fill { - height: 100%; - background-color: #3498db; - border-radius: 10px; -} - -/* 响应式调整 */ -@media (max-width: 768px) { - .header-container { - height: auto; - padding: 10px 15px; - flex-direction: column; - } - - .nav { - margin-top: 10px; - } - - .main { - margin-top: 120px; - padding: 15px; - } - - .mask-dialog { - width: 95%; - } - - .form-container { - padding: 0 10px; - } -} diff --git a/ht/inc/js.js b/ht/inc/js.js deleted file mode 100644 index dba1802..0000000 --- a/ht/inc/js.js +++ /dev/null @@ -1,458 +0,0 @@ -/** - * 公共JavaScript函数 - */ - -/** - * Ajax通信函数 - * @param {string} url - 请求地址 - * @param {Object} data - 请求数据 - * @param {Function} callback - 成功回调函数 - * @param {Function} errorCallback - 错误回调函数 - * @param {string} method - 请求方法(GET或POST) - */ -function ajaxRequest(url, data, callback, errorCallback, method) { - // 默认使用POST方法,除非act为get - if (!method) { - method = (data && data.act === 'get') ? 'GET' : 'POST'; - } - - // 创建XMLHttpRequest对象 - var xhr = new XMLHttpRequest(); - - // 准备发送请求 - xhr.open(method, url, true); - - // 设置请求头 - xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - - if (method === 'POST') { - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - } - - // 处理响应 - xhr.onreadystatechange = function() { - if (xhr.readyState === 4) { - if (xhr.status === 200) { - var response; - try { - response = JSON.parse(xhr.responseText); - if (callback && typeof callback === 'function') { - callback(response); - } - } catch (e) { - console.error('解析JSON失败:', e); - if (errorCallback && typeof errorCallback === 'function') { - errorCallback('解析响应失败'); - } - } - } else { - console.error('请求失败,状态码:', xhr.status); - if (errorCallback && typeof errorCallback === 'function') { - errorCallback('请求失败,状态码: ' + xhr.status); - } - } - } - }; - - // 处理请求超时 - xhr.ontimeout = function() { - console.error('请求超时'); - if (errorCallback && typeof errorCallback === 'function') { - errorCallback('请求超时'); - } - }; - - // 处理网络错误 - xhr.onerror = function() { - console.error('网络错误'); - if (errorCallback && typeof errorCallback === 'function') { - errorCallback('网络错误'); - } - }; - - // 发送请求 - if (method === 'POST' && data) { - // 将对象转换为查询字符串 - var params = Object.keys(data).map(function(key) { - return encodeURIComponent(key) + '=' + encodeURIComponent(data[key]); - }).join('&'); - xhr.send(params); - } else if (method === 'GET' && data) { - // 将查询参数添加到URL - var queryString = Object.keys(data).map(function(key) { - return encodeURIComponent(key) + '=' + encodeURIComponent(data[key]); - }).join('&'); - - var separator = url.indexOf('?') !== -1 ? '&' : '?'; - xhr.send(); - } else { - xhr.send(); - } -} - -/** - * 分页显示函数 - * @param {string} containerId - 分页容器ID - * @param {number} currentPage - 当前页码 - * @param {number} totalPages - 总页数 - * @param {Function} callback - 页码点击回调函数 - */ -function pagination(containerId, currentPage, totalPages, callback) { - var container = document.getElementById(containerId); - if (!container) return; - - // 清空容器 - container.innerHTML = ''; - - // 如果没有数据或只有一页,不显示分页 - if (totalPages <= 1) { - container.classList.add('disabled'); - return; - } - - container.classList.remove('disabled'); - - // 创建分页元素 - var paginationHtml = ''; - - // 首页按钮 - var firstDisabled = currentPage === 1 ? ' disabled' : ''; - paginationHtml += '首页'; - - // 上一页按钮 - var prevDisabled = currentPage === 1 ? ' disabled' : ''; - var prevPage = Math.max(1, currentPage - 1); - paginationHtml += '上一页'; - - // 页码下拉选择 - paginationHtml += ''; - - // 下一页按钮 - var nextDisabled = currentPage === totalPages ? ' disabled' : ''; - var nextPage = Math.min(totalPages, currentPage + 1); - paginationHtml += '下一页'; - - // 尾页按钮 - var lastDisabled = currentPage === totalPages ? ' disabled' : ''; - paginationHtml += '尾页'; - - // 设置HTML - container.innerHTML = paginationHtml; - - // 绑定事件 - // 点击页码按钮 - var pageItems = container.querySelectorAll('.page-item'); - for (var j = 0; j < pageItems.length; j++) { - var item = pageItems[j]; - if (!item.classList.contains('disabled')) { - item.addEventListener('click', function() { - var page = parseInt(this.getAttribute('data-page')); - if (callback && typeof callback === 'function') { - callback(page); - } - }); - } - } - - // 下拉选择页码 - var pageSelect = container.querySelector('.page-select'); - if (pageSelect) { - pageSelect.addEventListener('change', function() { - var page = parseInt(this.value); - if (callback && typeof callback === 'function') { - callback(page); - } - }); - } -} - -/** - * 表格排序函数 - * @param {string} tableId - 表格ID - * @param {number} colIndex - 排序列索引 - * @param {string} type - 排序类型(string, number, date) - */ -function sortTable(tableId, colIndex, type) { - var table = document.getElementById(tableId); - if (!table) return; - - var tbody = table.getElementsByTagName('tbody')[0]; - var rows = tbody.getElementsByTagName('tr'); - var sortedRows = Array.prototype.slice.call(rows, 0); - - // 确定排序方向 - var sortDirection = 1; // 1为升序,-1为降序 - if (table.getAttribute('data-sort-col') == colIndex) { - sortDirection = table.getAttribute('data-sort-dir') == 'asc' ? -1 : 1; - } - - // 保存排序信息 - table.setAttribute('data-sort-col', colIndex); - table.setAttribute('data-sort-dir', sortDirection == 1 ? 'asc' : 'desc'); - - // 排序 - sortedRows.sort(function(a, b) { - var cellA = a.cells[colIndex].textContent.trim(); - var cellB = b.cells[colIndex].textContent.trim(); - - if (type === 'number') { - return sortDirection * (parseFloat(cellA) - parseFloat(cellB)); - } else if (type === 'date') { - var dateA = new Date(cellA); - var dateB = new Date(cellB); - return sortDirection * (dateA - dateB); - } else { - return sortDirection * cellA.localeCompare(cellB); - } - }); - - // 更新表格显示 - for (var i = 0; i < sortedRows.length; i++) { - tbody.appendChild(sortedRows[i]); - } - - // 更新表格头部排序指示器 - var headers = table.getElementsByTagName('th'); - for (var j = 0; j < headers.length; j++) { - headers[j].classList.remove('sort-asc', 'sort-desc'); - } - - if (headers[colIndex]) { - headers[colIndex].classList.add(sortDirection == 1 ? 'sort-asc' : 'sort-desc'); - } -} - -/** - * 显示遮罩层 - * @param {string} title - 标题 - * @param {string} content - 内容 - * @param {Array} buttons - 按钮配置数组,格式:[{text: '按钮文字', callback: 回调函数, class: 'btn-class'}] - */ -function showMask(title, content, buttons) { - // 移除已存在的遮罩 - closeMask(); - - // 创建遮罩层 - var mask = document.createElement('div'); - mask.className = 'mask-container'; - - // 创建对话框 - var dialog = document.createElement('div'); - dialog.className = 'mask-dialog'; - - // 创建标题栏 - var titleBar = document.createElement('div'); - titleBar.className = 'mask-title'; - titleBar.innerHTML = '

' + title + '

×'; - - // 创建内容区 - var contentArea = document.createElement('div'); - contentArea.className = 'mask-content'; - contentArea.innerHTML = content; - - // 创建按钮区 - var buttonArea = document.createElement('div'); - buttonArea.className = 'mask-buttons'; - - if (buttons && buttons.length > 0) { - buttons.forEach(function(btn) { - var button = document.createElement('button'); - button.className = 'mask-button ' + (btn.class || ''); - button.textContent = btn.text; - - if (btn.callback && typeof btn.callback === 'function') { - button.addEventListener('click', function() { - btn.callback(); - }); - } - - buttonArea.appendChild(button); - }); - } - - // 组装对话框 - dialog.appendChild(titleBar); - dialog.appendChild(contentArea); - dialog.appendChild(buttonArea); - mask.appendChild(dialog); - - // 添加到页面 - document.body.appendChild(mask); - - // 绑定关闭事件 - var closeBtn = mask.querySelector('.mask-close'); - if (closeBtn) { - closeBtn.addEventListener('click', closeMask); - } - - // 绑定点击遮罩层关闭 - mask.addEventListener('click', function(e) { - if (e.target === mask) { - closeMask(); - } - }); - - // 禁止页面滚动 - document.body.style.overflow = 'hidden'; - - // 调整内容区域最大高度 - var contentMaxHeight = window.innerHeight * 0.7; - contentArea.style.maxHeight = contentMaxHeight + 'px'; -} - -/** - * 关闭遮罩层 - */ -function closeMask() { - var mask = document.querySelector('.mask-container'); - if (mask) { - mask.parentNode.removeChild(mask); - } - - // 恢复页面滚动 - document.body.style.overflow = ''; -} - -/** - * 输入提示功能 - * @param {string} inputId - 输入框ID - * @param {string} url - 获取提示数据的URL - * @param {Object} params - 附加参数 - * @param {Function} callback - 选择项后的回调函数 - */ -function searchSuggest(inputId, url, params, callback) { - var input = document.getElementById(inputId); - if (!input) return; - - // 创建提示容器 - var suggestContainer = document.createElement('div'); - suggestContainer.className = 'suggest-container'; - suggestContainer.style.display = 'none'; - input.parentNode.appendChild(suggestContainer); - - // 定位提示容器 - function positionSuggest() { - var rect = input.getBoundingClientRect(); - suggestContainer.style.top = (rect.bottom + window.scrollY) + 'px'; - suggestContainer.style.left = (rect.left + window.scrollX) + 'px'; - suggestContainer.style.width = rect.width + 'px'; - } - - // 暂存上一次请求的关键词 - var lastKeyword = ''; - var debounceTimer = null; - - // 处理输入事件 - input.addEventListener('input', function() { - var keyword = input.value.trim(); - - // 清除上一次的定时器 - if (debounceTimer) { - clearTimeout(debounceTimer); - } - - // 如果关键词为空,隐藏提示 - if (!keyword) { - suggestContainer.style.display = 'none'; - return; - } - - // 如果关键词与上一次相同,不重新请求 - if (keyword === lastKeyword) { - return; - } - - // 设置300ms的防抖定时器 - debounceTimer = setTimeout(function() { - lastKeyword = keyword; - - // 准备请求参数 - var requestParams = Object.assign({}, params || {}, { - keyword: keyword - }); - - // 发送请求获取提示数据 - ajaxRequest(url, requestParams, function(response) { - if (response.code === 0 && Array.isArray(response.data) && response.data.length > 0) { - // 清空容器 - suggestContainer.innerHTML = ''; - - // 添加关闭按钮 - var closeButton = document.createElement('div'); - closeButton.className = 'suggest-close'; - closeButton.textContent = '关闭'; - closeButton.addEventListener('click', function() { - suggestContainer.style.display = 'none'; - }); - suggestContainer.appendChild(closeButton); - - // 限制最多显示10条 - var maxItems = Math.min(10, response.data.length); - - // 添加提示项 - for (var i = 0; i < maxItems; i++) { - var item = response.data[i]; - var suggestionItem = document.createElement('div'); - suggestionItem.className = 'suggest-item'; - suggestionItem.textContent = item.text || item.name || item; - suggestionItem.setAttribute('data-value', item.value || item.id || item); - - // 绑定点击事件 - suggestionItem.addEventListener('click', function() { - var value = this.getAttribute('data-value'); - var text = this.textContent; - - // 设置输入框值 - input.value = text; - - // 隐藏提示 - suggestContainer.style.display = 'none'; - - // 触发回调 - if (callback && typeof callback === 'function') { - callback(value, text); - } - }); - - suggestContainer.appendChild(suggestionItem); - } - - // 显示提示容器 - positionSuggest(); - suggestContainer.style.display = 'block'; - } else { - suggestContainer.style.display = 'none'; - } - }, function() { - suggestContainer.style.display = 'none'; - }); - }, 300); - }); - - // 点击输入框时,如果有数据则显示提示 - input.addEventListener('click', function() { - if (lastKeyword && suggestContainer.childElementCount > 1) { - positionSuggest(); - suggestContainer.style.display = 'block'; - } - }); - - // 点击页面其他区域隐藏提示 - document.addEventListener('click', function(e) { - if (e.target !== input && !suggestContainer.contains(e.target)) { - suggestContainer.style.display = 'none'; - } - }); - - // 窗口调整大小时重新定位 - window.addEventListener('resize', function() { - if (suggestContainer.style.display === 'block') { - positionSuggest(); - } - }); -} diff --git a/ht/inc/pubs.php b/ht/inc/pubs.php deleted file mode 100644 index e3c4b7a..0000000 --- a/ht/inc/pubs.php +++ /dev/null @@ -1,147 +0,0 @@ - $code, - 'msg' => $msg, - 'data' => $data - ]); - exit; -} - -/** - * 检查用户登录状态 - * @return array|bool 已登录返回用户信息数组,未登录返回false - */ -function checkLogin() { - session_start(); - if (isset($_SESSION['user']) && !empty($_SESSION['user']['id'])) { - return $_SESSION['user']; - } - return false; -} - -/** - * 检查管理员权限 - * @return bool 是否具有管理员权限 - */ -function checkAdmin() { - $user = checkLogin(); - if ($user && $user['irole'] == 1) { - return true; - } - return false; -} - -/** - * 输入安全过滤 - * @param mixed $data 需要过滤的数据 - * @return mixed 过滤后的数据 - */ -function safeFilter($data) { - if (is_array($data)) { - foreach ($data as $key => $val) { - $data[$key] = safeFilter($val); - } - } else { - // 去除空格 - $data = trim($data); - // 转义特殊字符 - $data = htmlspecialchars($data, ENT_QUOTES); - // 防止SQL注入 - $data = addslashes($data); - } - return $data; -} - -/** - * 系统日志记录 - * @param int $userId 用户ID - * @param string $action 操作类型 - * @param string $content 操作内容 - */ -function writeLog($userId, $action, $content = '') { - $conn = dbConnect(); - $table = getTable('logs'); - $userId = (int)$userId; - $action = $conn->real_escape_string($action); - $content = $conn->real_escape_string($content); - $ip = $_SERVER['REMOTE_ADDR']; - $time = date('Y-m-d H:i:s'); - - $sql = "INSERT INTO {$table} (user_id, action, idesc, ip, logtime) VALUES ($userId, '$action', '$content', '$ip', '$time')"; - $conn->query($sql); - $conn->close(); -} - -/** - * 权限检查函数 - * @param string $action 操作名称 - * @param bool $adminRequired 是否需要管理员权限 - * @return bool|array 成功返回用户信息,失败返回false - */ -function checkAuth($action, $adminRequired = false) { - $user = checkLogin(); - - // 未登录 - if (!$user) { - ajaxReturn(403, '请先登录后再操作'); - return false; - } - - // 需要管理员权限但不是管理员 - if ($adminRequired && $user['irole'] != 1) { - ajaxReturn(403, '权限不足,需要管理员权限'); - return false; - } - - return $user; -} - -/** - * 获取分页参数 - * @param int $total 总记录数 - * @param int $page 当前页码 - * @param int $pageSize 每页记录数 - * @return array 分页信息 - */ -function getPagination($total, $page = 1, $pageSize = 10) { - $page = max(1, intval($page)); - $pageSize = max(1, intval($pageSize)); - - $totalPage = ceil($total / $pageSize); - $totalPage = max(1, $totalPage); - $page = min($page, $totalPage); - - $offset = ($page - 1) * $pageSize; - - return [ - 'total' => $total, - 'page' => $page, - 'pageSize' => $pageSize, - 'totalPage' => $totalPage, - 'offset' => $offset - ]; -} - -/** - * 获取当前时间 - * @return string 格式化的时间字符串 - */ -function getCurrentTime() { - return date('Y-m-d H:i:s'); -} diff --git a/ht/inc/sqls.php b/ht/inc/sqls.php deleted file mode 100644 index 746aa39..0000000 --- a/ht/inc/sqls.php +++ /dev/null @@ -1,281 +0,0 @@ -conn = dbConnect(); - $this->prefix = $CONFIG['db']['prefix']; - } - - /** - * 析构函数,关闭数据库连接 - */ - public function __destruct() { - if ($this->conn) { - $this->conn->close(); - } - } - - /** - * 转义字符串 - * @param string $str 需要转义的字符串 - * @return string 转义后的字符串 - */ - public function escape($str) { - return $this->conn->real_escape_string($str); - } - - /** - * 获取带前缀的表名 - * @param string $table 表名 - * @return string 带前缀的表名 - */ - public function table($table) { - return $this->prefix . $table; - } - - /** - * 执行SQL查询 - * @param string $sql SQL语句 - * @return mysqli_result|bool 查询结果 - */ - public function query($sql) { - return $this->conn->query($sql); - } - - /** - * 获取一条记录 - * @param string $table 表名(不带前缀) - * @param string|array $where 查询条件 - * @param string $fields 返回字段 - * @return array|null 查询结果 - */ - public function getOne($table, $where = '', $fields = '*') { - $table = $this->table($table); - $whereStr = $this->parseWhere($where); - - $sql = "SELECT {$fields} FROM {$table} {$whereStr} LIMIT 1"; - $result = $this->query($sql); - - if ($result && $result->num_rows > 0) { - return $result->fetch_assoc(); - } - - return null; - } - - /** - * 获取多条记录 - * @param string $table 表名(不带前缀) - * @param string|array $where 查询条件 - * @param string $fields 返回字段 - * @param string $order 排序方式 - * @param string $limit 限制条数 - * @return array 查询结果 - */ - public function getAll($table, $where = '', $fields = '*', $order = '', $limit = '') { - $table = $this->table($table); - $whereStr = $this->parseWhere($where); - $orderStr = $order ? "ORDER BY {$order}" : ''; - $limitStr = $limit ? "LIMIT {$limit}" : ''; - - $sql = "SELECT {$fields} FROM {$table} {$whereStr} {$orderStr} {$limitStr}"; - $result = $this->query($sql); - - $rows = []; - if ($result) { - while ($row = $result->fetch_assoc()) { - $rows[] = $row; - } - } - - return $rows; - } - - /** - * 插入数据 - * @param string $table 表名(不带前缀) - * @param array $data 数据数组 - * @return int|bool 成功返回插入ID,失败返回false - */ - public function insert($table, $data) { - $table = $this->table($table); - - $fields = []; - $values = []; - - foreach ($data as $key => $value) { - $fields[] = "`{$key}`"; - if ($value === null) { - $values[] = "NULL"; - } else { - $values[] = "'" . $this->escape($value) . "'"; - } - } - - $fieldsStr = implode(', ', $fields); - $valuesStr = implode(', ', $values); - - $sql = "INSERT INTO {$table} ({$fieldsStr}) VALUES ({$valuesStr})"; - $result = $this->query($sql); - - if ($result) { - return $this->conn->insert_id; - } - - return false; - } - - /** - * 更新数据 - * @param string $table 表名(不带前缀) - * @param array $data 数据数组 - * @param string|array $where 更新条件 - * @return bool 更新结果 - */ - public function update($table, $data, $where) { - $table = $this->table($table); - $whereStr = $this->parseWhere($where); - - $set = []; - foreach ($data as $key => $value) { - if ($value === null) { - $set[] = "`{$key}` = NULL"; - } else { - $set[] = "`{$key}` = '" . $this->escape($value) . "'"; - } - } - - $setStr = implode(', ', $set); - - $sql = "UPDATE {$table} SET {$setStr} {$whereStr}"; - $result = $this->query($sql); - - return $result !== false; - } - - /** - * 删除数据 - * @param string $table 表名(不带前缀) - * @param string|array $where 删除条件 - * @return bool 删除结果 - */ - public function delete($table, $where) { - $table = $this->table($table); - $whereStr = $this->parseWhere($where); - - if (empty($whereStr)) { - return false; // 防止误删除全表 - } - - $sql = "DELETE FROM {$table} {$whereStr}"; - $result = $this->query($sql); - - return $result !== false; - } - - /** - * 获取记录数量 - * @param string $table 表名(不带前缀) - * @param string|array $where 查询条件 - * @return int 记录数量 - */ - public function count($table, $where = '') { - $table = $this->table($table); - $whereStr = $this->parseWhere($where); - - $sql = "SELECT COUNT(*) AS count FROM {$table} {$whereStr}"; - $result = $this->query($sql); - - if ($result && $result->num_rows > 0) { - $row = $result->fetch_assoc(); - return (int) $row['count']; - } - - return 0; - } - - /** - * 开始事务 - */ - public function startTransaction() { - $this->conn->autocommit(false); - } - - /** - * 提交事务 - */ - public function commit() { - $this->conn->commit(); - $this->conn->autocommit(true); - } - - /** - * 回滚事务 - */ - public function rollback() { - $this->conn->rollback(); - $this->conn->autocommit(true); - } - - /** - * 解析查询条件 - * @param string|array $where 查询条件 - * @return string 解析后的WHERE子句 - */ - private function parseWhere($where) { - if (empty($where)) { - return ''; - } - - // 如果是字符串,直接返回 - if (is_string($where)) { - return "WHERE {$where}"; - } - - // 如果是数组,解析为查询条件 - if (is_array($where)) { - $conditions = []; - - foreach ($where as $key => $value) { - if ($value === null) { - $conditions[] = "`{$key}` IS NULL"; - } else { - $conditions[] = "`{$key}` = '" . $this->escape($value) . "'"; - } - } - - return "WHERE " . implode(' AND ', $conditions); - } - - return ''; - } - - /** - * 获取最后的错误信息 - * @return string 错误信息 - */ - public function getError() { - return $this->conn->error; - } - - /** - * 获取最后执行的SQL影响行数 - * @return int 影响行数 - */ - public function affectedRows() { - return $this->conn->affected_rows; - } -} diff --git a/ht/index.php b/ht/index.php index da5c99a..7e899fc 100644 --- a/ht/index.php +++ b/ht/index.php @@ -1,372 +1,372 @@ -= 0) { - $whereConditions[] = "status = $status"; -} -if ($type >= 0) { - $whereConditions[] = "itype = $type"; -} - -// 当前时间,用于判断投票是否进行中 -$now = date('Y-m-d H:i:s'); -$whereStr = !empty($whereConditions) ? implode(' AND ', $whereConditions) : ''; - -// 获取总记录数 -$total = $db->count('vote', $whereStr); - -// 计算分页信息 -$pagination = getPagination($total, $page, $pageSize); - -// 获取投票列表 -$orderBy = "addtime DESC"; -$limit = "{$pagination['offset']}, {$pagination['pageSize']}"; -$voteList = $db->getAll('vote', $whereStr, '*', $orderBy, $limit); - -// 页面标题 -$pageTitle = "投票系统首页"; -?> - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - + 诗词收录 - 古诗词鉴赏平台 + - -
-
- - +
+
+

📜 诗词收录

+

收录经典诗词,传承中华文化

-
- - -
-

投票列表

- - -
-
-
-
- - + +
+
+ + +
+ +
+ +
-
- - +
+ + +
-
- - 重置 +
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ +
+ + -
- - - - - - - -
- - $now) { - $voteStatus = '未开始'; - $statusClass = 'vote-status-pending'; - } elseif ($vote['endtime'] < $now) { - $voteStatus = '已结束'; - $statusClass = 'vote-status-ended'; - } else { - $voteStatus = '进行中'; - $statusClass = 'vote-status-active'; - } - } - ?> -
-
-

- - -

-
-
-

- - 100): ?>... -

-

类型:

-

时间:

-

浏览:

-
- -
- + +
+

🔧 开发者调试工具

+ + + +
- - - - -
-
-

暂无投票数据

-
-
- +
- - + + + - - diff --git a/ht/login.php b/ht/login.php deleted file mode 100644 index 6fb06f5..0000000 --- a/ht/login.php +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
-
- - -
-
- - -
- -
- - - - - diff --git a/ht/p1/API文档.md b/ht/p1/API文档.md deleted file mode 100644 index 399f7fa..0000000 --- a/ht/p1/API文档.md +++ /dev/null @@ -1,503 +0,0 @@ -# 古诗文答题系统 API 文档 - -## 文件信息 -- **文件路径**: `p1/api.php` -- **功能描述**: 古诗文题目获取与答题系统 -- **编码格式**: UTF-8 -- **响应格式**: JSON - -## 安全认证 - -### Key 认证机制 -API 采用动态 Key 认证,防止接口被滥用。 - -#### 认证原理 -1. **客户端生成 Key**: 使用 `SHA256(时间戳 + 密钥)` 生成 -2. **服务端验证**: 验证 Key 是否在有效期内(默认 300 秒) -3. **Key 更新**: 每次成功请求后,服务端返回新的 `new_key` - -#### 密钥配置 -- **前端**: `api.js` 中的 `SECRET_KEY` 变量 -- **后端**: `api.php` 中的 `SECRET_KEY` 常量 -- **默认密钥**: `tzgsc_2026_secret_key` - -#### Key 生成算法 - -##### PHP -```php - String { - let timestamp = SystemTime::now() - .duration_since(UNIX_EPOCH) - .unwrap() - .as_secs(); - - let data = format!("{}{}", timestamp, SECRET_KEY); - let mut hasher = Sha256::new(); - hasher.update(data.as_bytes()); - let result = hasher.finalize(); - - hex::encode(result) -} - -// 使用示例 -fn main() { - let key = generate_key(); - let encoded_key = urlencoding::encode(&key); - let url = format!("api.php?id=1&key={}", encoded_key); - println!("{}", url); -} -``` - -### 请求限制 - -| 类型 | 限制 | 说明 | -|------|------|------| -| 无 Key 请求 | 10 次/分钟 | 基于 IP 地址限制 | -| 有 Key 请求 | 无限制 | 验证通过后无频率限制 | - -#### 限制配置 -```php -define('KEY_EXPIRE_TIME', 300); // Key 有效期(秒) -define('MAX_REQUESTS_NO_KEY', 10); // 无 Key 最大请求次数 -define('RATE_LIMIT_WINDOW', 60); // 限流时间窗口(秒) -``` - -## 接口信息 - -### 接口概述 -该接口用于获取古诗文题目、验证答案、获取提示信息,支持 GET 和 POST 请求方式。 - -### 请求参数 - -| 参数名 | 类型 | 必填 | 说明 | -|--------|------|------|------| -| id | string/int | 是 | 题目唯一标识符 | -| msg | string | 否 | 操作类型:答案序号/提示 | -| key | string | 否 | 认证密钥(推荐携带) | - -### 请求示例 - -#### 1. 获取题目 -``` -GET p1/api.php?id=1&key=xxx -``` - -POST 请求: -``` -POST p1/api.php -Content-Type: application/json - -{ - "id": "1", - "key": "xxx" -} -``` - -#### 2. 提交答案 -``` -GET p1/api.php?id=1&msg=1&key=xxx -``` - -POST 请求: -``` -POST p1/api.php -Content-Type: application/json - -{ - "id": "1", - "msg": "1", - "key": "xxx" -} -``` - -#### 3. 获取提示 -``` -GET p1/api.php?id=1&msg=提示&key=xxx -``` - -POST 请求: -``` -POST p1/api.php -Content-Type: application/json - -{ - "id": "1", - "msg": "提示", - "key": "xxx" -} -``` - -### 响应信息 - -#### 获取题目成功响应 -```json -{ - "success": true, - "new_key": "新的认证密钥", - "data": { - "id": "1", - "question": "题目内容", - "options": [ - { - "num": 1, - "text": "选项1" - }, - { - "num": 2, - "text": "选项2" - }, - { - "num": 3, - "text": "选项3" - }, - { - "num": 4, - "text": "选项4" - } - ], - "author": "作者", - "type": "描写类型", - "grade": "学习阶段", - "dynasty": "年代" - } -} -``` - -#### 答案正确响应 -```json -{ - "success": true, - "type": "correct", - "message": "恭喜你,回答正确。请继续下一题", - "next_question": { - "id": "2", - "question": "下一题题目", - "options": [ - ... - ], - "author": "作者", - "type": "描写类型", - "grade": "学习阶段", - "dynasty": "年代" - } -} -``` - -#### 答案错误响应 -```json -{ - "success": true, - "type": "wrong", - "message": "抱歉,答案不对哦。你可以回复提示获取该题的部分信息哦。" -} -``` - -#### 提示响应 -```json -{ - "success": true, - "type": "hint", - "message": "这是首描写[描写类型]的诗,你在[学习阶段]学过它。" -} -``` - -#### 获取失败响应 -```json -{ - "success": false, - "message": "抱歉,获取出现错误。" -} -``` - -#### 错误参数响应 -```json -{ - "success": false, - "message": "缺少必要参数: id" -} -``` - -#### 不支持的请求方法 -```json -{ - "success": false, - "message": "不支持的请求方法" -} -``` - -#### 请求频率限制 -```json -{ - "success": false, - "message": "请求过于频繁,请稍后再试" -} -``` -HTTP 状态码: 429 - -## 核心功能说明 - -### 1. 题目数据来源 -- 从百度汉语 API 获取题目数据 -- API 地址: `https://hanyu.baidu.com/hanyu/ajax/pingce_data` - -### 2. 数据存储 -- 题目数据存储在 `data/tzgsc/` 目录 -- 文件格式: `.json` -- 文件命名: `{id}.json` -- JSON 缓存: `data/tzgsc.json` - -### 3. 数据格式 -题目数据存储格式 (JSON): -```json -{ - "id": "1", - "question": "题目内容", - "options": [ - {"num": 1, "text": "选项1"}, - {"num": 2, "text": "选项2"}, - {"num": 3, "text": "选项3"}, - {"num": 4, "text": "选项4"} - ], - "author": "作者", - "type": "描写类型", - "grade": "学习阶段", - "dynasty": "年代", - "correct_answer": 1 -} -``` - -### 4. 核心函数 - -#### get_question($id) -获取并返回题目 -- **参数**: $id - 题目 ID -- **返回**: 包含题目信息的数组 - -#### submit_answer($id, $msg) -提交答案并返回结果 -- **参数**: - - $id - 题目 ID - - $msg - 答案序号或"提示" -- **返回**: 包含答题结果的数组 - -#### cj($data) -采集并缓存题目数据 -- **参数**: $data - API 返回的原始数据 -- **功能**: 解析题目数据,去重后保存到 JSON 文件 - -#### get_curl($url, $post, $referer, $cookie, $header, $ua, $nobaody) -发送 HTTP 请求 -- **参数**: - - $url - 请求地址 - - $post - POST 数据 - - $referer - 来源地址 - - $cookie - Cookie - - $header - 是否返回头部 - - $ua - User-Agent - - $nobaody - 是否不返回内容 -- **功能**: 使用 cURL 发送 HTTP 请求,支持 SSL 和 GZIP 压缩 - -#### replace_unicode_escape_sequence($match) -Unicode 转义序列转换 -- **参数**: $match - 匹配到的 Unicode 序列 -- **返回**: UTF-8 编码的字符串 -- **功能**: 将 Unicode 转义序列转换为 UTF-8 字符 - -## 目录结构 -``` -p1/ -├── api.php # API 接口文件 -├── index.php # 前端页面(服务端生成初始 Key) -├── api.js # 前端交互脚本 -└── data/ - ├── tzgsc.json # 题目缓存文件 - ├── rate_limit/ # 请求限制记录目录 - └── tzgsc/ - └── [id].json # 题目数据文件 -``` - -## 注意事项 -1. 确保 `data/tzgsc/` 目录具有写入权限 -2. API 依赖百度汉语接口,需确保网络连接正常 -3. 题目数据会缓存到本地,避免重复请求 -4. 答案验证时会读取本地保存的题目数据文件 -5. 支持 Unicode 编码处理和 GZIP 压缩响应 -6. 支持 GET 和 POST 两种请求方式 -7. 所有响应均为 JSON 格式 diff --git a/ht/p1/api.js b/ht/p1/api.js deleted file mode 100644 index f5f04c7..0000000 --- a/ht/p1/api.js +++ /dev/null @@ -1,344 +0,0 @@ -(function() { - 'use strict'; - - var state = { - currentId: 1, - correctCount: 0, - totalCount: 0, - selectedOption: null, - isLoading: false, - answered: false, - currentKey: window.INITIAL_KEY || null - }; - - var elements = { - questionCard: document.getElementById('questionCard'), - navigation: document.getElementById('navigation'), - details: document.getElementById('details'), - loading: document.getElementById('loading'), - correctCount: document.getElementById('correctCount'), - totalCount: document.getElementById('totalCount'), - feedback: document.getElementById('feedback'), - feedbackIcon: document.getElementById('feedbackIcon'), - feedbackText: document.getElementById('feedbackText'), - overlay: document.getElementById('overlay'), - detailAuthor: document.getElementById('detailAuthor'), - detailDynasty: document.getElementById('detailDynasty'), - detailType: document.getElementById('detailType'), - detailGrade: document.getElementById('detailGrade') - }; - - function getUrlParam(name) { - var urlParams = new URLSearchParams(window.location.search); - return urlParams.get(name); - } - - function setUrlParam(name, value) { - var url = new URL(window.location.href); - url.searchParams.set(name, value); - window.history.replaceState({}, '', url); - } - - function fetchData(url, callback, errorCallback) { - if (!state.currentKey) { - errorCallback('未初始化 Key'); - return; - } - - var separator = url.indexOf('?') !== -1 ? '&' : '?'; - var fullUrl = url + separator + 'key=' + encodeURIComponent(state.currentKey); - - var xhr = new XMLHttpRequest(); - xhr.open('GET', fullUrl, true); - xhr.setRequestHeader('Accept', 'application/json'); - - xhr.onreadystatechange = function() { - if (xhr.readyState === 4) { - if (xhr.status === 200) { - try { - var response = JSON.parse(xhr.responseText); - if (response.new_key) { - state.currentKey = response.new_key; - } - callback(response); - } catch (e) { - errorCallback('解析响应失败'); - } - } else if (xhr.status === 429) { - errorCallback('请求过于频繁,请稍后再试'); - } else { - errorCallback('请求失败,状态码: ' + xhr.status); - } - } - }; - - xhr.onerror = function() { - errorCallback('网络错误'); - }; - - xhr.send(); - } - - function fetchQuestion(id) { - if (state.isLoading) return; - - state.isLoading = true; - state.answered = false; - state.selectedOption = null; - - showLoading(); - - fetchData('api.php?id=' + id, function(response) { - state.isLoading = false; - - if (response.success) { - renderQuestion(response.data); - updateNavigation(id); - updateDetails(response.data); - } else { - showError(response.message || '获取题目失败'); - } - }, function(error) { - state.isLoading = false; - showError(error); - }); - } - - function submitAnswer(id, answer) { - if (state.isLoading || state.answered) return; - - state.isLoading = true; - - fetchData('api.php?id=' + id + '&msg=' + answer, function(response) { - state.isLoading = false; - - if (response.success) { - state.totalCount++; - updateStats(); - - if (response.type === 'correct') { - state.correctCount++; - updateStats(); - showFeedback('correct', '🎉 ' + response.message); - markOption(answer, 'correct'); - - setTimeout(function() { - hideFeedback(); - if (response.next_question) { - state.currentId++; - setUrlParam('id', state.currentId); - renderQuestion(response.next_question); - updateNavigation(state.currentId); - updateDetails(response.next_question); - } else { - state.currentId++; - setUrlParam('id', state.currentId); - fetchQuestion(state.currentId); - } - }, 1500); - } else if (response.type === 'wrong') { - showFeedback('wrong', '😢 ' + response.message); - markOption(answer, 'wrong'); - setTimeout(function() { - hideFeedback(); - clearOptionMark(answer); - }, 2000); - } else if (response.type === 'hint') { - showHintMessage(response.message); - } - } else { - showFeedback('wrong', response.message || '提交失败'); - setTimeout(hideFeedback, 2000); - } - }, function(error) { - state.isLoading = false; - showFeedback('wrong', error); - setTimeout(hideFeedback, 2000); - }); - } - - function getHint(id) { - if (state.isLoading) return; - - state.isLoading = true; - - fetchData('api.php?id=' + id + '&msg=提示', function(response) { - state.isLoading = false; - - if (response.success && response.type === 'hint') { - showHintMessage(response.message); - } else { - showFeedback('wrong', response.message || '获取提示失败'); - setTimeout(hideFeedback, 2000); - } - }, function(error) { - state.isLoading = false; - showFeedback('wrong', error); - setTimeout(hideFeedback, 2000); - }); - } - - function showLoading() { - elements.questionCard.innerHTML = '
加载中
'; - elements.details.style.display = 'none'; - } - - function showError(message) { - elements.questionCard.innerHTML = - '
' + - '

❌ ' + message + '

' + - '' + - '
'; - elements.details.style.display = 'none'; - } - - function renderQuestion(data) { - var html = '第 ' + data.id + ' 题'; - html += '
' + escapeHtml(data.question) + '
'; - html += '
'; - - data.options.forEach(function(option) { - html += ''; - }); - - html += '
'; - html += ''; - html += '
'; - - elements.questionCard.innerHTML = html; - } - - function updateNavigation(currentId) { - var html = ''; - var start = Math.max(1, currentId - 4); - var end = currentId + 5; - - for (var i = start; i <= end; i++) { - var activeClass = i === currentId ? ' active' : ''; - html += ''; - } - - elements.navigation.innerHTML = html; - } - - function updateDetails(data) { - elements.detailAuthor.textContent = data.author || '-'; - elements.detailDynasty.textContent = data.dynasty || '-'; - elements.detailType.textContent = data.type || '-'; - elements.detailGrade.textContent = data.grade || '-'; - elements.details.style.display = 'grid'; - } - - function updateStats() { - elements.correctCount.textContent = state.correctCount; - elements.totalCount.textContent = state.totalCount; - } - - function selectOption(num) { - if (state.answered || state.isLoading) return; - - var buttons = document.querySelectorAll('.option-btn'); - buttons.forEach(function(btn) { - btn.classList.remove('selected'); - }); - - var selectedBtn = document.querySelector('.option-btn[data-num="' + num + '"]'); - if (selectedBtn) { - selectedBtn.classList.add('selected'); - } - - state.selectedOption = num; - submitAnswer(state.currentId, num); - } - - function markOption(num, type) { - var btn = document.querySelector('.option-btn[data-num="' + num + '"]'); - if (btn) { - btn.classList.add(type); - } - } - - function clearOptionMark(num) { - var btn = document.querySelector('.option-btn[data-num="' + num + '"]'); - if (btn) { - btn.classList.remove('wrong', 'selected'); - } - } - - function showFeedback(type, message) { - elements.feedback.className = 'feedback show ' + type; - elements.feedbackIcon.textContent = type === 'correct' ? '🎉' : '😢'; - elements.feedbackText.textContent = message.replace(/^[🎉😢]\s*/, ''); - elements.overlay.classList.add('show'); - } - - function hideFeedback() { - elements.feedback.classList.remove('show'); - elements.overlay.classList.remove('show'); - } - - function showHintMessage(message) { - var hintEl = document.getElementById('hintMessage'); - if (hintEl) { - hintEl.textContent = '💡 ' + message; - hintEl.classList.add('show'); - } - } - - function goToQuestion(id) { - if (state.isLoading) return; - - state.currentId = id; - state.answered = false; - state.selectedOption = null; - setUrlParam('id', id); - fetchQuestion(id); - } - - function goToRandomQuestion() { - if (state.isLoading) return; - - var randomId = Math.floor(Math.random() * 500) + 1; - goToQuestion(randomId); - } - - function retry() { - fetchQuestion(state.currentId); - } - - function escapeHtml(text) { - var div = document.createElement('div'); - div.textContent = text; - return div.innerHTML; - } - - function init() { - var idParam = getUrlParam('id'); - if (idParam) { - state.currentId = parseInt(idParam, 10) || 1; - } else { - state.currentId = Math.floor(Math.random() * 500) + 1; - } - - fetchQuestion(state.currentId); - } - - window.PoetryQuiz = { - selectOption: selectOption, - getHint: function() { getHint(state.currentId); }, - goToQuestion: goToQuestion, - goToRandomQuestion: goToRandomQuestion, - retry: retry - }; - - if (document.readyState === 'loading') { - document.addEventListener('DOMContentLoaded', init); - } else { - init(); - } -})(); diff --git a/ht/p1/api.php b/ht/p1/api.php deleted file mode 100644 index 8ea8e91..0000000 --- a/ht/p1/api.php +++ /dev/null @@ -1,375 +0,0 @@ - false, - 'message' => $message - ], $status_code); -} - -function generate_new_key($timestamp = null) { - if ($timestamp === null) { - $timestamp = time(); - } - $data = $timestamp . SECRET_KEY; - return hash('sha256', $data); -} - -function verify_key($key, &$new_key = null) { - if (empty($key)) { - return false; - } - - $current_time = time(); - - for ($i = 0; $i <= KEY_EXPIRE_TIME; $i++) { - $expected_key = generate_new_key($current_time - $i); - if (hash_equals($expected_key, $key)) { - $new_key = generate_new_key(); - return true; - } - } - - return false; -} - -function get_client_ip() { - $ip = ''; - if (!empty($_SERVER['HTTP_CLIENT_IP'])) { - $ip = $_SERVER['HTTP_CLIENT_IP']; - } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { - $ip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0]; - } elseif (!empty($_SERVER['REMOTE_ADDR'])) { - $ip = $_SERVER['REMOTE_ADDR']; - } - return trim($ip); -} - -function check_rate_limit($ip) { - $limit_file = "data/rate_limit/" . md5($ip) . ".json"; - - if (!is_dir("data/rate_limit")) { - mkdir("data/rate_limit", 0755, true); - } - - $current_time = time(); - $requests = []; - - if (file_exists($limit_file)) { - $requests = json_decode(file_get_contents($limit_file), true) ?: []; - } - - $requests = array_filter($requests, function($time) use ($current_time) { - return ($current_time - $time) < RATE_LIMIT_WINDOW; - }); - - return count($requests); -} - -function record_request($ip) { - $limit_file = "data/rate_limit/" . md5($ip) . ".json"; - - if (!is_dir("data/rate_limit")) { - mkdir("data/rate_limit", 0755, true); - } - - $current_time = time(); - $requests = []; - - if (file_exists($limit_file)) { - $requests = json_decode(file_get_contents($limit_file), true) ?: []; - } - - $requests[] = $current_time; - - $requests = array_filter($requests, function($time) use ($current_time) { - return ($current_time - $time) < RATE_LIMIT_WINDOW; - }); - - file_put_contents($limit_file, json_encode(array_values($requests))); -} - -function get_key_param() { - if (isset($_GET['key'])) { - return $_GET['key']; - } - if (isset($_POST['key'])) { - return $_POST['key']; - } - $input = json_decode(file_get_contents('php://input'), true); - if (isset($input['key'])) { - return $input['key']; - } - return null; -} - -$method = $_SERVER['REQUEST_METHOD']; -$key = get_key_param(); -$ip = get_client_ip(); -$new_key = null; - -if (!verify_key($key, $new_key)) { - $request_count = check_rate_limit($ip); - - if ($request_count >= MAX_REQUESTS_NO_KEY) { - error_response('请求过于频繁,请稍后再试', 429); - } - - record_request($ip); -} - -if ($method === 'GET') { - $id = isset($_GET['id']) ? $_GET['id'] : ''; - $msg = isset($_GET['msg']) ? $_GET['msg'] : ''; - - if (empty($id)) { - error_response('缺少必要参数: id'); - } - - if (empty($msg)) { - $result = get_question($id); - if ($new_key) { - $result['new_key'] = $new_key; - } - send_json_response($result); - } else { - $result = submit_answer($id, $msg); - if ($new_key) { - $result['new_key'] = $new_key; - } - send_json_response($result); - } -} elseif ($method === 'POST') { - $input = json_decode(file_get_contents('php://input'), true); - $id = isset($input['id']) ? $input['id'] : ''; - $msg = isset($input['msg']) ? $input['msg'] : ''; - - if (empty($id)) { - error_response('缺少必要参数: id'); - } - - if (empty($msg)) { - $result = get_question($id); - if ($new_key) { - $result['new_key'] = $new_key; - } - send_json_response($result); - } else { - $result = submit_answer($id, $msg); - if ($new_key) { - $result['new_key'] = $new_key; - } - send_json_response($result); - } -} else { - error_response('不支持的请求方法', 405); -} - -function get_question($id) { - $data = get_curl("https://hanyu.baidu.com/hanyu/ajax/pingce_data"); - $data = preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $data); - - $cj = cj($data); - - $s = preg_match_all('/{"question_content":"(.*?)","type":{"person":"(.*?)","type":"(.*?)","grade":"(.*?)","dynasty":"(.*?)"},"option_answers":\[(.*?)\]}/', $data, $t); - - if ($s == 0) { - return [ - 'success' => false, - 'message' => '抱歉,获取出现错误。' - ]; - } - - $tm = $t[1][0]; - $z = $t[2][0]; - $l = $t[3][0]; - $n = $t[4][0]; - $nd = $t[5][0]; - - preg_match_all('/{"answer_content":"(.*?)","is_standard_answer":(.*?)}/', $t[6][0], $d); - - $options = []; - $correct_answer = null; - - for ($i = 0; $i < 4; $i++) { - $d1 = $d[1][$i]; - $p = $d[2][$i]; - $option_num = $i + 1; - - $options[] = [ - 'num' => $option_num, - 'text' => $d1 - ]; - - if ($p == "1") { - $correct_answer = $option_num; - } - } - - $question_data = [ - 'id' => $id, - 'question' => $tm, - 'options' => $options, - 'author' => $z, - 'type' => $l, - 'grade' => $n, - 'dynasty' => $nd, - 'correct_answer' => $correct_answer - ]; - - file_put_contents("data/tzgsc/" . $id . ".json", json_encode($question_data, JSON_UNESCAPED_UNICODE)); - - return [ - 'success' => true, - 'data' => [ - 'id' => $id, - 'question' => $tm, - 'options' => $options, - 'author' => $z, - 'type' => $l, - 'grade' => $n, - 'dynasty' => $nd - ] - ]; -} - -function submit_answer($id, $msg) { - $data_file = "data/tzgsc/" . $id . ".json"; - - if (!file_exists($data_file)) { - return [ - 'success' => false, - 'message' => '题目数据不存在,请先获取题目' - ]; - } - - $question_data = json_decode(file_get_contents($data_file), true); - - if ($msg === "提示") { - return [ - 'success' => true, - 'type' => 'hint', - 'message' => '这是首描写' . $question_data['type'] . '的诗,你在' . $question_data['grade'] . '学过它。' - ]; - } - - if ($msg == $question_data['correct_answer']) { - $next_id = $id + 1; - $next_question = get_question($next_id); - - return [ - 'success' => true, - 'type' => 'correct', - 'message' => '恭喜你,回答正确。请继续下一题', - 'next_question' => $next_question['success'] ? $next_question['data'] : null - ]; - } else { - return [ - 'success' => true, - 'type' => 'wrong', - 'message' => '抱歉,答案不对哦。你可以回复提示获取该题的部分信息哦。' - ]; - } -} - -function cj($data) { - if (!$data) return; - - $s = preg_match_all('/{"question_content":"(.*?)","type":(.*?)}]}/', $data, $d); - if ($s == 0) return; - - $json_file = "data/tzgsc.json"; - - $existing = []; - if (file_exists($json_file)) { - $content = file_get_contents($json_file); - $existing = json_decode($content, true); - if (!is_array($existing)) { - $existing = []; - } - } - - $existing_questions = []; - foreach ($existing as $item) { - if (isset($item['question_content'])) { - $existing_questions[$item['question_content']] = true; - } - } - - for ($i = 0; $i < $s; $i++) { - $d1 = $d[1][$i]; - $d2 = $d[2][$i]; - - if (!isset($existing_questions[$d1])) { - $new_item = [ - 'question_content' => $d1, - 'type' => json_decode('{' . $d2, true) - ]; - if ($new_item['type']) { - $existing[] = $new_item; - $existing_questions[$d1] = true; - } - } - } - - file_put_contents($json_file, json_encode($existing, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); -} - -function get_curl($url, $post = 0, $referer = 1, $cookie = 0, $header = 0, $ua = 0, $nobaody = 0) { - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - $httpheader[] = "Accept:application/json"; - $httpheader[] = "Accept-Encoding:gzip,deflate,sdch"; - $httpheader[] = "Accept-Language:zh-CN,zh;q=0.8"; - $httpheader[] = "Connection:close"; - curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); - if ($post) { - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post); - } - if ($header) { - curl_setopt($ch, CURLOPT_HEADER, TRUE); - } - if ($cookie) { - curl_setopt($ch, CURLOPT_DICTAPP_MID, $cookie); - } - if ($referer) { - if ($referer == 1) { - curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f='); - } else { - curl_setopt($ch, CURLOPT_REFERER, $referer); - } - } - if ($ua) { - curl_setopt($ch, CURLOPT_USERAGENT, $ua); - } else { - curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; U; Android 4.4.1; zh-cn) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/5.5 Mobile Safari/533.1'); - } - if ($nobaody) { - curl_setopt($ch, CURLOPT_NOBODY, 1); - } - curl_setopt($ch, CURLOPT_ENCODING, "gzip"); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $ret = curl_exec($ch); - curl_close($ch); - return $ret; -} -?> diff --git a/ht/p1/data/tzgsc.json b/ht/p1/data/tzgsc.json deleted file mode 100644 index e772c95..0000000 --- a/ht/p1/data/tzgsc.json +++ /dev/null @@ -1,5456 +0,0 @@ -[ - { - "question_content": "撩乱边愁听不尽,“________”", - "type": { - "person": "王昌龄", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "孤城遥望玉门关", - "is_standard_answer": 0 - }, - { - "answer_content": "高高秋月照长城", - "is_standard_answer": 1 - }, - { - "answer_content": "总是关山旧别情", - "is_standard_answer": 0 - }, - { - "answer_content": "山北山南总是烽", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "大雨落幽燕,白浪滔天,“________”", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "初中", - "dynasty": "近现代" - }, - "option_answers": [ - { - "answer_content": "一片汪洋都不见", - "is_standard_answer": 0 - }, - { - "answer_content": "秦皇岛外打鱼船", - "is_standard_answer": 1 - }, - { - "answer_content": "无限江山", - "is_standard_answer": 0 - }, - { - "answer_content": "知向谁边", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“__”一片月,万户捣衣声", - "type": { - "person": "李白", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "天上", - "is_standard_answer": 0 - }, - { - "answer_content": "杭州", - "is_standard_answer": 0 - }, - { - "answer_content": "长安", - "is_standard_answer": 1 - }, - { - "answer_content": "人间", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "小楼昨夜又东风,“_________”", - "type": { - "person": "李煜 ", - "type": "婉约", - "grade": "高中", - "dynasty": "五代" - }, - "option_answers": [ - { - "answer_content": "恰似一春江水项东流", - "is_standard_answer": 0 - }, - { - "answer_content": "恰似故人远来载乡愁", - "is_standard_answer": 0 - }, - { - "answer_content": "故国不堪回首月明中", - "is_standard_answer": 1 - }, - { - "answer_content": "珠帘泛婆娑湿衣袖", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "诗人看到了什么写出了“忽如一夜春风来,千树万树梨花开”?", - "type": { - "person": "岑参 ", - "type": "友情", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "霜", - "is_standard_answer": 0 - }, - { - "answer_content": "梨花", - "is_standard_answer": 0 - }, - { - "answer_content": "雨", - "is_standard_answer": 0 - }, - { - "answer_content": "雪", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "李清照在《如梦令·常记溪亭日暮》中将小船误入了哪里?", - "type": { - "person": "李清照", - "type": "婉约", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "荷花池", - "is_standard_answer": 1 - }, - { - "answer_content": "芦苇荡", - "is_standard_answer": 0 - }, - { - "answer_content": "水榭中", - "is_standard_answer": 0 - }, - { - "answer_content": "假山旁", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "李白与哪两位好友喝酒,写下了名作《将进酒》?", - "type": { - "person": "李白", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "岑勋、元稹", - "is_standard_answer": 0 - }, - { - "answer_content": "元丹丘、王维", - "is_standard_answer": 0 - }, - { - "answer_content": "岑勋、白居易", - "is_standard_answer": 0 - }, - { - "answer_content": "岑勋、元丹丘", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“执子之手,与子偕老”出自《诗经》,它最初指代的是什么感情?", - "type": { - "person": "李白", - "type": "豪放", - "grade": "高中", - "dynasty": "先秦" - }, - "option_answers": [ - { - "answer_content": "战友情", - "is_standard_answer": 1 - }, - { - "answer_content": "知己情", - "is_standard_answer": 0 - }, - { - "answer_content": "父母情", - "is_standard_answer": 0 - }, - { - "answer_content": "夫妻情", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“借问汉宫谁得似,可怜飞燕倚新妆”,这个和赵飞燕相似的女子是谁?", - "type": { - "person": "李白", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "班婕妤", - "is_standard_answer": 0 - }, - { - "answer_content": "貂蝉", - "is_standard_answer": 0 - }, - { - "answer_content": "王昭君", - "is_standard_answer": 0 - }, - { - "answer_content": "杨玉环", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“相貌丑陋却才华横溢,拒绝徒弟追求,被称作花间词派鼻祖”的是谁?", - "type": { - "person": "温庭筠", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "温庭筠", - "is_standard_answer": 1 - }, - { - "answer_content": "李贺", - "is_standard_answer": 0 - }, - { - "answer_content": "李煜", - "is_standard_answer": 0 - }, - { - "answer_content": "元稹", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "春宵一刻值千金,“________”", - "type": { - "person": "苏轼", - "type": "春天", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "从此君王不早朝", - "is_standard_answer": 0 - }, - { - "answer_content": "待晓堂前拜舅姑", - "is_standard_answer": 0 - }, - { - "answer_content": "花有清香月有阴", - "is_standard_answer": 1 - }, - { - "answer_content": "赌书消得泼茶香", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "汉乐府《江南》中鱼戏莲叶东下一句", - "type": { - "person": "苏轼", - "type": "江南", - "grade": "小学", - "dynasty": "汉朝" - }, - "option_answers": [ - { - "answer_content": "鱼戏莲叶南", - "is_standard_answer": 0 - }, - { - "answer_content": "鱼戏莲叶中", - "is_standard_answer": 0 - }, - { - "answer_content": "鱼戏莲叶北", - "is_standard_answer": 0 - }, - { - "answer_content": "鱼戏莲叶西", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "几处早莺争暖树,“________”", - "type": { - "person": "白居易", - "type": "江南", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "草色遥看近却无", - "is_standard_answer": 0 - }, - { - "answer_content": "绿杨阴里白沙堤", - "is_standard_answer": 0 - }, - { - "answer_content": "谁家新燕啄春泥", - "is_standard_answer": 1 - }, - { - "answer_content": "浅草才能没马蹄", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "春眠不觉晓,“________”", - "type": { - "person": "孟浩然", - "type": "春天", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "花落知多少", - "is_standard_answer": 0 - }, - { - "answer_content": "处处蚊子咬", - "is_standard_answer": 0 - }, - { - "answer_content": "处处闻啼鸟", - "is_standard_answer": 1 - }, - { - "answer_content": "润物细无声", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "范仲淹在《江上渔者》中写到最爱什么鱼?", - "type": { - "person": "范仲淹", - "type": "田园", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "鳜鱼", - "is_standard_answer": 0 - }, - { - "answer_content": "鲤鱼", - "is_standard_answer": 0 - }, - { - "answer_content": "鲈鱼", - "is_standard_answer": 1 - }, - { - "answer_content": "草鱼", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "天下才有一石,谁占了八斗?", - "type": { - "person": "谢灵运", - "type": "豪放", - "grade": "课外", - "dynasty": "晋朝" - }, - "option_answers": [ - { - "answer_content": "曹丕", - "is_standard_answer": 0 - }, - { - "answer_content": "李白", - "is_standard_answer": 0 - }, - { - "answer_content": "谢灵运", - "is_standard_answer": 0 - }, - { - "answer_content": "曹植", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "王维的“独在异乡为异客,每逢佳节倍思亲”,佳节指的是什么节日?", - "type": { - "person": "王维", - "type": "思乡", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "重阳节", - "is_standard_answer": 1 - }, - { - "answer_content": "中秋节", - "is_standard_answer": 0 - }, - { - "answer_content": "元宵节", - "is_standard_answer": 0 - }, - { - "answer_content": "端午节", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“但使龙城飞将在,不教胡马度阴山”中飞将指的是谁?", - "type": { - "person": "王昌龄", - "type": "豪放", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "周亚夫", - "is_standard_answer": 0 - }, - { - "answer_content": "李广", - "is_standard_answer": 1 - }, - { - "answer_content": "卫青", - "is_standard_answer": 0 - }, - { - "answer_content": "霍去病", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“群山万壑赴荆门,生长明妃尚有村”,明妃指的是?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "文成公主", - "is_standard_answer": 0 - }, - { - "answer_content": "王昭君", - "is_standard_answer": 1 - }, - { - "answer_content": "杨玉环", - "is_standard_answer": 0 - }, - { - "answer_content": "赵飞燕", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "明月出天山,“________”", - "type": { - "person": "李白", - "type": "自然", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "时鸣春涧中", - "is_standard_answer": 0 - }, - { - "answer_content": "呼作白玉盘", - "is_standard_answer": 0 - }, - { - "answer_content": "苍茫云海间", - "is_standard_answer": 1 - }, - { - "answer_content": "清泉石上流", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "漠漠水田飞白鹭,“________”", - "type": { - "person": "王维", - "type": "田园", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "两个黄鹂鸣翠柳", - "is_standard_answer": 0 - }, - { - "answer_content": "桃花流水鳜鱼肥", - "is_standard_answer": 0 - }, - { - "answer_content": "阴阴夏木啭黄鹂", - "is_standard_answer": 1 - }, - { - "answer_content": "两山排闼送青来", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "山一程,水一程,“________”", - "type": { - "person": "纳兰性德", - "type": "婉约", - "grade": "课外", - "dynasty": "清朝" - }, - "option_answers": [ - { - "answer_content": "身向榆关那畔行", - "is_standard_answer": 1 - }, - { - "answer_content": "聒碎乡心梦不成", - "is_standard_answer": 0 - }, - { - "answer_content": "山远天高烟水寒", - "is_standard_answer": 0 - }, - { - "answer_content": "自是人生长恨水长东", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "问君能有几多愁?“_________”", - "type": { - "person": "李煜 ", - "type": "婉约", - "grade": "高中", - "dynasty": "五代" - }, - "option_answers": [ - { - "answer_content": "恰似一江春水向东流", - "is_standard_answer": 1 - }, - { - "answer_content": "也拟泛轻舟", - "is_standard_answer": 0 - }, - { - "answer_content": "物是人非事事休", - "is_standard_answer": 0 - }, - { - "answer_content": "欲语泪先流", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“不以物喜,不以己悲”出自范仲淹的什么作品?", - "type": { - "person": "范仲淹", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "游钓台记", - "is_standard_answer": 0 - }, - { - "answer_content": "岳阳楼记", - "is_standard_answer": 1 - }, - { - "answer_content": "小石潭记", - "is_standard_answer": 0 - }, - { - "answer_content": "醉翁亭记", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "比喻高尚情操的“香草美人”出自哪里?", - "type": { - "person": "屈原", - "type": "豪放", - "grade": "高中", - "dynasty": "先秦" - }, - "option_answers": [ - { - "answer_content": "离骚", - "is_standard_answer": 1 - }, - { - "answer_content": "诗经", - "is_standard_answer": 0 - }, - { - "answer_content": "木兰辞", - "is_standard_answer": 0 - }, - { - "answer_content": "孔雀东南飞", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "骆宾王的《咏鹅》中,鹅掌是什么颜色的?", - "type": { - "person": "骆宾王", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "绿", - "is_standard_answer": 0 - }, - { - "answer_content": "红", - "is_standard_answer": 1 - }, - { - "answer_content": "灰", - "is_standard_answer": 0 - }, - { - "answer_content": "白", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“二十四桥明月夜,玉人何处教吹箫”是描写的哪个城市?", - "type": { - "person": "杜牧", - "type": "江南", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "扬州", - "is_standard_answer": 1 - }, - { - "answer_content": "苏州", - "is_standard_answer": 0 - }, - { - "answer_content": "杭州", - "is_standard_answer": 0 - }, - { - "answer_content": "南京", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“今日听君歌一曲,暂凭杯酒长精神”,这个君是谁?", - "type": { - "person": "刘禹锡", - "type": "友情", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "李白", - "is_standard_answer": 0 - }, - { - "answer_content": "白居易", - "is_standard_answer": 1 - }, - { - "answer_content": "王维", - "is_standard_answer": 0 - }, - { - "answer_content": "刘禹锡", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "对名妓薛涛始乱终弃,写出“曾经沧海难为水,除却巫山不是云”的诗人是谁?", - "type": { - "person": "元稹", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "李商隐", - "is_standard_answer": 0 - }, - { - "answer_content": "元稹", - "is_standard_answer": 1 - }, - { - "answer_content": "李贺", - "is_standard_answer": 0 - }, - { - "answer_content": "刘禹锡", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "离离原上草,“________”", - "type": { - "person": "白居易", - "type": "春天", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "春风吹又生", - "is_standard_answer": 0 - }, - { - "answer_content": "晴翠接荒城", - "is_standard_answer": 0 - }, - { - "answer_content": "一岁一枯荣", - "is_standard_answer": 1 - }, - { - "answer_content": "萋萋满别情", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "九曲黄河万里沙,“________”", - "type": { - "person": "刘禹锡", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "咆哮万里触龙门", - "is_standard_answer": 0 - }, - { - "answer_content": "浪淘风簸自天涯", - "is_standard_answer": 1 - }, - { - "answer_content": "五千仞岳上摩天", - "is_standard_answer": 0 - }, - { - "answer_content": "万里写入胸怀间", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”西北望,射天狼", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "十年生死两茫茫", - "is_standard_answer": 0 - }, - { - "answer_content": "会挽雕弓如满月", - "is_standard_answer": 1 - }, - { - "answer_content": "老夫聊发少年狂", - "is_standard_answer": 0 - }, - { - "answer_content": "为报倾城随太守", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "张继那首有名的《枫桥夜泊》中,听到寒山寺的钟声,寒山寺在哪个城市?", - "type": { - "person": "张继", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "扬州", - "is_standard_answer": 0 - }, - { - "answer_content": "杭州", - "is_standard_answer": 0 - }, - { - "answer_content": "苏州", - "is_standard_answer": 1 - }, - { - "answer_content": "临安", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "白居易说“江南好,风景旧曾谙”,你知道白居易最忆的是江南哪里么?", - "type": { - "person": "白居易", - "type": "江南", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "扬州", - "is_standard_answer": 0 - }, - { - "answer_content": "杭州", - "is_standard_answer": 1 - }, - { - "answer_content": "吴宫", - "is_standard_answer": 0 - }, - { - "answer_content": "姑苏", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“白日放歌须纵酒,青春作伴好还乡”,诗人是去哪里呢?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "金陵", - "is_standard_answer": 0 - }, - { - "answer_content": "长安", - "is_standard_answer": 0 - }, - { - "answer_content": "襄阳", - "is_standard_answer": 0 - }, - { - "answer_content": "洛阳", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“朱雀桥边野草花,乌衣巷口夕阳斜”,乌衣巷在哪个城市?", - "type": { - "person": "刘禹锡", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "杭州", - "is_standard_answer": 0 - }, - { - "answer_content": "南京", - "is_standard_answer": 1 - }, - { - "answer_content": "西安", - "is_standard_answer": 0 - }, - { - "answer_content": "苏州", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“看朱成碧思纷纷,憔悴支离为忆君”,这个君指的是谁?", - "type": { - "person": "武则天", - "type": "思乡", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "李世民", - "is_standard_answer": 0 - }, - { - "answer_content": "刘彻", - "is_standard_answer": 0 - }, - { - "answer_content": "李治", - "is_standard_answer": 1 - }, - { - "answer_content": "李隆基", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,从此萧郎是路人", - "type": { - "person": "崔郊", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "一入侯门深似海", - "is_standard_answer": 0 - }, - { - "answer_content": "侯门一入深如海", - "is_standard_answer": 1 - }, - { - "answer_content": "侯门一入深似海", - "is_standard_answer": 0 - }, - { - "answer_content": "一入侯门深如海", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“__”回首,那人却在,灯火阑珊处。", - "type": { - "person": "辛弃疾 ", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "蓦然", - "is_standard_answer": 1 - }, - { - "answer_content": "幕然", - "is_standard_answer": 0 - }, - { - "answer_content": "默然", - "is_standard_answer": 0 - }, - { - "answer_content": "墓然", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“松下问童子,言师采药去”,请问是谁在问童子?", - "type": { - "person": "贾岛", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "贺知章", - "is_standard_answer": 0 - }, - { - "answer_content": "贾岛", - "is_standard_answer": 1 - }, - { - "answer_content": "李贺", - "is_standard_answer": 0 - }, - { - "answer_content": "松下", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“易求无价宝,难得有情郎”是谁写的?", - "type": { - "person": "李白", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "武则天", - "is_standard_answer": 0 - }, - { - "answer_content": "温庭筠", - "is_standard_answer": 0 - }, - { - "answer_content": "薛涛", - "is_standard_answer": 0 - }, - { - "answer_content": "鱼玄机", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“知章骑马似乘船,眼花落井水底眠”说的是谁?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "杜甫", - "is_standard_answer": 0 - }, - { - "answer_content": "贺知章", - "is_standard_answer": 1 - }, - { - "answer_content": "李白", - "is_standard_answer": 0 - }, - { - "answer_content": "王维", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“葡萄美酒夜光杯,欲饮琵琶马上催”是哪位诗人写的?", - "type": { - "person": "王翰", - "type": "豪放", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "李白", - "is_standard_answer": 0 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - }, - { - "answer_content": "李贺", - "is_standard_answer": 0 - }, - { - "answer_content": "王翰", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“西出阳关无故人”,阳关在哪个省?", - "type": { - "person": "王维", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "甘肃", - "is_standard_answer": 1 - }, - { - "answer_content": "西藏", - "is_standard_answer": 0 - }, - { - "answer_content": "新疆", - "is_standard_answer": 0 - }, - { - "answer_content": "内蒙", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "王安石在春节时写的“爆竹声中一岁除,春风送暖入屠苏”中屠苏指的是什么?", - "type": { - "person": "王安石", - "type": "思乡", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "茶", - "is_standard_answer": 0 - }, - { - "answer_content": "院子", - "is_standard_answer": 0 - }, - { - "answer_content": "祥瑞", - "is_standard_answer": 0 - }, - { - "answer_content": "酒", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "人间“__”芳菲尽,山寺桃花始盛开", - "type": { - "person": "白居易", - "type": "春天", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "六月", - "is_standard_answer": 0 - }, - { - "answer_content": "四月", - "is_standard_answer": 1 - }, - { - "answer_content": "三月", - "is_standard_answer": 0 - }, - { - "answer_content": "二月", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "多情自古伤离别,“_________”", - "type": { - "person": "柳永", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "应是良辰好景虚设", - "is_standard_answer": 0 - }, - { - "answer_content": "此恨不关风与月", - "is_standard_answer": 0 - }, - { - "answer_content": "此去经年", - "is_standard_answer": 0 - }, - { - "answer_content": "更那堪,冷落清秋节", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“晴空一鹤排云上,便引诗情到碧霄”描写的是什么季节?", - "type": { - "person": "刘禹锡", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "夏", - "is_standard_answer": 0 - }, - { - "answer_content": "秋", - "is_standard_answer": 1 - }, - { - "answer_content": "春", - "is_standard_answer": 0 - }, - { - "answer_content": "冬", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "辛弃疾的《清平乐·村居》中,小儿在做什么?", - "type": { - "person": "辛弃疾", - "type": "田园", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "剥莲蓬", - "is_standard_answer": 1 - }, - { - "answer_content": "除豆", - "is_standard_answer": 0 - }, - { - "answer_content": "钓鱼", - "is_standard_answer": 0 - }, - { - "answer_content": "织鸡笼", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“两个黄鹂鸣翠柳,一行白鹭上青天”是哪位诗人写的?", - "type": { - "person": "杜甫", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "杜甫", - "is_standard_answer": 1 - }, - { - "answer_content": "孟浩然", - "is_standard_answer": 0 - }, - { - "answer_content": "王维", - "is_standard_answer": 0 - }, - { - "answer_content": "杜牧", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《甄嬛传》里安陵容唱的“小山重叠金明灭”中小山指的是什么?", - "type": { - "person": "温庭筠", - "type": "婉约", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "画", - "is_standard_answer": 0 - }, - { - "answer_content": "眉妆", - "is_standard_answer": 1 - }, - { - "answer_content": "衣服", - "is_standard_answer": 0 - }, - { - "answer_content": "小小的山", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "此曲只应天上有,人间“__”几回闻", - "type": { - "person": "杜甫", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "只得", - "is_standard_answer": 0 - }, - { - "answer_content": "哪得", - "is_standard_answer": 0 - }, - { - "answer_content": "能得", - "is_standard_answer": 1 - }, - { - "answer_content": "值得", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "飞流直下三千尺,“____”银河落九天", - "type": { - "person": "李白", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "疑似", - "is_standard_answer": 0 - }, - { - "answer_content": "恰是", - "is_standard_answer": 0 - }, - { - "answer_content": "疑是", - "is_standard_answer": 1 - }, - { - "answer_content": "恰似", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "行到水穷处,“________”", - "type": { - "person": "王维", - "type": "田园", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "王孙自可留", - "is_standard_answer": 0 - }, - { - "answer_content": "坐看云起时", - "is_standard_answer": 1 - }, - { - "answer_content": "独坐敬亭山", - "is_standard_answer": 0 - }, - { - "answer_content": "谈笑无还期", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“遥想公瑾当年,小乔初嫁了”,这个幸福的公瑾是谁?", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "孙权", - "is_standard_answer": 0 - }, - { - "answer_content": "刘备", - "is_standard_answer": 0 - }, - { - "answer_content": "曹操", - "is_standard_answer": 0 - }, - { - "answer_content": "周瑜", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "孟浩然的《望洞庭赠张丞相》,张丞相是谁?", - "type": { - "person": "孟浩然", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "张行成", - "is_standard_answer": 0 - }, - { - "answer_content": "张籍", - "is_standard_answer": 0 - }, - { - "answer_content": "张苍", - "is_standard_answer": 0 - }, - { - "answer_content": "张九龄", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“春风得意马蹄疾,一日看尽长安花”是诗人考中了什么功名后写的?", - "type": { - "person": "孟郊", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "状元", - "is_standard_answer": 0 - }, - { - "answer_content": "进士", - "is_standard_answer": 1 - }, - { - "answer_content": "榜眼", - "is_standard_answer": 0 - }, - { - "answer_content": "探花", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“云想衣裳花想容,春风拂槛露华浓”中李白用什么花来描写杨贵妃之美?", - "type": { - "person": "李白", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "芍药", - "is_standard_answer": 0 - }, - { - "answer_content": "牡丹", - "is_standard_answer": 1 - }, - { - "answer_content": "荷花", - "is_standard_answer": 0 - }, - { - "answer_content": "海棠", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "小山重叠金明灭,“_________”", - "type": { - "person": "温庭筠", - "type": "婉约", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "鬓云欲度香腮雪", - "is_standard_answer": 1 - }, - { - "answer_content": "绿杨陌上多离别", - "is_standard_answer": 0 - }, - { - "answer_content": "十二楼中月自明", - "is_standard_answer": 0 - }, - { - "answer_content": "碧天如水夜云轻", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "不知细叶谁裁出,“________”", - "type": { - "person": "贺知章", - "type": "春天", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "二月春风似剪刀", - "is_standard_answer": 1 - }, - { - "answer_content": "二月春风吹杨柳", - "is_standard_answer": 0 - }, - { - "answer_content": "二月初惊见草芽", - "is_standard_answer": 0 - }, - { - "answer_content": "霜叶红于二月花", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "旧时王谢堂前燕,“_________”", - "type": { - "person": "刘禹锡", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "更深月色半人家", - "is_standard_answer": 0 - }, - { - "answer_content": "飞来飞去落谁家", - "is_standard_answer": 0 - }, - { - "answer_content": "飞入寻常百姓家", - "is_standard_answer": 1 - }, - { - "answer_content": "蓬门今始为君开", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,时鸣春涧中", - "type": { - "person": "王维", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "空山新雨后", - "is_standard_answer": 0 - }, - { - "answer_content": "月出惊山鸟", - "is_standard_answer": 1 - }, - { - "answer_content": "明月松间照", - "is_standard_answer": 0 - }, - { - "answer_content": "夜静春山空", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“惜秦皇汉武,略输文采;唐宗宋祖,稍逊风骚”,秦皇汉武分别指的是谁?", - "type": { - "person": "毛泽东", - "type": "豪放", - "grade": "初中", - "dynasty": "近代" - }, - "option_answers": [ - { - "answer_content": "嬴政、刘彻", - "is_standard_answer": 1 - }, - { - "answer_content": "胡亥、刘备", - "is_standard_answer": 0 - }, - { - "answer_content": "嬴政、刘邦", - "is_standard_answer": 0 - }, - { - "answer_content": "扶苏、刘秀", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "与“身无彩凤双飞翼,心有灵犀一点通”出自同一首诗的是?", - "type": { - "person": "李商隐", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "青鸟殷勤为探看", - "is_standard_answer": 0 - }, - { - "answer_content": "相见时难别亦难", - "is_standard_answer": 0 - }, - { - "answer_content": "昨夜星辰昨夜风", - "is_standard_answer": 1 - }, - { - "answer_content": "碧海青天夜夜心", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“此地别燕丹,壮士发冲冠”描写的是哪个历史事件?", - "type": { - "person": "骆宾王", - "type": "豪放", - "grade": "课外 ", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "赤壁之战", - "is_standard_answer": 0 - }, - { - "answer_content": "屈原沉江", - "is_standard_answer": 0 - }, - { - "answer_content": "荆轲刺秦", - "is_standard_answer": 1 - }, - { - "answer_content": "巨鹿之战", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "与“天涯何处无芳草”出自同一首诗的是?", - "type": { - "person": "苏轼", - "type": "婉约", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "墙里秋千墙外道", - "is_standard_answer": 1 - }, - { - "answer_content": "伫倚危楼风细细", - "is_standard_answer": 0 - }, - { - "answer_content": "山长水阔知何处", - "is_standard_answer": 0 - }, - { - "answer_content": "衣带渐宽终不悔", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“故人西辞黄鹤楼,烟花三月下扬州”,请问下列哪个代称不是扬州?", - "type": { - "person": "李白", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "江都", - "is_standard_answer": 0 - }, - { - "answer_content": "广陵", - "is_standard_answer": 0 - }, - { - "answer_content": "临安", - "is_standard_answer": 1 - }, - { - "answer_content": "维扬", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,崔九堂前几度闻", - "type": { - "person": "杜甫", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "岐王宅里寻常见", - "is_standard_answer": 1 - }, - { - "answer_content": "乌衣巷口夕阳斜", - "is_standard_answer": 0 - }, - { - "answer_content": "此曲只应天上有", - "is_standard_answer": 0 - }, - { - "answer_content": "正是江南好风景", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "关关雎鸠,在河之洲。窈窕淑女,君子“__”。", - "type": { - "person": "李白", - "type": "婉约", - "grade": "初中", - "dynasty": "先秦" - }, - "option_answers": [ - { - "answer_content": "好仇", - "is_standard_answer": 0 - }, - { - "answer_content": "好求", - "is_standard_answer": 0 - }, - { - "answer_content": "好浗", - "is_standard_answer": 0 - }, - { - "answer_content": "好逑", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "与《孔雀东南飞》并称“乐府双璧”的是?", - "type": { - "person": "李白", - "type": "豪放", - "grade": "初中", - "dynasty": "南北朝" - }, - "option_answers": [ - { - "answer_content": "长歌行", - "is_standard_answer": 0 - }, - { - "answer_content": "离骚", - "is_standard_answer": 0 - }, - { - "answer_content": "木兰辞", - "is_standard_answer": 1 - }, - { - "answer_content": "蒹葭", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“座中泣下谁最多,江州司马青衫湿”,江州司马是谁?", - "type": { - "person": "白居易", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "白居易", - "is_standard_answer": 1 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - }, - { - "answer_content": "王维", - "is_standard_answer": 0 - }, - { - "answer_content": "元稹", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "写下“两情若是久长时,又岂在朝朝暮暮”,被称作“山抹微云君”的诗人是?", - "type": { - "person": "秦观 ", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "黄庭坚", - "is_standard_answer": 0 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - }, - { - "answer_content": "秦观", - "is_standard_answer": 1 - }, - { - "answer_content": "柳永", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "白居易的《长恨歌》最后一句?", - "type": { - "person": "白居易", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "在地愿为连理枝", - "is_standard_answer": 0 - }, - { - "answer_content": "一别音容两渺茫", - "is_standard_answer": 0 - }, - { - "answer_content": "此恨绵绵无绝期", - "is_standard_answer": 1 - }, - { - "answer_content": "夜半无人私语时", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“人生自古谁无死,留取丹心照汗青”,汗青指什么?", - "type": { - "person": "文天祥", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "皇帝", - "is_standard_answer": 0 - }, - { - "answer_content": "史册", - "is_standard_answer": 1 - }, - { - "answer_content": "大地", - "is_standard_answer": 0 - }, - { - "answer_content": "青草", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,多少楼台烟雨中", - "type": { - "person": "杜牧", - "type": "江南", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "南朝三百八十寺", - "is_standard_answer": 0 - }, - { - "answer_content": "南朝四百四十寺", - "is_standard_answer": 0 - }, - { - "answer_content": "南朝四百八十寺", - "is_standard_answer": 1 - }, - { - "answer_content": "南朝八百八十寺", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "曲径通幽处,“_________”", - "type": { - "person": "常建 ", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "禅房花木深", - "is_standard_answer": 1 - }, - { - "answer_content": "恨别鸟惊心", - "is_standard_answer": 0 - }, - { - "answer_content": "红衣浅复深", - "is_standard_answer": 0 - }, - { - "answer_content": "城春草木深", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“夕阳无限好,只是近黄昏”是谁写的?", - "type": { - "person": "李商隐", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "李商隐", - "is_standard_answer": 1 - }, - { - "answer_content": "白居易", - "is_standard_answer": 0 - }, - { - "answer_content": "杜甫", - "is_standard_answer": 0 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“凤兮凤兮归故乡,遨游四海求其凰”是谁写的?", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "课外", - "dynasty": "汉朝" - }, - "option_answers": [ - { - "answer_content": "诸葛亮", - "is_standard_answer": 0 - }, - { - "answer_content": "刘备", - "is_standard_answer": 0 - }, - { - "answer_content": "司马相如", - "is_standard_answer": 1 - }, - { - "answer_content": "李白", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“凤箫声动,玉壶光转,一夜鱼龙舞”描写的是什么节日?", - "type": { - "person": "辛弃疾 ", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "中秋", - "is_standard_answer": 0 - }, - { - "answer_content": "七夕", - "is_standard_answer": 0 - }, - { - "answer_content": "除夕", - "is_standard_answer": 0 - }, - { - "answer_content": "元夕", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“马作的卢飞快”中的卢是有名的快马,请问三国时“的卢救主”的故事里救的是谁?", - "type": { - "person": "辛弃疾", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "刘备", - "is_standard_answer": 1 - }, - { - "answer_content": "曹操", - "is_standard_answer": 0 - }, - { - "answer_content": "孙权", - "is_standard_answer": 0 - }, - { - "answer_content": "赵云", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“一声何满子,双泪落君前”中何满子指的是什么?", - "type": { - "person": "张祜", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "词牌名", - "is_standard_answer": 0 - }, - { - "answer_content": "曹操", - "is_standard_answer": 0 - }, - { - "answer_content": "曲名", - "is_standard_answer": 1 - }, - { - "answer_content": "刘备", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“秦楼月,年年柳色,霸陵伤别”中霸陵是是的陵墓?", - "type": { - "person": "李白", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "汉武帝", - "is_standard_answer": 0 - }, - { - "answer_content": "汉文帝", - "is_standard_answer": 1 - }, - { - "answer_content": "唐太宗", - "is_standard_answer": 0 - }, - { - "answer_content": "唐玄宗", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "鸟宿池边树,僧“__”月下门", - "type": { - "person": "贾岛", - "type": "自然", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "翻", - "is_standard_answer": 0 - }, - { - "answer_content": "推", - "is_standard_answer": 0 - }, - { - "answer_content": "敲", - "is_standard_answer": 1 - }, - { - "answer_content": "关", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“冲天香阵透长安,满城尽带黄金甲”描写的是什么花?", - "type": { - "person": "黄巢", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "桂花", - "is_standard_answer": 0 - }, - { - "answer_content": "菊花", - "is_standard_answer": 1 - }, - { - "answer_content": "芙蓉", - "is_standard_answer": 0 - }, - { - "answer_content": "牡丹", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《望岳》中“岱宗夫如何?”描写的是哪座名山?", - "type": { - "person": "杜甫", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "黄山", - "is_standard_answer": 0 - }, - { - "answer_content": "泰山", - "is_standard_answer": 1 - }, - { - "answer_content": "嵩山", - "is_standard_answer": 0 - }, - { - "answer_content": "华山", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“白日依山尽,黄河入海流”是哪位诗人写的?", - "type": { - "person": "王之涣", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "孟浩然", - "is_standard_answer": 0 - }, - { - "answer_content": "李白", - "is_standard_answer": 0 - }, - { - "answer_content": "王之涣", - "is_standard_answer": 1 - }, - { - "answer_content": "王翰", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“商女不知亡国恨,隔江犹唱后庭花”,《后庭花》是谁写的?", - "type": { - "person": "杜牧 ", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "李隆基", - "is_standard_answer": 0 - }, - { - "answer_content": "杨玉环", - "is_standard_answer": 0 - }, - { - "answer_content": "陈叔宝", - "is_standard_answer": 1 - }, - { - "answer_content": "李煜", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "人生若只如初见,“________”", - "type": { - "person": "纳兰性德", - "type": "婉约", - "grade": "课外", - "dynasty": "清朝" - }, - "option_answers": [ - { - "answer_content": "何如薄幸锦衣郎", - "is_standard_answer": 0 - }, - { - "answer_content": "何事秋风悲画扇", - "is_standard_answer": 1 - }, - { - "answer_content": "比翼连枝当日愿", - "is_standard_answer": 0 - }, - { - "answer_content": "只道当时是寻常", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“无为在岐路,儿女共沾巾”哪个字是错误的?", - "type": { - "person": "王勃", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "沾->粘", - "is_standard_answer": 0 - }, - { - "answer_content": "在->再", - "is_standard_answer": 0 - }, - { - "answer_content": "岐->歧", - "is_standard_answer": 1 - }, - { - "answer_content": "巾->襟", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“天阶夜色凉如水,坐看牵牛织女星”描写的是哪个季节?", - "type": { - "person": "杜牧", - "type": "自然", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "秋", - "is_standard_answer": 1 - }, - { - "answer_content": "冬", - "is_standard_answer": 0 - }, - { - "answer_content": "春", - "is_standard_answer": 0 - }, - { - "answer_content": "夏", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“安得广厦千万间,大庇天下寒士俱欢颜!”是诗人在哪个季节写的?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "春", - "is_standard_answer": 0 - }, - { - "answer_content": "夏", - "is_standard_answer": 0 - }, - { - "answer_content": "秋", - "is_standard_answer": 1 - }, - { - "answer_content": "冬", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "杜甫的“正是江南好风景,落花时节又逢君”中,这个君的职业是什么?", - "type": { - "person": "杜甫", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "农夫", - "is_standard_answer": 0 - }, - { - "answer_content": "秀才", - "is_standard_answer": 0 - }, - { - "answer_content": "乐师", - "is_standard_answer": 1 - }, - { - "answer_content": "官员", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“暖风熏得游人醉,直把杭州作汴州”,杭州和汴州分别又叫做什么?", - "type": { - "person": "林升", - "type": "江南", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "姑苏、洛阳", - "is_standard_answer": 0 - }, - { - "answer_content": "临安、开封", - "is_standard_answer": 1 - }, - { - "answer_content": "临安、洛阳", - "is_standard_answer": 0 - }, - { - "answer_content": "姑苏、开封", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“飞流直下三千尺,疑是银河落九天”描写的是什么景色?", - "type": { - "person": "李白", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "长江", - "is_standard_answer": 0 - }, - { - "answer_content": "黄河", - "is_standard_answer": 0 - }, - { - "answer_content": "瀑布", - "is_standard_answer": 1 - }, - { - "answer_content": "银河", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“鹅鹅鹅,曲项向天歌”是诗人几岁时写的?", - "type": { - "person": "骆宾王", - "type": "田园", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "7", - "is_standard_answer": 1 - }, - { - "answer_content": "3", - "is_standard_answer": 0 - }, - { - "answer_content": "16", - "is_standard_answer": 0 - }, - { - "answer_content": "5", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“丞相祠堂何处寻,锦官城外柏森森”,锦官城指的是哪里?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "成都", - "is_standard_answer": 1 - }, - { - "answer_content": "汉中", - "is_standard_answer": 0 - }, - { - "answer_content": "长安", - "is_standard_answer": 0 - }, - { - "answer_content": "金陵", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "白头宫女在,闲坐说“__”,", - "type": { - "person": "元稹", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "玄宗", - "is_standard_answer": 1 - }, - { - "answer_content": "高宗", - "is_standard_answer": 0 - }, - { - "answer_content": "太宗", - "is_standard_answer": 0 - }, - { - "answer_content": "太祖", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,山雨欲来风满楼", - "type": { - "person": "许浑", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "行人莫问当年事", - "is_standard_answer": 0 - }, - { - "answer_content": "山外青山楼外楼", - "is_standard_answer": 0 - }, - { - "answer_content": "黑云压城城欲摧", - "is_standard_answer": 0 - }, - { - "answer_content": "溪云初起日沉阁", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "《琵琶行》中,琵琶女告诉白居易她是京城女,请问她住在哪里?", - "type": { - "person": "白居易", - "type": "友情", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "回龙观", - "is_standard_answer": 0 - }, - { - "answer_content": "蘑菇屯", - "is_standard_answer": 0 - }, - { - "answer_content": "蛤蟆陵", - "is_standard_answer": 1 - }, - { - "answer_content": "门头沟", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "宁为百夫长,“________”", - "type": { - "person": "杨炯", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "心中自不平", - "is_standard_answer": 0 - }, - { - "answer_content": "单于夜遁逃", - "is_standard_answer": 0 - }, - { - "answer_content": "胜作一书生", - "is_standard_answer": 1 - }, - { - "answer_content": "将军夜引弓", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "\"________\",西出阳关无故人", - "type": { - "person": "王维", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "劝君更尽一杯酒", - "is_standard_answer": 1 - }, - { - "answer_content": "莫愁前路无知己", - "is_standard_answer": 0 - }, - { - "answer_content": "渭城朝雨浥轻尘", - "is_standard_answer": 0 - }, - { - "answer_content": "劝君更饮一杯酒", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,春风不度玉门关", - "type": { - "person": "王之涣", - "type": "豪放", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "二十四桥明月夜", - "is_standard_answer": 0 - }, - { - "answer_content": "羌笛何须怨杨柳", - "is_standard_answer": 1 - }, - { - "answer_content": "黄河远上白云间", - "is_standard_answer": 0 - }, - { - "answer_content": "黄沙百战穿金甲", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "白日登山望烽火,“________”", - "type": { - "person": "李颀", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "黄昏饮马傍交河", - "is_standard_answer": 1 - }, - { - "answer_content": "黄昏独上海风秋", - "is_standard_answer": 0 - }, - { - "answer_content": "不破楼兰终不还", - "is_standard_answer": 0 - }, - { - "answer_content": "孤城遥望玉门关", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“横看成岭侧成峰,远近高低各不同”描写的是哪座山?", - "type": { - "person": "苏轼", - "type": "自然", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "泰山", - "is_standard_answer": 0 - }, - { - "answer_content": "黄山", - "is_standard_answer": 0 - }, - { - "answer_content": "庐山", - "is_standard_answer": 1 - }, - { - "answer_content": "华山", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "沉舟侧畔千帆过,“________”", - "type": { - "person": "刘禹锡", - "type": "友情", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "到乡翻似烂柯人", - "is_standard_answer": 0 - }, - { - "answer_content": "病树前头万木春", - "is_standard_answer": 1 - }, - { - "answer_content": "潦倒新停浊酒怀", - "is_standard_answer": 0 - }, - { - "answer_content": "西出阳关无故人", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "此情可待成追忆?“________”", - "type": { - "person": "李商隐", - "type": "婉约", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "拔剑四顾心茫然", - "is_standard_answer": 0 - }, - { - "answer_content": "只是当时已惘然", - "is_standard_answer": 1 - }, - { - "answer_content": "到处相逢是偶然", - "is_standard_answer": 0 - }, - { - "answer_content": "只有相思无尽处", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "天街小雨润如酥,“________”", - "type": { - "person": "韩愈", - "type": "春天", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "牧童遥指杏花村", - "is_standard_answer": 0 - }, - { - "answer_content": "绝胜烟柳满皇都", - "is_standard_answer": 0 - }, - { - "answer_content": "柳色如今深未深", - "is_standard_answer": 0 - }, - { - "answer_content": "草色遥看近却无", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "花径不曾缘客扫,“________”", - "type": { - "person": "杜甫", - "type": "友情", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "两山排闼送青来", - "is_standard_answer": 0 - }, - { - "answer_content": "蓬门今始为君开", - "is_standard_answer": 1 - }, - { - "answer_content": "但见群鸥日日来", - "is_standard_answer": 0 - }, - { - "answer_content": "樽酒家贫只旧醅", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "因写了句“红杏枝头春意闹”而被称为“红杏尚书”的宋代诗人是谁?", - "type": { - "person": "宋祁", - "type": "婉约", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "苏轼", - "is_standard_answer": 0 - }, - { - "answer_content": "宋祁", - "is_standard_answer": 1 - }, - { - "answer_content": "秦观", - "is_standard_answer": 0 - }, - { - "answer_content": "王安石", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《蜀道难》的最后一句?", - "type": { - "person": "李白", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "侧身西望常咨嗟", - "is_standard_answer": 1 - }, - { - "answer_content": "难于上青天", - "is_standard_answer": 0 - }, - { - "answer_content": "不如早还家", - "is_standard_answer": 0 - }, - { - "answer_content": "嗟尔远道之人胡为乎来哉", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "传说因为公主和李白成为情敌而不相往来,被称作诗佛的人是谁?", - "type": { - "person": "王维", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "王维", - "is_standard_answer": 1 - }, - { - "answer_content": "白居易", - "is_standard_answer": 0 - }, - { - "answer_content": "孟浩然", - "is_standard_answer": 0 - }, - { - "answer_content": "李贺", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“碧玉妆成一树高,万条缍下绿丝绦”,哪个字是错的", - "type": { - "person": "贺知章", - "type": "春天", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "缍->垂", - "is_standard_answer": 1 - }, - { - "answer_content": "妆->庄", - "is_standard_answer": 0 - }, - { - "answer_content": "高->蒿", - "is_standard_answer": 0 - }, - { - "answer_content": "绦->綯", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "黄河远上白云间,“________”", - "type": { - "person": "王之涣", - "type": "豪放", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "将登太行雪满山", - "is_standard_answer": 0 - }, - { - "answer_content": "春风不度玉门关", - "is_standard_answer": 0 - }, - { - "answer_content": "千里江陵一日还", - "is_standard_answer": 0 - }, - { - "answer_content": "一片孤城万仞山", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "黄四娘家花满“__”,千朵万朵压枝低", - "type": { - "person": "杜甫", - "type": "田园", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "稀", - "is_standard_answer": 0 - }, - { - "answer_content": "溪", - "is_standard_answer": 0 - }, - { - "answer_content": "蹊", - "is_standard_answer": 1 - }, - { - "answer_content": "栖", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“千古江山,英雄无觅孙仲谋处”,孙仲谋是谁?", - "type": { - "person": "辛弃疾", - "type": "豪放", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "孙匡", - "is_standard_answer": 0 - }, - { - "answer_content": "孙策", - "is_standard_answer": 0 - }, - { - "answer_content": "孙权", - "is_standard_answer": 1 - }, - { - "answer_content": "孙坚", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "随意春“___”歇,王孙自可留", - "type": { - "person": "王维", - "type": "自然", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "风", - "is_standard_answer": 0 - }, - { - "answer_content": "水", - "is_standard_answer": 0 - }, - { - "answer_content": "花", - "is_standard_answer": 0 - }, - { - "answer_content": "芳", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“只恐夜深花睡去,故烧高烛照红妆”,诗人是担心哪个花睡了?", - "type": { - "person": "苏轼", - "type": "自然", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "芍药", - "is_standard_answer": 0 - }, - { - "answer_content": "牡丹", - "is_standard_answer": 0 - }, - { - "answer_content": "海棠", - "is_standard_answer": 1 - }, - { - "answer_content": "荷花", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“_________”,月有阴晴圆缺", - "type": { - "person": "苏轼", - "type": "思乡", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "人有悲欢离合", - "is_standard_answer": 1 - }, - { - "answer_content": "此事古难全", - "is_standard_answer": 0 - }, - { - "answer_content": "但愿人长久", - "is_standard_answer": 0 - }, - { - "answer_content": "今夕是何年", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“师者,所以传道受业解惑也”出自?", - "type": { - "person": "韩愈", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "师说", - "is_standard_answer": 1 - }, - { - "answer_content": "论语", - "is_standard_answer": 0 - }, - { - "answer_content": "中庸", - "is_standard_answer": 0 - }, - { - "answer_content": "大学", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“千门万户曈曈日,总把新桃换旧符”描写的是哪个节日?", - "type": { - "person": "王安石", - "type": "思乡", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "春节", - "is_standard_answer": 1 - }, - { - "answer_content": "元宵节", - "is_standard_answer": 0 - }, - { - "answer_content": "中秋节", - "is_standard_answer": 0 - }, - { - "answer_content": "清明节", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "绿树村边合,“________”", - "type": { - "person": "孟浩然", - "type": "田园", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "青山郭外斜", - "is_standard_answer": 1 - }, - { - "answer_content": "还来就菊花", - "is_standard_answer": 0 - }, - { - "answer_content": "结庐在人境", - "is_standard_answer": 0 - }, - { - "answer_content": "把酒话桑麻", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,清泉石上流", - "type": { - "person": "王维", - "type": "自然", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "空山新雨后", - "is_standard_answer": 0 - }, - { - "answer_content": "明月几时有", - "is_standard_answer": 0 - }, - { - "answer_content": "明月出天山", - "is_standard_answer": 0 - }, - { - "answer_content": "明月松间照", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“________”,万水千山只等闲", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "小学", - "dynasty": "近现代" - }, - "option_answers": [ - { - "answer_content": "恰同学少年", - "is_standard_answer": 0 - }, - { - "answer_content": "红军不胃远征难", - "is_standard_answer": 0 - }, - { - "answer_content": "红军不怕远征难", - "is_standard_answer": 1 - }, - { - "answer_content": "江山如此多娇", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "以下哪位歌手唱过苏轼的《水调歌头·明月几时有》?", - "type": { - "person": "苏轼", - "type": "思乡", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "刘欢", - "is_standard_answer": 0 - }, - { - "answer_content": "霍尊", - "is_standard_answer": 0 - }, - { - "answer_content": "那英", - "is_standard_answer": 0 - }, - { - "answer_content": "王菲", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "王维观猎时写到“忽过新丰市,还归细柳营”,细柳营是谁屯兵的地方?", - "type": { - "person": "王维", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "周亚夫", - "is_standard_answer": 1 - }, - { - "answer_content": "李广", - "is_standard_answer": 0 - }, - { - "answer_content": "卫青", - "is_standard_answer": 0 - }, - { - "answer_content": "霍去病", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "当年万里觅封侯,匹马戍“___”", - "type": { - "person": "陆游", - "type": "豪放", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "凉州", - "is_standard_answer": 0 - }, - { - "answer_content": "蓟州", - "is_standard_answer": 0 - }, - { - "answer_content": "幽州", - "is_standard_answer": 0 - }, - { - "answer_content": "梁州", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "三杯两盏淡酒,“________”", - "type": { - "person": "李清照", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "雁过也", - "is_standard_answer": 0 - }, - { - "answer_content": "怎敌他晚来风急", - "is_standard_answer": 1 - }, - { - "answer_content": "怎一个愁字了得", - "is_standard_answer": 0 - }, - { - "answer_content": "如今有谁堪摘", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "陆游的《剑门道中遇微雨》中,诗人是怎么过的剑门?", - "type": { - "person": "陆游", - "type": "豪放", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "马车", - "is_standard_answer": 0 - }, - { - "answer_content": "步行", - "is_standard_answer": 0 - }, - { - "answer_content": "骑驴", - "is_standard_answer": 1 - }, - { - "answer_content": "骑马", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“今人不见古时月,今月曾经照古人”是谁写的?", - "type": { - "person": "李白", - "type": "自然", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "孟浩然", - "is_standard_answer": 0 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - }, - { - "answer_content": "王勃", - "is_standard_answer": 0 - }, - { - "answer_content": "李白", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“八百里分麾下炙,五十弦翻塞外声”,八百里指的是什么动物?", - "type": { - "person": "辛弃疾", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "驴", - "is_standard_answer": 0 - }, - { - "answer_content": "羊", - "is_standard_answer": 0 - }, - { - "answer_content": "马", - "is_standard_answer": 0 - }, - { - "answer_content": "牛", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "停车坐爱枫林晚,霜叶红于二月花中“坐”是什么意思", - "type": { - "person": "杜牧", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "躺着", - "is_standard_answer": 0 - }, - { - "answer_content": "连坐", - "is_standard_answer": 0 - }, - { - "answer_content": "坐下", - "is_standard_answer": 0 - }, - { - "answer_content": "因为", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "欲把西湖比西子,“________”", - "type": { - "person": "苏轼", - "type": "江南", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "淡妆浓抹总相宜", - "is_standard_answer": 1 - }, - { - "answer_content": "拄杖无时夜叩门", - "is_standard_answer": 0 - }, - { - "answer_content": "山色空蒙雨亦奇", - "is_standard_answer": 0 - }, - { - "answer_content": "门前流水尚能西", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "去年今日此门中,“________”", - "type": { - "person": "崔护", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "人面不知何处去", - "is_standard_answer": 0 - }, - { - "answer_content": "桃花依旧笑春风", - "is_standard_answer": 0 - }, - { - "answer_content": "人面桃花相映红", - "is_standard_answer": 1 - }, - { - "answer_content": "微雨燕双飞", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《石壕吏》中,诗人看到“有吏夜捉人”,谁翻墙走了?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "小儿", - "is_standard_answer": 0 - }, - { - "answer_content": "老妇", - "is_standard_answer": 0 - }, - { - "answer_content": "老翁", - "is_standard_answer": 1 - }, - { - "answer_content": "大儿", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“曲有误,周郎顾”,周郎是谁?", - "type": { - "person": "李白", - "type": "婉约", - "grade": "课外", - "dynasty": "三国" - }, - "option_answers": [ - { - "answer_content": "周瑜", - "is_standard_answer": 1 - }, - { - "answer_content": "文王", - "is_standard_answer": 0 - }, - { - "answer_content": "周公", - "is_standard_answer": 0 - }, - { - "answer_content": "庄周", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,月是故乡明", - "type": { - "person": "杜甫", - "type": "思乡", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "小时不识月", - "is_standard_answer": 0 - }, - { - "answer_content": "露从今夜白", - "is_standard_answer": 1 - }, - { - "answer_content": "人是故乡亲", - "is_standard_answer": 0 - }, - { - "answer_content": "对此空长吟", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“问世间,情为何物,直教生死相许”是谁写的?", - "type": { - "person": "元好问", - "type": "婉约", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "元好问", - "is_standard_answer": 1 - }, - { - "answer_content": "李莫愁", - "is_standard_answer": 0 - }, - { - "answer_content": "金庸", - "is_standard_answer": 0 - }, - { - "answer_content": "古龙", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“东风不与周郎便,铜雀春深锁二乔”中东风指的哪个历史典故?", - "type": { - "person": "杜牧", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "苦肉计", - "is_standard_answer": 0 - }, - { - "answer_content": "草船借箭", - "is_standard_answer": 0 - }, - { - "answer_content": "蒋干盗书", - "is_standard_answer": 0 - }, - { - "answer_content": "火烧赤壁", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "黄沙百战穿金甲,不破“___”终不还", - "type": { - "person": "王昌龄", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "龙城", - "is_standard_answer": 0 - }, - { - "answer_content": "楼兰", - "is_standard_answer": 1 - }, - { - "answer_content": "匈奴", - "is_standard_answer": 0 - }, - { - "answer_content": "单于", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“静女其姝,俟我于城隅。爱而不见,搔首踟蹰”中的“爱”是什么意思?", - "type": { - "person": "李白", - "type": "婉约", - "grade": "高中", - "dynasty": "先秦" - }, - "option_answers": [ - { - "answer_content": "隐藏", - "is_standard_answer": 1 - }, - { - "answer_content": "乐于", - "is_standard_answer": 0 - }, - { - "answer_content": "喜欢", - "is_standard_answer": 0 - }, - { - "answer_content": "因为", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "桃花潭水深千尺,“________”", - "type": { - "person": "李白", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "千里江陵一日还", - "is_standard_answer": 0 - }, - { - "answer_content": "春江水暖鸭先知", - "is_standard_answer": 0 - }, - { - "answer_content": "烟花三月下扬州", - "is_standard_answer": 0 - }, - { - "answer_content": "不及汪伦送我情", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "木欣欣以向荣,“_________”", - "type": { - "person": "陶渊明", - "type": "田园", - "grade": "高中", - "dynasty": "魏晋" - }, - "option_answers": [ - { - "answer_content": "泉涓涓而始流", - "is_standard_answer": 1 - }, - { - "answer_content": "海滔滔以不竭", - "is_standard_answer": 0 - }, - { - "answer_content": "人代代以不息", - "is_standard_answer": 0 - }, - { - "answer_content": "草生生以不息", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "苏轼在《江城子密州出猎》中,左手右手控制的分别是什么动物?", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "马、羊", - "is_standard_answer": 0 - }, - { - "answer_content": "狼、鹰", - "is_standard_answer": 0 - }, - { - "answer_content": "狗、鹰", - "is_standard_answer": 1 - }, - { - "answer_content": "马、鹰", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“孤舟蓑笠翁,独钓寒江雪”是哪位诗人写的?", - "type": { - "person": "柳宗元", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "苏轼", - "is_standard_answer": 0 - }, - { - "answer_content": "柳宗元", - "is_standard_answer": 1 - }, - { - "answer_content": "王安石", - "is_standard_answer": 0 - }, - { - "answer_content": "韩愈", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "苏轼的《惠崇江晚景》描写的是一副鸭戏图,你知道这首诗被题在什么地方么?", - "type": { - "person": "苏轼", - "type": "春天", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "画上", - "is_standard_answer": 1 - }, - { - "answer_content": "手帕上", - "is_standard_answer": 0 - }, - { - "answer_content": "扇子上", - "is_standard_answer": 0 - }, - { - "answer_content": "墙上", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“大明湖畔趵突泉边故居在垂杨深处,漱玉集中金石录里文采有后主遗风”指的谁?", - "type": { - "person": "李清照", - "type": "婉约", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "夏雨荷", - "is_standard_answer": 0 - }, - { - "answer_content": "柳如是", - "is_standard_answer": 0 - }, - { - "answer_content": "李清照", - "is_standard_answer": 1 - }, - { - "answer_content": "苏小小", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "移舟泊烟渚,“________”", - "type": { - "person": "孟浩然", - "type": "思乡", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "长河落日圆", - "is_standard_answer": 0 - }, - { - "answer_content": "天气晚来秋", - "is_standard_answer": 0 - }, - { - "answer_content": "日暮客愁新", - "is_standard_answer": 1 - }, - { - "answer_content": "江清月近人", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "一水护田将绿绕,“__”排闼送青来", - "type": { - "person": "王安石", - "type": "田园", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "一山", - "is_standard_answer": 0 - }, - { - "answer_content": "两岸", - "is_standard_answer": 0 - }, - { - "answer_content": "两山", - "is_standard_answer": 1 - }, - { - "answer_content": "千山", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“滚滚长江东逝水,浪花淘尽英雄”最初出自哪里?", - "type": { - "person": "杨慎", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "三国演义", - "is_standard_answer": 0 - }, - { - "answer_content": "水浒传", - "is_standard_answer": 0 - }, - { - "answer_content": "临江仙·滚滚长江东逝水", - "is_standard_answer": 1 - }, - { - "answer_content": "红楼梦", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,恨不相逢未嫁时", - "type": { - "person": "张籍", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "我生君未生", - "is_standard_answer": 0 - }, - { - "answer_content": "人间有味是清欢", - "is_standard_answer": 0 - }, - { - "answer_content": "还君明珠双泪垂", - "is_standard_answer": 1 - }, - { - "answer_content": "公子王孙逐后尘", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "象征陆游和唐婉爱情的那首《钗头凤·红酥手》最初被诗人题在了哪里?", - "type": { - "person": "陆游", - "type": "婉约", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "手帕上", - "is_standard_answer": 0 - }, - { - "answer_content": "画上", - "is_standard_answer": 0 - }, - { - "answer_content": "扇子上", - "is_standard_answer": 0 - }, - { - "answer_content": "墙上", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“清风徐来,水波不兴”描写的是什么地方的景色?", - "type": { - "person": "苏轼", - "type": "自然", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "西湖", - "is_standard_answer": 0 - }, - { - "answer_content": "秦淮河", - "is_standard_answer": 0 - }, - { - "answer_content": "醉翁亭", - "is_standard_answer": 0 - }, - { - "answer_content": "赤壁", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "山重水复疑无路,“________”", - "type": { - "person": "陆游", - "type": "田园", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "千里江陵一日还", - "is_standard_answer": 0 - }, - { - "answer_content": "病树前头万木春", - "is_standard_answer": 0 - }, - { - "answer_content": "拄杖无时夜叩门", - "is_standard_answer": 0 - }, - { - "answer_content": "柳暗花明又一村", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“________”,万里长征人未还", - "type": { - "person": "王昌龄", - "type": "豪放", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "一将功成万骨枯", - "is_standard_answer": 0 - }, - { - "answer_content": "醉卧沙场君莫笑", - "is_standard_answer": 0 - }, - { - "answer_content": "秦时明月汉时关", - "is_standard_answer": 1 - }, - { - "answer_content": "千载琵琶作胡语", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "以下诗句出自《声声慢·寻寻觅觅》的是?", - "type": { - "person": "李清照", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "一种相思,两处闲愁", - "is_standard_answer": 0 - }, - { - "answer_content": "至今思项羽,不肯过江东", - "is_standard_answer": 0 - }, - { - "answer_content": "这次第,怎一个愁字了得", - "is_standard_answer": 1 - }, - { - "answer_content": "争渡,争渡,惊起一滩鸥鹭", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“莫笑农家腊酒浑,丰年留客足鸡豚”中豚指的是什么?", - "type": { - "person": "陆游", - "type": "自然", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "河豚", - "is_standard_answer": 0 - }, - { - "answer_content": "海豚", - "is_standard_answer": 0 - }, - { - "answer_content": "鸡肉", - "is_standard_answer": 0 - }, - { - "answer_content": "猪肉", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "黑云压城城欲“__”,甲光向日金鳞开", - "type": { - "person": "李贺", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "摧 ", - "is_standard_answer": 1 - }, - { - "answer_content": "催 ", - "is_standard_answer": 0 - }, - { - "answer_content": "崔", - "is_standard_answer": 0 - }, - { - "answer_content": "推", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“谁家玉笛暗飞声,散入春风满洛城”,洛城指的是哪里?", - "type": { - "person": "李白", - "type": "春天", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "洛阳", - "is_standard_answer": 1 - }, - { - "answer_content": "金陵", - "is_standard_answer": 0 - }, - { - "answer_content": "长安", - "is_standard_answer": 0 - }, - { - "answer_content": "开封", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "洞房昨夜停红烛,“________”", - "type": { - "person": "朱庆馀", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "春宵一刻值千金", - "is_standard_answer": 0 - }, - { - "answer_content": "先遣小姑尝", - "is_standard_answer": 0 - }, - { - "answer_content": "待晓堂前拜舅姑", - "is_standard_answer": 1 - }, - { - "answer_content": "妆罢低声问夫婿", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“昔年有狂客,号尔谪仙人”是在说谁?", - "type": { - "person": "杜甫", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "李白", - "is_standard_answer": 1 - }, - { - "answer_content": "白居易", - "is_standard_answer": 0 - }, - { - "answer_content": "杜甫", - "is_standard_answer": 0 - }, - { - "answer_content": "孟浩然", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“莫道不消魂,帘卷西风,人比黄花瘦”作于什么节日?", - "type": { - "person": "李清照", - "type": "婉约", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "重阳节", - "is_standard_answer": 1 - }, - { - "answer_content": "中秋节", - "is_standard_answer": 0 - }, - { - "answer_content": "元宵节", - "is_standard_answer": 0 - }, - { - "answer_content": "清明节", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "海内存知己,“________”", - "type": { - "person": "王勃", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "天涯共此时", - "is_standard_answer": 0 - }, - { - "answer_content": "竟夕起相思", - "is_standard_answer": 0 - }, - { - "answer_content": "儿女共沾巾", - "is_standard_answer": 0 - }, - { - "answer_content": "天涯若比邻", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "旦辞爷娘去,暮宿黄河边,不闻爷娘唤女声,“________”", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "初中", - "dynasty": "南北朝" - }, - "option_answers": [ - { - "answer_content": "木兰不用尚书郎", - "is_standard_answer": 0 - }, - { - "answer_content": "但闻黄河流水鸣溅溅", - "is_standard_answer": 1 - }, - { - "answer_content": "但闻燕山胡骑鸣啾啾", - "is_standard_answer": 0 - }, - { - "answer_content": "唯闻女叹息", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "人生得意须尽欢,“__________”", - "type": { - "person": "李白", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "抽刀断水水更流", - "is_standard_answer": 0 - }, - { - "answer_content": "拔剑四顾心茫然", - "is_standard_answer": 0 - }, - { - "answer_content": "会须一饮三百杯", - "is_standard_answer": 0 - }, - { - "answer_content": "莫使金樽空对月", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“________”,千里江陵一日还", - "type": { - "person": "李白", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "孤帆远影碧空尽", - "is_standard_answer": 0 - }, - { - "answer_content": "朝辞白帝彩云间", - "is_standard_answer": 1 - }, - { - "answer_content": "两岸猿声啼不住", - "is_standard_answer": 0 - }, - { - "answer_content": "黄河远上白云间", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“两岸青山相对出,孤帆一片日边来”是诗人李白在什么地方看见的景色", - "type": { - "person": "李白", - "type": "江南", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "庐山", - "is_standard_answer": 0 - }, - { - "answer_content": "天门山", - "is_standard_answer": 1 - }, - { - "answer_content": "白帝城", - "is_standard_answer": 0 - }, - { - "answer_content": "泰山", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "不识庐山真面目,“________”", - "type": { - "person": "苏轼", - "type": "自然", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "只因身在最高层", - "is_standard_answer": 0 - }, - { - "answer_content": "只缘身在此山中", - "is_standard_answer": 1 - }, - { - "answer_content": "只因身在此山中", - "is_standard_answer": 0 - }, - { - "answer_content": "只缘身在最高层", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "山不在高,有“___”则名", - "type": { - "person": "刘禹锡 ", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "龙", - "is_standard_answer": 0 - }, - { - "answer_content": "汝", - "is_standard_answer": 0 - }, - { - "answer_content": "灵", - "is_standard_answer": 0 - }, - { - "answer_content": "仙", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "岭南非常有名的荔枝“妃子笑”,这个名称和谁有关?", - "type": { - "person": "杜牧", - "type": "婉约", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "杨玉环", - "is_standard_answer": 1 - }, - { - "answer_content": "西施", - "is_standard_answer": 0 - }, - { - "answer_content": "赵飞燕", - "is_standard_answer": 0 - }, - { - "answer_content": "王昭君", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“绿蚁新醅酒,红泥小火炉”最适合什么天气?", - "type": { - "person": "白居易", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "晴天", - "is_standard_answer": 0 - }, - { - "answer_content": "下雪", - "is_standard_answer": 1 - }, - { - "answer_content": "打雷", - "is_standard_answer": 0 - }, - { - "answer_content": "下雨", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“谁念北楼上,临风怀谢公”,谢公是谁?", - "type": { - "person": "李白", - "type": "友情", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "谢灵运", - "is_standard_answer": 0 - }, - { - "answer_content": "谢玄", - "is_standard_answer": 0 - }, - { - "answer_content": "谢安", - "is_standard_answer": 0 - }, - { - "answer_content": "谢脁", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“_________”,长使英雄泪满襟。", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "出师未捷身先死", - "is_standard_answer": 1 - }, - { - "answer_content": "风萧萧兮易水寒", - "is_standard_answer": 0 - }, - { - "answer_content": "一将功成万骨枯", - "is_standard_answer": 0 - }, - { - "answer_content": "提携玉龙为君死", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“谁言寸草心,报得三春辉”,哪个字是错误的", - "type": { - "person": "孟郊", - "type": "思乡", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "报->抱", - "is_standard_answer": 0 - }, - { - "answer_content": "辉->晖", - "is_standard_answer": 1 - }, - { - "answer_content": "得->的", - "is_standard_answer": 0 - }, - { - "answer_content": "谁->莫", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《兰亭集序》的作者是?", - "type": { - "person": "王羲之", - "type": "友情", - "grade": "高中", - "dynasty": "魏晋" - }, - "option_answers": [ - { - "answer_content": "陈寿", - "is_standard_answer": 0 - }, - { - "answer_content": "陶渊明", - "is_standard_answer": 0 - }, - { - "answer_content": "王羲之", - "is_standard_answer": 1 - }, - { - "answer_content": "刘桢", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“吾爱孟夫子,风流天下闻”中,孟夫子是谁?", - "type": { - "person": "李白", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "孟浩然", - "is_standard_answer": 1 - }, - { - "answer_content": "孟郊", - "is_standard_answer": 0 - }, - { - "answer_content": "孟子", - "is_standard_answer": 0 - }, - { - "answer_content": "老子", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "哪句诗与《滕王阁序》出自同一位诗人?", - "type": { - "person": "王勃", - "type": "友情", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "离离原上草,一岁一枯荣", - "is_standard_answer": 0 - }, - { - "answer_content": "海内存知己,天涯若比邻", - "is_standard_answer": 1 - }, - { - "answer_content": "愿君多采撷,此物最相思", - "is_standard_answer": 0 - }, - { - "answer_content": "春眠不觉晓,处处闻啼鸟", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“斜阳草树,寻常巷陌,人道寄奴曾住”,寄奴和元嘉是什么关系?", - "type": { - "person": "辛弃疾", - "type": "豪放", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "祖孙", - "is_standard_answer": 0 - }, - { - "answer_content": "兄弟", - "is_standard_answer": 0 - }, - { - "answer_content": "父子", - "is_standard_answer": 1 - }, - { - "answer_content": "友人", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "天生丽质难自弃,“________”", - "type": { - "person": "白居易", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "六宫粉黛无颜色", - "is_standard_answer": 0 - }, - { - "answer_content": "始是新承恩泽时", - "is_standard_answer": 0 - }, - { - "answer_content": "一朝选在君王侧", - "is_standard_answer": 1 - }, - { - "answer_content": "养在深闺人未识", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "春风又绿江南岸,“________”", - "type": { - "person": "白居易", - "type": "江南", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "春来江水绿如蓝", - "is_standard_answer": 0 - }, - { - "answer_content": "钟山只隔数重山", - "is_standard_answer": 0 - }, - { - "answer_content": "明月何时照我还", - "is_standard_answer": 1 - }, - { - "answer_content": "风景旧曾谙", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "下面哪句和“欲把西湖比西子”出自同一首诗", - "type": { - "person": "苏轼", - "type": "江南", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "映日荷花别样红", - "is_standard_answer": 0 - }, - { - "answer_content": "水光潋滟晴方好", - "is_standard_answer": 1 - }, - { - "answer_content": "山外青山楼外楼", - "is_standard_answer": 0 - }, - { - "answer_content": "风光不与四时同", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“青青子衿,悠悠我心”最初出自哪里?", - "type": { - "person": "曹操", - "type": "豪放", - "grade": "高中", - "dynasty": "魏晋" - }, - "option_answers": [ - { - "answer_content": "诗经", - "is_standard_answer": 1 - }, - { - "answer_content": "短歌行", - "is_standard_answer": 0 - }, - { - "answer_content": "孔雀东南飞", - "is_standard_answer": 0 - }, - { - "answer_content": "刘邦", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“梅妻鹤子”指的是谁?", - "type": { - "person": "林逋", - "type": "田园", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "王维", - "is_standard_answer": 0 - }, - { - "answer_content": "李煜", - "is_standard_answer": 0 - }, - { - "answer_content": "林逋", - "is_standard_answer": 1 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "渡远荆门外,“________”", - "type": { - "person": "李白", - "type": "友情", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "月涌大江流", - "is_standard_answer": 0 - }, - { - "answer_content": "江清月近人", - "is_standard_answer": 0 - }, - { - "answer_content": "山色有无中", - "is_standard_answer": 0 - }, - { - "answer_content": "来从楚国游", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“孤篇压全唐”是对哪首诗的评价?", - "type": { - "person": "张若虚", - "type": "春天", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "春江花月夜", - "is_standard_answer": 1 - }, - { - "answer_content": "将进酒", - "is_standard_answer": 0 - }, - { - "answer_content": "长恨歌", - "is_standard_answer": 0 - }, - { - "answer_content": "枫桥夜泊", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "曹操的《短歌行》中写到“周公吐哺天下归心”,周公是谁?", - "type": { - "person": "曹操", - "type": "豪放", - "grade": "高中", - "dynasty": "魏晋" - }, - "option_answers": [ - { - "answer_content": "周公旦", - "is_standard_answer": 1 - }, - { - "answer_content": "刘备", - "is_standard_answer": 0 - }, - { - "answer_content": "刘邦", - "is_standard_answer": 0 - }, - { - "answer_content": "曹操", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“千里莺啼绿映红,水村山郭酒旗风”出自杜牧的哪首诗?", - "type": { - "person": "杜牧", - "type": "江南", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "秋夕", - "is_standard_answer": 0 - }, - { - "answer_content": "江南春", - "is_standard_answer": 1 - }, - { - "answer_content": "清明", - "is_standard_answer": 0 - }, - { - "answer_content": "遣怀", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“洛阳亲友若相问,一片冰心在玉壶”,哪个字是错的", - "type": { - "person": "王昌龄", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "在->再", - "is_standard_answer": 0 - }, - { - "answer_content": "若->如", - "is_standard_answer": 1 - }, - { - "answer_content": "洛->安", - "is_standard_answer": 0 - }, - { - "answer_content": "片->篇", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“一年好景君须记”,的下一句中提到了几种颜色?", - "type": { - "person": "苏轼", - "type": "友情", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "2", - "is_standard_answer": 1 - }, - { - "answer_content": "7", - "is_standard_answer": 0 - }, - { - "answer_content": "5", - "is_standard_answer": 0 - }, - { - "answer_content": "4", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“洞房昨夜停红烛”这句诗是写给谁的?", - "type": { - "person": "朱庆馀", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "丈夫", - "is_standard_answer": 0 - }, - { - "answer_content": "妻子", - "is_standard_answer": 0 - }, - { - "answer_content": "考官", - "is_standard_answer": 0 - }, - { - "answer_content": "张籍", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "两岸猿声啼不住,“__”已过万重山", - "type": { - "person": "李白", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "小舟", - "is_standard_answer": 0 - }, - { - "answer_content": "轻舟", - "is_standard_answer": 1 - }, - { - "answer_content": "扁舟", - "is_standard_answer": 0 - }, - { - "answer_content": "青舟", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "山外青山楼外楼,“________”", - "type": { - "person": "林升", - "type": "江南", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "西湖歌舞几时休", - "is_standard_answer": 1 - }, - { - "answer_content": "毕竟西湖六月中", - "is_standard_answer": 0 - }, - { - "answer_content": "直把杭州作汴州", - "is_standard_answer": 0 - }, - { - "answer_content": "风光不与四时同", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "从《送孟浩然之广陵》中,你知道扬州在黄鹤楼哪个方位吗?", - "type": { - "person": "李白", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "南", - "is_standard_answer": 0 - }, - { - "answer_content": "北", - "is_standard_answer": 0 - }, - { - "answer_content": "西", - "is_standard_answer": 0 - }, - { - "answer_content": "东", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "竹外桃花三两枝,春江水暖“__”先知", - "type": { - "person": "苏轼", - "type": "春天", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "羊", - "is_standard_answer": 0 - }, - { - "answer_content": "鸡", - "is_standard_answer": 0 - }, - { - "answer_content": "鸟", - "is_standard_answer": 0 - }, - { - "answer_content": "鸭", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "李白到了黄鹤楼却说出“眼前有景道不得”,以下哪句诗是他看到的?", - "type": { - "person": "崔颢", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "一拳捶碎黄鹤楼", - "is_standard_answer": 0 - }, - { - "answer_content": "眼前有景道不得", - "is_standard_answer": 0 - }, - { - "answer_content": "故人西辞黄鹤楼", - "is_standard_answer": 0 - }, - { - "answer_content": "晴川历历汉阳树", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "红酥手,黄藤酒,“______”", - "type": { - "person": "陆游", - "type": "婉约", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "错错错", - "is_standard_answer": 0 - }, - { - "answer_content": "莫莫莫", - "is_standard_answer": 0 - }, - { - "answer_content": "泪痕红浥鲛绡透", - "is_standard_answer": 0 - }, - { - "answer_content": "满城春色宫墙柳", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“绿杨阴里白沙堤”、“苏堤春晓”都是西湖美景,白堤、苏堤哪个修建的更早?", - "type": { - "person": "白居易", - "type": "江南", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "同时", - "is_standard_answer": 0 - }, - { - "answer_content": "白堤", - "is_standard_answer": 1 - }, - { - "answer_content": "无记载", - "is_standard_answer": 0 - }, - { - "answer_content": "苏堤", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“李白乘舟将欲行,忽闻岸上踏歌声”,唱歌的人当时的职业是什么?", - "type": { - "person": "李白", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "幕僚", - "is_standard_answer": 0 - }, - { - "answer_content": "卸任在家", - "is_standard_answer": 1 - }, - { - "answer_content": "县令", - "is_standard_answer": 0 - }, - { - "answer_content": "琴师", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《扬州慢》中“纵豆蔻词工,青楼梦好,难赋深情”,与哪位诗人有关?", - "type": { - "person": "姜夔 ", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "柳永", - "is_standard_answer": 0 - }, - { - "answer_content": "李煜", - "is_standard_answer": 0 - }, - { - "answer_content": "李清照", - "is_standard_answer": 0 - }, - { - "answer_content": "杜牧", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "醉卧沙场君莫笑,“________”", - "type": { - "person": "王翰", - "type": "豪放", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "万里长征人未还", - "is_standard_answer": 0 - }, - { - "answer_content": "欲饮琵琶马上催", - "is_standard_answer": 0 - }, - { - "answer_content": "古来征战几人回", - "is_standard_answer": 1 - }, - { - "answer_content": "梦回吹角连营", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《赋得古原草送别》全诗一共几句?", - "type": { - "person": "白居易", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "6", - "is_standard_answer": 0 - }, - { - "answer_content": "8", - "is_standard_answer": 1 - }, - { - "answer_content": "4", - "is_standard_answer": 0 - }, - { - "answer_content": "12", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“但愿人长久,千里共婵娟。”是诗人写给什么人的?", - "type": { - "person": "苏轼", - "type": "思乡", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "妻子", - "is_standard_answer": 0 - }, - { - "answer_content": "父母", - "is_standard_answer": 0 - }, - { - "answer_content": "朋友", - "is_standard_answer": 0 - }, - { - "answer_content": "兄弟", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“功盖三分国,名成八阵图”说的是谁?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "曹操", - "is_standard_answer": 0 - }, - { - "answer_content": "诸葛亮", - "is_standard_answer": 1 - }, - { - "answer_content": "周瑜", - "is_standard_answer": 0 - }, - { - "answer_content": "孙权", - "is_standard_answer": 0 - } - ] - } -] \ No newline at end of file diff --git a/ht/p1/index.php b/ht/p1/index.php deleted file mode 100644 index 6faf0e9..0000000 --- a/ht/p1/index.php +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - 古诗文答题 - - - -
-
-

📜 古诗文答题

-
- ✓ 答对: 0 - 📝 总题: 0 -
-
- - - -
-
加载中
-
- - - - -
- -
- - - - - - diff --git a/ht/p1/style.css b/ht/p1/style.css deleted file mode 100644 index 0f6c828..0000000 --- a/ht/p1/style.css +++ /dev/null @@ -1,469 +0,0 @@ -:root { - --bg-primary: #f5f0e6; - --bg-card: #fffef9; - --text-primary: #5d4e37; - --text-secondary: #8b7355; - --accent: #c94c4c; - --border: #d4c5a9; - --success: #4a7c59; - --error: #c94c4c; - --shadow: rgba(93, 78, 55, 0.1); -} - -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; - background-color: var(--bg-primary); - color: var(--text-primary); - min-height: 100vh; - padding: 20px; - background-image: - radial-gradient(circle at 20% 80%, rgba(201, 76, 76, 0.05) 0%, transparent 50%), - radial-gradient(circle at 80% 20%, rgba(74, 124, 89, 0.05) 0%, transparent 50%); -} - -.container { - max-width: 600px; - margin: 0 auto; -} - -.header { - text-align: center; - padding: 20px 0; - margin-bottom: 20px; -} - -.header h1 { - font-family: 'KaiTi', 'STKaiti', '楷体', serif; - font-size: 28px; - font-weight: normal; - color: var(--text-primary); - margin-bottom: 8px; - letter-spacing: 4px; -} - -.stats { - display: flex; - justify-content: center; - gap: 20px; - font-size: 14px; - color: var(--text-secondary); -} - -.stats span { - display: flex; - align-items: center; - gap: 4px; -} - -.stats .correct { - color: var(--success); -} - -.navigation { - display: flex; - justify-content: center; - flex-wrap: wrap; - gap: 8px; - margin-bottom: 20px; - padding: 12px; - background: var(--bg-card); - border-radius: 12px; - border: 1px solid var(--border); -} - -.nav-btn { - width: 36px; - height: 36px; - border: 1px solid var(--border); - background: var(--bg-card); - color: var(--text-secondary); - border-radius: 8px; - cursor: pointer; - font-size: 14px; - transition: all 0.3s ease; -} - -.nav-btn:hover { - background: var(--bg-primary); - border-color: var(--accent); - color: var(--accent); -} - -.nav-btn.active { - background: var(--accent); - color: white; - border-color: var(--accent); -} - -.card { - background: var(--bg-card); - border-radius: 16px; - border: 1px solid var(--border); - padding: 30px; - margin-bottom: 20px; - box-shadow: 0 4px 20px var(--shadow); - position: relative; - overflow: hidden; -} - -.card::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - height: 4px; - background: linear-gradient(90deg, var(--accent), var(--success)); -} - -.question-number { - position: absolute; - top: 20px; - right: 20px; - font-size: 12px; - color: var(--text-secondary); - background: var(--bg-primary); - padding: 4px 12px; - border-radius: 20px; -} - -.question { - font-family: 'KaiTi', 'STKaiti', '楷体', serif; - font-size: 22px; - line-height: 1.8; - text-align: center; - margin-bottom: 30px; - padding: 20px; - background: linear-gradient(135deg, rgba(212, 197, 169, 0.2), transparent); - border-radius: 12px; - border-left: 3px solid var(--accent); -} - -.options { - display: flex; - flex-direction: column; - gap: 12px; -} - -.option-btn { - display: flex; - align-items: center; - gap: 12px; - padding: 16px 20px; - background: var(--bg-card); - border: 2px solid var(--border); - border-radius: 12px; - cursor: pointer; - transition: all 0.3s ease; - text-align: left; - font-size: 16px; - color: var(--text-primary); -} - -.option-btn:hover { - border-color: var(--accent); - transform: translateX(4px); - box-shadow: 0 2px 10px var(--shadow); -} - -.option-btn.selected { - border-color: var(--accent); - background: rgba(201, 76, 76, 0.05); -} - -.option-btn.correct { - border-color: var(--success); - background: rgba(74, 124, 89, 0.1); -} - -.option-btn.wrong { - border-color: var(--error); - background: rgba(201, 76, 76, 0.1); -} - -.option-num { - width: 28px; - height: 28px; - display: flex; - align-items: center; - justify-content: center; - background: var(--bg-primary); - border-radius: 6px; - font-weight: bold; - font-size: 14px; - color: var(--text-secondary); - flex-shrink: 0; -} - -.option-btn:hover .option-num { - background: var(--accent); - color: white; -} - -.option-btn.selected .option-num { - background: var(--accent); - color: white; -} - -.option-btn.correct .option-num { - background: var(--success); - color: white; -} - -.option-btn.wrong .option-num { - background: var(--error); - color: white; -} - -.hint-btn { - display: flex; - align-items: center; - justify-content: center; - gap: 8px; - margin-top: 20px; - padding: 12px; - background: transparent; - border: 1px dashed var(--border); - border-radius: 12px; - cursor: pointer; - color: var(--text-secondary); - font-size: 14px; - transition: all 0.3s ease; - width: 100%; -} - -.hint-btn:hover { - border-color: var(--accent); - color: var(--accent); - background: rgba(201, 76, 76, 0.05); -} - -.details { - background: var(--bg-card); - border-radius: 12px; - border: 1px solid var(--border); - padding: 20px; - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: 16px; -} - -.detail-item { - text-align: center; - padding: 12px; - background: var(--bg-primary); - border-radius: 8px; -} - -.detail-label { - font-size: 12px; - color: var(--text-secondary); - margin-bottom: 4px; -} - -.detail-value { - font-size: 16px; - color: var(--text-primary); - font-weight: 500; -} - -.feedback { - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%) scale(0.8); - background: var(--bg-card); - border-radius: 16px; - padding: 30px 50px; - text-align: center; - box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); - z-index: 1000; - opacity: 0; - visibility: hidden; - transition: all 0.3s ease; -} - -.feedback.show { - opacity: 1; - visibility: visible; - transform: translate(-50%, -50%) scale(1); -} - -.feedback.correct { - border: 2px solid var(--success); -} - -.feedback.wrong { - border: 2px solid var(--error); -} - -.feedback-icon { - font-size: 48px; - margin-bottom: 12px; -} - -.feedback-text { - font-size: 18px; - color: var(--text-primary); -} - -.overlay { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0, 0, 0, 0.3); - z-index: 999; - opacity: 0; - visibility: hidden; - transition: all 0.3s ease; -} - -.overlay.show { - opacity: 1; - visibility: visible; -} - -.hint-message { - background: var(--bg-card); - border-radius: 12px; - border: 1px solid var(--accent); - padding: 16px; - margin-top: 16px; - font-size: 14px; - color: var(--text-primary); - line-height: 1.6; - display: none; -} - -.hint-message.show { - display: block; - animation: fadeIn 0.3s ease; -} - -.loading { - text-align: center; - padding: 40px; - color: var(--text-secondary); -} - -.loading::after { - content: ''; - display: inline-block; - width: 20px; - height: 20px; - border: 2px solid var(--border); - border-top-color: var(--accent); - border-radius: 50%; - animation: spin 0.8s linear infinite; - margin-left: 10px; - vertical-align: middle; -} - -@keyframes spin { - to { transform: rotate(360deg); } -} - -@keyframes fadeIn { - from { opacity: 0; transform: translateY(-10px); } - to { opacity: 1; transform: translateY(0); } -} - -.error-message { - text-align: center; - padding: 20px; - color: var(--error); -} - -.retry-btn { - display: inline-flex; - align-items: center; - gap: 8px; - margin-top: 12px; - padding: 10px 20px; - background: var(--accent); - color: white; - border: none; - border-radius: 8px; - cursor: pointer; - font-size: 14px; - transition: all 0.3s ease; -} - -.retry-btn:hover { - opacity: 0.9; - transform: translateY(-2px); -} - -.nav-btn.random { - background: linear-gradient(135deg, var(--accent), #e67e22); - color: white; - border: none; - min-width: 60px; -} - -.nav-btn.random:hover { - transform: scale(1.05); - box-shadow: 0 2px 10px rgba(201, 76, 76, 0.3); -} - -.footer { - text-align: center; - padding: 20px; - margin-top: 20px; -} - -.contact-btn { - display: inline-flex; - align-items: center; - gap: 8px; - padding: 12px 24px; - background: linear-gradient(135deg, var(--accent), #e67e22); - color: white; - border: none; - border-radius: 25px; - cursor: pointer; - font-size: 14px; - transition: all 0.3s ease; - text-decoration: none; -} - -.contact-btn:hover { - transform: translateY(-2px); - box-shadow: 0 4px 15px rgba(201, 76, 76, 0.4); -} - -@media (max-width: 480px) { - body { - padding: 12px; - } - - .header h1 { - font-size: 24px; - } - - .card { - padding: 20px; - } - - .question { - font-size: 18px; - padding: 16px; - } - - .details { - grid-template-columns: 1fr 1fr; - gap: 10px; - } - - .detail-item { - padding: 10px; - } -} diff --git a/ht/p1/syx.php b/ht/p1/syx.php deleted file mode 100644 index 3061b14..0000000 --- a/ht/p1/syx.php +++ /dev/null @@ -1,97 +0,0 @@ -1){ -//存在不写入 -}else{ -file_put_contents($json, $a, FILE_APPEND | LOCK_EX);//追加写入,防止同时写入。 -//不存在,继续写入。 -} -}} - -function get_curl($url,$post=0,$referer=1,$cookie=0,$header=0,$ua=0,$nobaody=0){ -$ch = curl_init(); -curl_setopt($ch, CURLOPT_URL,$url); -curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); -curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); -$httpheader[] = "Accept:application/json"; -$httpheader[] = "Accept-Encoding:gzip,deflate,sdch"; -$httpheader[] = "Accept-Language:zh-CN,zh;q=0.8"; -$httpheader[] = "Connection:close"; -curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); -if($post){ -curl_setopt($ch, CURLOPT_POST, 1); -curl_setopt($ch, CURLOPT_POSTFIELDS, $post);} -if($header){ -curl_setopt($ch, CURLOPT_HEADER, TRUE);} -if($cookie){ -curl_setopt($ch, CURLOPT_DICTAPP_MID, $cookie);} -if($referer){ -if($referer==1){ -curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f='); -}else{ -curl_setopt($ch, CURLOPT_REFERER, $referer);}} -if($ua){ -curl_setopt($ch, CURLOPT_USERAGENT,$ua); -}else{ -curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Linux; U; Android 4.4.1; zh-cn) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/5.5 Mobile Safari/533.1');} -if($nobaody){ -curl_setopt($ch, CURLOPT_NOBODY,1);} -curl_setopt($ch, CURLOPT_ENCODING, "gzip"); -curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); -$ret = curl_exec($ch); -curl_close($ch); -return $ret;} - -?> \ No newline at end of file diff --git a/ht/reger.php b/ht/reger.php deleted file mode 100644 index a10acef..0000000 --- a/ht/reger.php +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
-
- - -
-
- - -
-
-

用户注册

- -
- -
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
-
- - -
-
-
- - - - - diff --git a/ht/style.css b/ht/style.css new file mode 100644 index 0000000..1ca99ce --- /dev/null +++ b/ht/style.css @@ -0,0 +1,545 @@ +:root { + --apple-blue: #007AFF; + --apple-blue-hover: #0056b3; + --apple-green: #34C759; + --apple-red: #FF3B30; + --apple-orange: #FF9500; + --apple-gray: #8E8E93; + --apple-light-gray: #F2F2F7; + --apple-dark-gray: #636366; + --border-radius: 12px; + --border-radius-sm: 8px; + --border-radius-lg: 16px; + --shadow: 0 2px 8px rgba(0, 0, 0, 0.08); + --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12); + --transition: 0.3s ease; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + min-height: 100vh; + padding: 20px; + color: #1d1d1f; +} + +.container { + max-width: 700px; + margin: 0 auto; +} + +.header { + text-align: center; + margin-bottom: 40px; + color: white; +} + +.header h1 { + font-size: 32px; + font-weight: 700; + margin-bottom: 10px; + letter-spacing: -0.5px; +} + +.header p { + font-size: 16px; + opacity: 0.9; +} + +.card { + background: white; + border-radius: var(--border-radius-lg); + box-shadow: var(--shadow); + padding: 40px; + transition: var(--transition); +} + +.card:hover { + box-shadow: var(--shadow-hover); +} + +.form-group { + margin-bottom: 24px; +} + +.form-group label { + display: block; + font-size: 14px; + font-weight: 600; + color: var(--apple-dark-gray); + margin-bottom: 8px; +} + +.form-group label .required { + color: var(--apple-red); + margin-left: 4px; +} + +.form-control { + width: 100%; + padding: 14px 16px; + font-size: 16px; + border: 1px solid #E5E5EA; + border-radius: var(--border-radius-sm); + background: var(--apple-light-gray); + transition: var(--transition); + outline: none; + font-family: inherit; +} + +.form-control:focus { + border-color: var(--apple-blue); + background: white; + box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1); +} + +.form-control::placeholder { + color: var(--apple-gray); +} + +textarea.form-control { + resize: vertical; + min-height: 120px; +} + +select.form-control { + cursor: pointer; + appearance: none; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%238E8E93'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E"); + background-repeat: no-repeat; + background-position: right 12px center; + background-size: 20px; + padding-right: 40px; +} + +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 8px; + padding: 14px 28px; + font-size: 16px; + font-weight: 600; + border: none; + border-radius: var(--border-radius-sm); + cursor: pointer; + transition: var(--transition); + font-family: inherit; +} + +.btn-primary { + background: var(--apple-blue); + color: white; +} + +.btn-primary:hover { + background: var(--apple-blue-hover); + transform: translateY(-1px); +} + +.btn-primary:active { + transform: translateY(0); +} + +.btn-primary:disabled { + background: var(--apple-gray); + cursor: not-allowed; + transform: none; +} + +.btn-secondary { + background: var(--apple-gray); + color: white; + margin-top: 8px; +} + +.btn-secondary:hover { + background: var(--apple-dark-gray); + transform: translateY(-1px); +} + +.btn-secondary:active { + transform: translateY(0); +} + +.btn-block { + width: 100%; +} + +.alert { + padding: 16px 20px; + border-radius: var(--border-radius-sm); + margin-bottom: 24px; + display: none; + align-items: center; + gap: 10px; +} + +.alert.show { + display: flex; +} + +.alert-success { + background: #E8F8ED; + color: var(--apple-green); + border: 1px solid rgba(52, 199, 89, 0.3); +} + +.alert-error { + background: #FCE8E8; + color: var(--apple-red); + border: 1px solid rgba(255, 59, 48, 0.3); +} + +.alert-info { + background: #E8F4FF; + color: var(--apple-blue); + border: 1px solid rgba(0, 122, 255, 0.3); +} + +.debug-section { + margin-top: 30px; + padding: 20px; + background: var(--apple-light-gray); + border-radius: var(--border-radius); +} + +.debug-section h3 { + font-size: 14px; + font-weight: 600; + color: var(--apple-dark-gray); + margin-bottom: 12px; + display: flex; + align-items: center; + gap: 8px; +} + +.debug-btn { + padding: 8px 16px; + font-size: 14px; + background: white; + border: 1px solid #E5E5EA; + border-radius: var(--border-radius-sm); + cursor: pointer; + transition: var(--transition); + margin-right: 8px; + margin-bottom: 8px; +} + +.debug-btn:hover { + background: var(--apple-light-gray); + border-color: var(--apple-gray); +} + +.debug-log { + margin-top: 12px; + padding: 12px; + background: #1d1d1f; + color: #f5f5f7; + border-radius: var(--border-radius-sm); + font-family: 'SF Mono', Monaco, 'Courier New', monospace; + font-size: 13px; + max-height: 200px; + overflow-y: auto; + display: none; +} + +.debug-log.show { + display: block; +} + +.debug-log .log-item { + margin-bottom: 6px; + padding-bottom: 6px; + border-bottom: 1px solid rgba(255, 255, 255, 0.1); +} + +.debug-log .log-item:last-child { + border-bottom: none; + margin-bottom: 0; + padding-bottom: 0; +} + +.debug-log .log-time { + color: var(--apple-gray); + margin-right: 8px; +} + +.loading { + display: none; + width: 20px; + height: 20px; + border: 2px solid rgba(255, 255, 255, 0.3); + border-top-color: white; + border-radius: 50%; + animation: spin 0.8s linear infinite; +} + +.loading.show { + display: inline-block; +} + +@keyframes spin { + to { transform: rotate(360deg); } +} + +.input-wrapper { + position: relative; +} + +.input-wrapper .icon { + position: absolute; + right: 12px; + top: 50%; + transform: translateY(-50%); + font-size: 20px; + display: none; +} + +.input-wrapper .icon.success { + color: var(--apple-green); + display: block; +} + +.input-wrapper .icon.error { + color: var(--apple-red); + display: block; +} + +.form-control.valid { + border-color: var(--apple-green); +} + +.form-control.invalid { + border-color: var(--apple-red); +} + +.modal { + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.5); + z-index: 1000; + align-items: center; + justify-content: center; + padding: 20px; +} + +.modal.show { + display: flex; + animation: fadeIn 0.3s ease; +} + +@keyframes fadeIn { + from { opacity: 0; } + to { opacity: 1; } +} + +.modal-content { + background: white; + border-radius: var(--border-radius-lg); + box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); + max-width: 500px; + width: 100%; + animation: slideUp 0.3s ease; +} + +@keyframes slideUp { + from { + transform: translateY(20px); + opacity: 0; + } + to { + transform: translateY(0); + opacity: 1; + } +} + +.modal-header { + padding: 30px 30px 20px; + text-align: center; + border-bottom: 1px solid #E5E5EA; +} + +.modal-header span { + font-size: 64px; + display: block; + margin-bottom: 16px; +} + +.modal-header h2 { + font-size: 24px; + font-weight: 700; + color: var(--apple-dark-gray); + margin: 0; +} + +.modal-body { + padding: 30px; + text-align: center; +} + +.modal-body p { + font-size: 16px; + color: var(--apple-dark-gray); + line-height: 1.6; + margin: 0; +} + +.modal-footer { + padding: 20px 30px 30px; + border-top: 1px solid #E5E5EA; +} + +.modal-footer .btn { + width: 100%; +} + +@media (max-width: 640px) { + body { + padding: 12px; + } + + .card { + padding: 24px; + } + + .header h1 { + font-size: 24px; + } + + .modal-header { + padding: 24px 20px 16px; + } + + .modal-header span { + font-size: 48px; + } + + .modal-header h2 { + font-size: 20px; + } + + .modal-body { + padding: 24px 20px; + } + + .modal-footer { + padding: 16px 20px 24px; + } +} + +.captcha-wrapper { + display: flex; + gap: 12px; + align-items: center; + flex-wrap: wrap; +} + +.captcha-question { + background: linear-gradient(135deg, var(--apple-blue) 0%, #0077ED 100%); + color: white; + padding: 12px 24px; + border-radius: var(--border-radius); + font-size: 18px; + font-weight: 600; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + min-width: 120px; + text-align: center; + user-select: none; +} + +.captcha-input { + flex: 1; + min-width: 150px; +} + +.refresh-btn { + white-space: nowrap; + margin: 0; +} + +.threshold-wrapper { + display: flex; + gap: 12px; + align-items: center; + margin-top: 8px; + flex-wrap: wrap; +} + +.threshold-wrapper label { + font-size: 14px; + font-weight: 500; + color: var(--apple-dark-gray); + white-space: nowrap; +} + +.threshold-input { + width: 100px; +} + +.similarity-info { + margin-top: 12px; +} + +.similarity-item { + padding: 12px 16px; + border-radius: var(--border-radius); + display: flex; + flex-wrap: wrap; + gap: 16px; + align-items: center; +} + +.similarity-item.success { + background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%); + border: 1px solid #A5D6A7; +} + +.similarity-item.error { + background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%); + border: 1px solid #EF9A9A; +} + +.similarity-label { + font-weight: 600; + font-size: 14px; +} + +.similarity-item.success .similarity-label { + color: #2E7D32; +} + +.similarity-item.error .similarity-label { + color: #C62828; +} + +.similarity-count, +.similarity-percent { + font-size: 14px; + padding: 4px 12px; + border-radius: 20px; + background: rgba(0, 0, 0, 0.08); + font-weight: 500; +} + +.similarity-item.success .similarity-count, +.similarity-item.success .similarity-percent { + background: rgba(46, 125, 50, 0.15); + color: #2E7D32; +} + +.similarity-item.error .similarity-count, +.similarity-item.error .similarity-percent { + background: rgba(198, 40, 40, 0.15); + color: #C62828; +} diff --git a/ht/tapi.php b/ht/tapi.php deleted file mode 100644 index bbc5d40..0000000 --- a/ht/tapi.php +++ /dev/null @@ -1,287 +0,0 @@ -getOne('users', "username = '$username'"); - - // 验证用户和密码 - if (!$user || !password_verify($password, $user['password'])) { - apiResponse(1, '账号或密码错误'); - } - - // 验证用户状态 - if ($user['status'] != 1) { - apiResponse(1, '账号已被禁用,请联系管理员'); - } - - // 更新最后登录时间 - $db->update('users', [ - 'logtime' => date('Y-m-d H:i:s') - ], "id = {$user['id']}"); - - // 记录登录日志 - writeLog($user['id'], 'login', '用户登录'); - - // 存储session - session_start(); - $_SESSION['user'] = $user; - - // 移除敏感信息 - unset($user['password']); - - apiResponse(0, '登录成功', $user); -} - -/** - * 处理用户注册 - * @param array $params 请求参数 - * @param DB $db 数据库操作对象 - */ -function handleRegister($params, $db) { - // 获取参数 - $username = isset($params['username']) ? safeFilter($params['username']) : ''; - $password = isset($params['password']) ? $params['password'] : ''; - $userIdentifier = isset($params['user_identifier']) ? safeFilter($params['user_identifier']) : ''; - - // 参数验证 - if (empty($username) || empty($password)) { - apiResponse(1, '账号和密码不能为空'); - } - - // 验证账号格式(手机号/邮箱/微信号) - $phoneRegex = '/^1[3456789]\d{9}$/'; - $emailRegex = '/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/'; - $wechatRegex = '/^[a-zA-Z0-9_-]{6,20}$/'; - - if (!preg_match($phoneRegex, $username) && !preg_match($emailRegex, $username) && !preg_match($wechatRegex, $username)) { - apiResponse(1, '请输入正确的手机号、邮箱或微信号'); - } - - // 验证密码长度 - if (strlen($password) < 6) { - apiResponse(1, '密码长度不能少于6位'); - } - - // 检查用户名是否已存在 - $existUser = $db->getOne('users', "username = '$username'"); - if ($existUser) { - apiResponse(1, '该账号已被注册'); - } - - // 密码加密 - $hashedPassword = password_hash($password, PASSWORD_DEFAULT); - - // 添加用户 - $userId = $db->insert('users', [ - 'username' => $username, - 'password' => $hashedPassword, - 'irole' => 0, // 普通用户 - 'status' => 1, // 正常状态 - 'regtime' => date('Y-m-d H:i:s'), - 'user_identifier' => $userIdentifier - ]); - - if (!$userId) { - apiResponse(1, '注册失败,请稍后重试'); - } - - // 记录注册日志 - writeLog($userId, 'register', '用户注册'); - - apiResponse(0, '注册成功'); -} - -/** - * 处理获取用户信息 - * @param array $params 请求参数 - * @param DB $db 数据库操作对象 - */ -function handleGetUserInfo($params, $db) { - // 检查登录状态 - $user = checkLogin(); - if (!$user) { - apiResponse(1, '请先登录'); - } - - // 获取最新的用户信息 - $userInfo = $db->getOne('users', "id = {$user['id']}"); - - if (!$userInfo) { - apiResponse(1, '用户不存在'); - } - - // 移除敏感信息 - unset($userInfo['password']); - - apiResponse(0, '获取成功', $userInfo); -} - -/** - * 处理更新用户标识 - * @param array $params 请求参数 - * @param DB $db 数据库操作对象 - */ -function handleUpdateUserIdentifier($params, $db) { - // 检查登录状态 - $user = checkLogin(); - if (!$user) { - apiResponse(1, '请先登录'); - } - - // 获取参数 - $userIdentifier = isset($params['user_identifier']) ? safeFilter($params['user_identifier']) : ''; - - // 验证用户标识长度 - if (strlen($userIdentifier) > 100) { - apiResponse(1, '用户标识长度不能超过100个字符'); - } - - // 更新用户标识 - $result = $db->update('users', [ - 'user_identifier' => $userIdentifier - ], "id = {$user['id']}"); - - if (!$result) { - apiResponse(1, '更新失败,请稍后重试'); - } - - // 记录日志 - writeLog($user['id'], 'update_identifier', '更新用户标识'); - - // 获取更新后的用户信息 - $updatedUser = $db->getOne('users', "id = {$user['id']}"); - - // 移除敏感信息 - unset($updatedUser['password']); - - // 更新session - session_start(); - $_SESSION['user'] = $updatedUser; - - apiResponse(0, '更新成功', $updatedUser); -} - -/** - * 处理用户登出 - */ -function handleLogout() { - session_start(); - - // 记录登出日志 - if (isset($_SESSION['user']) && !empty($_SESSION['user']['id'])) { - writeLog($_SESSION['user']['id'], 'logout', '用户登出'); - } - - // 清除session - unset($_SESSION['user']); - session_destroy(); - - apiResponse(0, '登出成功'); -} - -/** - * 统一API响应格式 - * @param int $code 状态码,0表示成功,非0表示失败 - * @param string $msg 提示信息 - * @param array $data 返回数据 - */ -function apiResponse($code = 0, $msg = '', $data = []) { - echo json_encode([ - 'code' => $code, - 'msg' => $msg, - 'data' => $data - ], JSON_UNESCAPED_UNICODE); - exit; -} \ No newline at end of file diff --git a/ht/test/API.md b/ht/test/API.md deleted file mode 100644 index 2293dbb..0000000 --- a/ht/test/API.md +++ /dev/null @@ -1,525 +0,0 @@ -# 诗词答题 API 文档 - -## 基础信息 - -| 项目 | 说明 | -|------|------| -| 基础URL | `/api.php` | -| 返回格式 | JSON | -| 编码 | UTF-8 | -| 请求方式 | **GET / POST 都支持** | - -### 请求方式说明 - -| 接口 | 推荐方式 | 原因 | -|------|----------|------| -| 获取题目 (question) | **GET** | 读取操作,简单可缓存 | -| 下一题 (next) | **GET** | 读取操作 | -| 获取新题 (fetch) | **GET** | 读取操作 | -| 提交答案 (answer) | **POST** | 提交操作,更规范 | -| 获取提示 (hint) | **GET** | 读取操作 | -| 题目列表 (list) | **GET** | 读取操作 | -| 刷新缓存 (refresh) | **GET** | 管理操作 | -| 状态统计 (stats) | **GET** | 读取操作 | - -## 通用返回格式 - -```json -{ - "code": 0, - "msg": "", - "data": { ... } -} -``` - -| 字段 | 类型 | 说明 | -|------|------|------| -| code | int | 状态码,0=成功,其他=错误 | -| msg | string | 提示信息 | -| data | object | 返回数据 | - ---- - -## 接口列表 - -### 1. 获取题目 - -**请求** -``` -GET /api.php?action=question&id=0 -``` - -| 参数 | 类型 | 必填 | 说明 | -|------|------|------|------| -| action | string | 否 | 默认为 question | -| id | int | 否 | 题目ID,默认0 | - -**返回** -```json -{ - "code": 0, - "msg": "", - "data": { - "id": 0, - "total": 10, - "question": "欲把西湖比西子,\"________\"", - "author": "苏轼", - "type": "江南", - "grade": "小学", - "dynasty": "宋朝", - "options": [ - {"index": 1, "content": "山色空蒙雨亦奇"}, - {"index": 2, "content": "淡妆浓抹总相宜"}, - {"index": 3, "content": "门前流水尚能西"}, - {"index": 4, "content": "拄杖无时夜叩门"} - ] - } -} -``` - ---- - -### 2. 获取下一题(自动进度) - -**请求** -``` -GET /api.php?action=next -``` - -| 参数 | 类型 | 必填 | 说明 | -|------|------|------|------| -| action | string | 是 | 固定为 next | - -**说明** -- **无需传 id 参数**,系统自动记住当前进度(使用 Session) -- 每次刷新自动跳到下一题 -- 如果已经是最后一题,自动回到第 0 题(循环) - -**使用方式** -| 刷新次数 | 返回的 id | -|----------|-----------| -| 第 1 次 | 1 | -| 第 2 次 | 2 | -| 第 3 次 | 3 | -| ... | ... | -| 第 62 次 | 0 (循环) | - -**返回** -```json -{ - "code": 0, - "msg": "", - "data": { - "id": 1, - "total": 62, - "question": "人生得意须尽欢,\"__________\"", - "author": "李白", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝", - "options": [...], - "prev_id": 0 - } -} -``` - ---- - -### 3. 刷新获取新题(推荐) - -**请求** -``` -GET /api.php?action=fetch -``` - -| 参数 | 类型 | 必填 | 说明 | -|------|------|------|------| -| action | string | 是 | 固定为 fetch | - -**说明** -- **每次刷新都从百度 API 获取新题目** -- 新题目自动写入本地缓存(去重) -- 返回本次获取的随机一题 -- API 失败时自动降级使用本地缓存 - -**返回** -```json -{ - "code": 0, - "msg": "", - "data": { - "id": null, - "total": 65, - "question": "人生得意须尽欢,\"__________\"", - "author": "李白", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝", - "options": [...], - "from_cache": false, - "new_questions": 3 - } -} -``` - -**额外返回字段** -| 字段 | 类型 | 说明 | -|------|------|------| -| from_cache | bool | 是否来自本地缓存 | -| new_questions | int | 本次新增题目数量 | - ---- - -### 4. 提交答案 - -**请求方式 1:GET(简单)** -``` -GET /api.php?action=answer&id=0&answer=2 -``` - -**请求方式 2:POST(推荐)** -``` -POST /api.php -Content-Type: application/x-www-form-urlencoded - -action=answer&id=0&answer=2 -``` - -或使用 JSON: -``` -POST /api.php -Content-Type: application/json - -{ - "action": "answer", - "id": 0, - "answer": "2" -} -``` - -| 参数 | 类型 | 必填 | 说明 | -|------|------|------|------| -| action | string | 是 | 固定为 answer | -| id | int | 是 | 题目ID | -| answer | string | 是 | 答案序号(1-4) | - -**返回** -```json -{ - "code": 0, - "msg": "", - "data": { - "id": 0, - "correct": true, - "your_answer": "2", - "correct_answer": "2", - "next_id": 1, - "has_next": true - } -} -``` - ---- - -### 5. 获取提示 - -**请求** -``` -GET /api.php?action=hint&id=0 -``` - -| 参数 | 类型 | 必填 | 说明 | -|------|------|------|------| -| action | string | 是 | 固定为 hint | -| id | int | 是 | 题目ID | - -**返回** -```json -{ - "code": 0, - "msg": "", - "data": { - "id": 0, - "hint": "这是首描写江南的诗,你在小学学过它。", - "author": "苏轼", - "dynasty": "宋朝" - } -} -``` - ---- - -### 6. 获取题目列表 - -**请求** -``` -GET /api.php?action=list -``` - -**返回** -```json -{ - "code": 0, - "msg": "", - "data": { - "total": 10, - "list": [ - { - "id": 0, - "question": "欲把西湖比西子,\"________\"...", - "author": "苏轼", - "dynasty": "宋朝" - } - ] - } -} -``` - ---- - -### 7. 刷新缓存 - -**请求** -``` -GET /api.php?action=refresh -``` - -**说明** -- 强制从百度 API 获取最新题目 -- 合并到本地缓存(去重) - -**返回** -```json -{ - "code": 0, - "msg": "", - "data": { - "refreshed": true, - "total": 15 - } -} -``` - ---- - -## 缓存机制 - -| 配置 | 值 | 说明 | -|------|------|------| -| 缓存文件 | `data/questions.json` | 本地JSON文件 | -| 过期时间 | **永不过期** | 永久保存 | -| 去重方式 | 按 `question_content` | 相同题目不重复存储 | -| 降级策略 | API失败自动使用本地缓存 | 原始URL失效也能使用 | -| API 限频 | 5秒内只请求一次 | 防止并发请求百度 | - -### 缓存文件结构 - -```json -{ - "updated": "2024-01-01 12:00:00", - "count": 10, - "questions": [...] -} -``` - ---- - -## 性能优化 - -### 已实现优化 - -| 优化项 | 说明 | -|--------|------| -| 静态变量缓存 | 同一请求内多次读取只加载一次文件 | -| API 请求锁 | 5秒内多人请求只发一次 API | -| 原子写入 | 先写临时文件再 rename,防止数据损坏 | -| 去重优化 | 只在写入时去重,读取时不处理 | -| 超时控制 | API 超时 5 秒,连接超时 3 秒 | - -### 性能预估 - -| 场景 | 响应时间 | -|------|----------| -| 读取本地缓存 | ~2-5ms | -| API 请求成功 | ~200-500ms | -| API 限频降级 | ~1ms(直接读缓存) | -| 100人并发 | 无压力(读缓存为主) | - -### 查看状态 - -``` -GET /api.php?action=stats -``` - -返回: -```json -{ - "code": 0, - "data": { - "total_questions": 149, - "cache_file_size": "40.5 KB", - "last_updated": "2026-03-29 05:04:04", - "memory_usage": "256 KB" - } -} -``` - ---- - -## 错误码 - -| code | 说明 | -|------|------| -| 0 | 成功 | -| 400 | 参数错误 | -| 404 | 题目不存在 | - ---- - -## 使用示例 - -### JavaScript -```javascript -// 获取第一题 -fetch('/api.php?action=question&id=0') - .then(r => r.json()) - .then(d => console.log(d.data.question)); - -// 获取下一题(自动进度,无需传 id) -fetch('/api.php?action=next') - .then(r => r.json()) - .then(d => console.log(d.data.id, d.data.question)); - -// 提交答案 -fetch('/api.php?action=answer&id=0&answer=2') - .then(r => r.json()) - .then(d => { - if(d.data.correct) { - console.log('回答正确!'); - } - }); -``` - -### Flutter/Dart -```dart -import 'package:dio/dio.dart'; - -final dio = Dio(); - -// 获取题目 -Future getQuestion(int id) async { - final res = await dio.get('/api.php', queryParameters: { - 'action': 'question', - 'id': id, - }); - return res.data['data']; -} - -// 获取下一题(自动进度,无需传 id) -Future getNextQuestion() async { - final res = await dio.get('/api.php', queryParameters: { - 'action': 'next', - }); - return res.data['data']; -} - -// 提交答案(POST 方式) -Future checkAnswer(int id, String answer) async { - final res = await dio.post('/api.php', data: { - 'action': 'answer', - 'id': id, - 'answer': answer, - }); - return res.data['data']['correct']; -} -``` - ---- - -## App 集成建议 - -### 方案 1:App 自己管理进度(推荐) - -使用 `?action=question` 接口,App 完全控制进度: - -```dart -class QuizApi { - int _currentId = 0; - int _total = 0; - - Future getQuestion() async { - final res = await dio.get('/api.php', queryParameters: { - 'action': 'question', - 'id': _currentId, - }); - final data = res.data['data']; - _total = data['total'] ?? 0; - return data; - } - - Future submitAnswer(String answer) async { - final res = await dio.post('/api.php', data: { - 'action': 'answer', - 'id': _currentId, - 'answer': answer, - }); - return res.data['data']; - } - - void nextQuestion() { - _currentId++; - if (_currentId >= _total) { - _currentId = 0; - } - } - - int get currentId => _currentId; -} -``` - -**优点**: -- 不依赖 Session,App 完全控制进度 -- 可以随时跳转任意题目 -- 适合多端同步 - ---- - -### 方案 2:使用自动进度 - -使用 `?action=next` 接口,API 自动管理: - -```dart -Future getNextQuestion() async { - final res = await dio.get('/api.php', queryParameters: { - 'action': 'next', - }); - return res.data['data']; -} -``` - -**优点**: -- 简单,无需管理 ID -- 自动循环 - -**缺点**: -- 依赖 Session,需要保持 cookie -- 无法自由跳转题目 - ---- - -### 方案 3:不断获取新题 - -使用 `?action=fetch` 接口,每次都从百度获取新题: - -```dart -Future getNewQuestion() async { - final res = await dio.get('/api.php', queryParameters: { - 'action': 'fetch', - }); - return res.data['data']; -} -``` - -**适用场景**: -- 想要不断扩展题库 -- 用户每次刷新都可能看到新题 diff --git a/ht/test/api.php b/ht/test/api.php deleted file mode 100644 index 8bb3308..0000000 --- a/ht/test/api.php +++ /dev/null @@ -1,353 +0,0 @@ - 0, 'msg' => '', 'data' => null]; - -$action = $_REQUEST['action'] ?? 'question'; -$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null; - -switch($action){ - case 'question': - $result['data'] = getQuestion($id ?? getCurrentId()); - break; - case 'next': - $result['data'] = getNextQuestionAuto(); - break; - case 'fetch': - $result['data'] = fetchNewQuestion(); - break; - case 'answer': - $result['data'] = checkAnswer($id, $_REQUEST['answer'] ?? ''); - break; - case 'hint': - $result['data'] = getHint($id); - break; - case 'list': - $result['data'] = getQuestionList(); - break; - case 'refresh': - $result['data'] = refreshCache(); - break; - case 'stats': - $result['data'] = getStats(); - break; - default: - $result['code'] = 400; - $result['msg'] = '未知操作'; -} - -echo json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); - -function getStats(){ - global $cacheData; - $cache = loadCache(); - return [ - 'total_questions' => count($cache), - 'cache_file_size' => file_exists(CACHE_FILE) ? round(filesize(CACHE_FILE) / 1024, 2) . ' KB' : 0, - 'last_updated' => file_exists(CACHE_FILE) ? date('Y-m-d H:i:s', filemtime(CACHE_FILE)) : 'N/A', - 'memory_usage' => round(memory_get_peak_usage(true) / 1024, 2) . ' KB' - ]; -} - -function getQuestion($id){ - $cache = loadCache(); - if(empty($cache)){ - return ['error' => '没有题目数据']; - } - if($id < 0 || $id >= count($cache)){ - return ['error' => '题目不存在', 'total' => count($cache)]; - } - $item = $cache[$id]; - return [ - 'id' => $id, - 'total' => count($cache), - 'question' => $item['question_content'], - 'author' => $item['type']['person'] ?? '', - 'type' => $item['type']['type'] ?? '', - 'grade' => $item['type']['grade'] ?? '', - 'dynasty' => $item['type']['dynasty'] ?? '', - 'options' => formatOptions($item['option_answers'] ?? []) - ]; -} - -function getNextQuestionAuto(){ - $cache = loadCache(); - if(empty($cache)){ - return ['error' => '没有题目数据']; - } - $total = count($cache); - $currentId = getCurrentId(); - $nextId = $currentId + 1; - if($nextId >= $total){ - $nextId = 0; - } - setCurrentId($nextId); - $result = getQuestion($nextId); - $result['prev_id'] = $currentId; - return $result; -} - -function getCurrentId(){ - return isset($_SESSION['current_question_id']) ? intval($_SESSION['current_question_id']) : 0; -} - -function setCurrentId($id){ - $_SESSION['current_question_id'] = $id; -} - -function fetchNewQuestion(){ - $apiData = fetchFromBaiduApi(); - - if($apiData === null){ - $cache = loadCache(); - if(!empty($cache)){ - $randomId = array_rand($cache); - $result = formatQuestionItem($randomId, $cache[$randomId], count($cache)); - $result['from_cache'] = true; - $result['api_status'] = 'failed'; - return $result; - } - return ['error' => 'API请求失败且无本地缓存']; - } - - $cache = loadCache(); - $newCount = mergeToCache($apiData, $cache); - - $randomItem = $apiData[array_rand($apiData)]; - $result = formatQuestionItem(null, $randomItem, count($cache)); - $result['from_cache'] = false; - $result['new_questions'] = $newCount; - $result['api_status'] = 'success'; - - return $result; -} - -function formatQuestionItem($id, $item, $total, $fromCache = false, $newCount = 0){ - return [ - 'id' => $id, - 'total' => $total, - 'question' => $item['question_content'], - 'author' => $item['type']['person'] ?? '', - 'type' => $item['type']['type'] ?? '', - 'grade' => $item['type']['grade'] ?? '', - 'dynasty' => $item['type']['dynasty'] ?? '', - 'options' => formatOptions($item['option_answers'] ?? []), - 'from_cache' => $fromCache, - 'new_questions' => $newCount - ]; -} - -function checkAnswer($id, $answer){ - $cache = loadCache(); - if(empty($cache)){ - return ['error' => '没有题目数据']; - } - if($id < 0 || $id >= count($cache)){ - return ['error' => '题目不存在']; - } - $item = $cache[$id]; - $correctAnswer = findAnswer($item['option_answers'] ?? []); - $isCorrect = ($answer === $correctAnswer); - - return [ - 'id' => $id, - 'correct' => $isCorrect, - 'your_answer' => $answer, - 'correct_answer' => $correctAnswer, - 'next_id' => $id + 1, - 'has_next' => $id + 1 < count($cache) - ]; -} - -function getHint($id){ - $cache = loadCache(); - if(empty($cache)){ - return ['error' => '没有题目数据']; - } - if($id < 0 || $id >= count($cache)){ - return ['error' => '题目不存在']; - } - $item = $cache[$id]; - return [ - 'id' => $id, - 'hint' => '这是首描写' . ($item['type']['type'] ?? '') . '的诗,你在' . ($item['type']['grade'] ?? '') . '学过它。', - 'author' => $item['type']['person'] ?? '', - 'dynasty' => $item['type']['dynasty'] ?? '' - ]; -} - -function getQuestionList(){ - $cache = loadCache(); - if(empty($cache)){ - return ['total' => 0, 'list' => []]; - } - $list = []; - foreach($cache as $i => $item){ - $list[] = [ - 'id' => $i, - 'question' => mb_substr($item['question_content'], 0, 30, 'UTF-8') . '...', - 'author' => $item['type']['person'] ?? '', - 'dynasty' => $item['type']['dynasty'] ?? '' - ]; - } - return ['total' => count($list), 'list' => $list]; -} - -function refreshCache(){ - $apiData = fetchFromBaiduApi(); - if($apiData === null){ - return ['refreshed' => false, 'error' => 'API请求失败']; - } - $cache = loadCache(); - $newCount = mergeToCache($apiData, $cache); - return ['refreshed' => true, 'total' => count($cache), 'new_questions' => $newCount]; -} - -function loadCache(){ - global $cacheData; - - if($cacheData !== null){ - return $cacheData; - } - - if(!file_exists(CACHE_FILE)){ - $cacheData = []; - return []; - } - - $content = file_get_contents(CACHE_FILE); - if($content === false){ - $cacheData = []; - return []; - } - - $data = json_decode($content, true); - if(!is_array($data) || !isset($data['questions'])){ - $cacheData = []; - return []; - } - - $cacheData = $data['questions']; - return $cacheData; -} - -function saveCache($questions){ - global $cacheData; - - if(!is_dir(CACHE_DIR)){ - mkdir(CACHE_DIR, 0755, true); - } - - $data = [ - 'updated' => date('Y-m-d H:i:s'), - 'count' => count($questions), - 'questions' => $questions - ]; - - $tempFile = CACHE_FILE . '.tmp'; - $result = file_put_contents($tempFile, json_encode($data, JSON_UNESCAPED_UNICODE), LOCK_EX); - - if($result !== false){ - rename($tempFile, CACHE_FILE); - } - - $cacheData = $questions; -} - -function fetchFromBaiduApi(){ - if(file_exists(API_LOCK_FILE)){ - $lockTime = intval(file_get_contents(API_LOCK_FILE)); - if(time() - $lockTime < API_INTERVAL){ - return null; - } - } - - file_put_contents(API_LOCK_FILE, time()); - - $url = 'https://hanyu.baidu.com/hanyu/ajax/pingce_data'; - $ch = curl_init(); - curl_setopt_array($ch, [ - CURLOPT_URL => $url, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_SSL_VERIFYPEER => false, - CURLOPT_SSL_VERIFYHOST => false, - CURLOPT_TIMEOUT => 5, - CURLOPT_CONNECTTIMEOUT => 3, - CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', - CURLOPT_HTTPHEADER => [ - 'Accept: application/json', - 'Accept-Language: zh-CN,zh;q=0.9' - ] - ]); - $response = curl_exec($ch); - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - curl_close($ch); - - if($httpCode !== 200 || empty($response)){ - return null; - } - - $json = json_decode($response, true); - if(!isset($json['data']) || !is_array($json['data'])){ - return null; - } - - return $json['data']; -} - -function mergeToCache($newData, &$existingCache){ - if(empty($newData)){ - return 0; - } - - $existingKeys = []; - foreach($existingCache as $item){ - $key = $item['question_content'] ?? ''; - $existingKeys[$key] = true; - } - - $newCount = 0; - foreach($newData as $item){ - $key = $item['question_content'] ?? ''; - if(!isset($existingKeys[$key])){ - $existingCache[] = $item; - $existingKeys[$key] = true; - $newCount++; - } - } - - if($newCount > 0){ - saveCache($existingCache); - } - - return $newCount; -} - -function formatOptions($options){ - $result = []; - foreach($options as $i => $opt){ - $result[] = [ - 'index' => $i + 1, - 'content' => $opt['answer_content'] ?? '' - ]; - } - return $result; -} - -function findAnswer($options){ - foreach($options as $i => $opt){ - if(($opt['is_standard_answer'] ?? 0) === 1){ - return (string)($i + 1); - } - } - return ''; -} -?> diff --git a/ht/test/data/.htaccess b/ht/test/data/.htaccess deleted file mode 100644 index 36c7a14..0000000 --- a/ht/test/data/.htaccess +++ /dev/null @@ -1,5 +0,0 @@ -order allow,deny -deny from all - - deny from all - diff --git a/ht/test/data/questions.json b/ht/test/data/questions.json deleted file mode 100644 index 028b437..0000000 --- a/ht/test/data/questions.json +++ /dev/null @@ -1,4029 +0,0 @@ -{ - "updated": "2026-03-29 05:04:04", - "count": 149, - "questions": [ - { - "question_content": "小楼昨夜又东风,“_________”", - "type": { - "person": "李煜 ", - "type": "婉约", - "grade": "高中", - "dynasty": "五代" - }, - "option_answers": [ - { - "answer_content": "恰似一春江水项东流", - "is_standard_answer": 0 - }, - { - "answer_content": "恰似故人远来载乡愁", - "is_standard_answer": 0 - }, - { - "answer_content": "珠帘泛婆娑湿衣袖", - "is_standard_answer": 0 - }, - { - "answer_content": "故国不堪回首月明中", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "渡远荆门外,“________”", - "type": { - "person": "李白", - "type": "友情", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "江清月近人", - "is_standard_answer": 0 - }, - { - "answer_content": "来从楚国游", - "is_standard_answer": 1 - }, - { - "answer_content": "山色有无中", - "is_standard_answer": 0 - }, - { - "answer_content": "月涌大江流", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,崔九堂前几度闻", - "type": { - "person": "杜甫", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "乌衣巷口夕阳斜", - "is_standard_answer": 0 - }, - { - "answer_content": "岐王宅里寻常见", - "is_standard_answer": 1 - }, - { - "answer_content": "正是江南好风景", - "is_standard_answer": 0 - }, - { - "answer_content": "此曲只应天上有", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“无为在岐路,儿女共沾巾”哪个字是错误的?", - "type": { - "person": "王勃", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "巾->襟", - "is_standard_answer": 0 - }, - { - "answer_content": "沾->粘", - "is_standard_answer": 0 - }, - { - "answer_content": "在->再", - "is_standard_answer": 0 - }, - { - "answer_content": "岐->歧", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“白日依山尽,黄河入海流”是哪位诗人写的?", - "type": { - "person": "王之涣", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "王翰", - "is_standard_answer": 0 - }, - { - "answer_content": "李白", - "is_standard_answer": 0 - }, - { - "answer_content": "孟浩然", - "is_standard_answer": 0 - }, - { - "answer_content": "王之涣", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "与“身无彩凤双飞翼,心有灵犀一点通”出自同一首诗的是?", - "type": { - "person": "李商隐", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "昨夜星辰昨夜风", - "is_standard_answer": 1 - }, - { - "answer_content": "青鸟殷勤为探看", - "is_standard_answer": 0 - }, - { - "answer_content": "相见时难别亦难", - "is_standard_answer": 0 - }, - { - "answer_content": "碧海青天夜夜心", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“安得广厦千万间,大庇天下寒士俱欢颜!”是诗人在哪个季节写的?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "夏", - "is_standard_answer": 0 - }, - { - "answer_content": "春", - "is_standard_answer": 0 - }, - { - "answer_content": "秋", - "is_standard_answer": 1 - }, - { - "answer_content": "冬", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“莫道不消魂,帘卷西风,人比黄花瘦”作于什么节日?", - "type": { - "person": "李清照", - "type": "婉约", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "元宵节", - "is_standard_answer": 0 - }, - { - "answer_content": "重阳节", - "is_standard_answer": 1 - }, - { - "answer_content": "清明节", - "is_standard_answer": 0 - }, - { - "answer_content": "中秋节", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“云想衣裳花想容,春风拂槛露华浓”中李白用什么花来描写杨贵妃之美?", - "type": { - "person": "李白", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "荷花", - "is_standard_answer": 0 - }, - { - "answer_content": "牡丹", - "is_standard_answer": 1 - }, - { - "answer_content": "芍药", - "is_standard_answer": 0 - }, - { - "answer_content": "海棠", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“故人西辞黄鹤楼,烟花三月下扬州”,请问下列哪个代称不是扬州?", - "type": { - "person": "李白", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "江都", - "is_standard_answer": 0 - }, - { - "answer_content": "临安", - "is_standard_answer": 1 - }, - { - "answer_content": "维扬", - "is_standard_answer": 0 - }, - { - "answer_content": "广陵", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "人间“__”芳菲尽,山寺桃花始盛开", - "type": { - "person": "白居易", - "type": "春天", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "六月", - "is_standard_answer": 0 - }, - { - "answer_content": "三月", - "is_standard_answer": 0 - }, - { - "answer_content": "二月", - "is_standard_answer": 0 - }, - { - "answer_content": "四月", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "离离原上草,“________”", - "type": { - "person": "白居易", - "type": "春天", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "春风吹又生", - "is_standard_answer": 0 - }, - { - "answer_content": "萋萋满别情", - "is_standard_answer": 0 - }, - { - "answer_content": "晴翠接荒城", - "is_standard_answer": 0 - }, - { - "answer_content": "一岁一枯荣", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“________”,恨不相逢未嫁时", - "type": { - "person": "张籍", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "还君明珠双泪垂", - "is_standard_answer": 1 - }, - { - "answer_content": "公子王孙逐后尘", - "is_standard_answer": 0 - }, - { - "answer_content": "我生君未生", - "is_standard_answer": 0 - }, - { - "answer_content": "人间有味是清欢", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "大雨落幽燕,白浪滔天,“________”", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "初中", - "dynasty": "近现代" - }, - "option_answers": [ - { - "answer_content": "知向谁边", - "is_standard_answer": 0 - }, - { - "answer_content": "秦皇岛外打鱼船", - "is_standard_answer": 1 - }, - { - "answer_content": "一片汪洋都不见", - "is_standard_answer": 0 - }, - { - "answer_content": "无限江山", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“横看成岭侧成峰,远近高低各不同”描写的是哪座山?", - "type": { - "person": "苏轼", - "type": "自然", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "庐山", - "is_standard_answer": 1 - }, - { - "answer_content": "泰山", - "is_standard_answer": 0 - }, - { - "answer_content": "黄山", - "is_standard_answer": 0 - }, - { - "answer_content": "华山", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《望岳》中“岱宗夫如何?”描写的是哪座名山?", - "type": { - "person": "杜甫", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "泰山", - "is_standard_answer": 1 - }, - { - "answer_content": "华山", - "is_standard_answer": 0 - }, - { - "answer_content": "嵩山", - "is_standard_answer": 0 - }, - { - "answer_content": "黄山", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "与“天涯何处无芳草”出自同一首诗的是?", - "type": { - "person": "苏轼", - "type": "婉约", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "墙里秋千墙外道", - "is_standard_answer": 1 - }, - { - "answer_content": "山长水阔知何处", - "is_standard_answer": 0 - }, - { - "answer_content": "衣带渐宽终不悔", - "is_standard_answer": 0 - }, - { - "answer_content": "伫倚危楼风细细", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“不以物喜,不以己悲”出自范仲淹的什么作品?", - "type": { - "person": "范仲淹", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "游钓台记", - "is_standard_answer": 0 - }, - { - "answer_content": "岳阳楼记", - "is_standard_answer": 1 - }, - { - "answer_content": "小石潭记", - "is_standard_answer": 0 - }, - { - "answer_content": "醉翁亭记", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“只恐夜深花睡去,故烧高烛照红妆”,诗人是担心哪个花睡了?", - "type": { - "person": "苏轼", - "type": "自然", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "牡丹", - "is_standard_answer": 0 - }, - { - "answer_content": "芍药", - "is_standard_answer": 0 - }, - { - "answer_content": "海棠", - "is_standard_answer": 1 - }, - { - "answer_content": "荷花", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《甄嬛传》里安陵容唱的“小山重叠金明灭”中小山指的是什么?", - "type": { - "person": "温庭筠", - "type": "婉约", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "画", - "is_standard_answer": 0 - }, - { - "answer_content": "眉妆", - "is_standard_answer": 1 - }, - { - "answer_content": "小小的山", - "is_standard_answer": 0 - }, - { - "answer_content": "衣服", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "飞流直下三千尺,“____”银河落九天", - "type": { - "person": "李白", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "疑是", - "is_standard_answer": 1 - }, - { - "answer_content": "疑似", - "is_standard_answer": 0 - }, - { - "answer_content": "恰是", - "is_standard_answer": 0 - }, - { - "answer_content": "恰似", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,从此萧郎是路人", - "type": { - "person": "崔郊", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "侯门一入深似海", - "is_standard_answer": 0 - }, - { - "answer_content": "一入侯门深如海", - "is_standard_answer": 0 - }, - { - "answer_content": "一入侯门深似海", - "is_standard_answer": 0 - }, - { - "answer_content": "侯门一入深如海", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "小山重叠金明灭,“_________”", - "type": { - "person": "温庭筠", - "type": "婉约", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "绿杨陌上多离别", - "is_standard_answer": 0 - }, - { - "answer_content": "十二楼中月自明", - "is_standard_answer": 0 - }, - { - "answer_content": "鬓云欲度香腮雪", - "is_standard_answer": 1 - }, - { - "answer_content": "碧天如水夜云轻", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”西北望,射天狼", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "老夫聊发少年狂", - "is_standard_answer": 0 - }, - { - "answer_content": "十年生死两茫茫", - "is_standard_answer": 0 - }, - { - "answer_content": "为报倾城随太守", - "is_standard_answer": 0 - }, - { - "answer_content": "会挽雕弓如满月", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“功盖三分国,名成八阵图”说的是谁?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "诸葛亮", - "is_standard_answer": 1 - }, - { - "answer_content": "孙权", - "is_standard_answer": 0 - }, - { - "answer_content": "周瑜", - "is_standard_answer": 0 - }, - { - "answer_content": "曹操", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“两岸青山相对出,孤帆一片日边来”是诗人李白在什么地方看见的景色", - "type": { - "person": "李白", - "type": "江南", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "天门山", - "is_standard_answer": 1 - }, - { - "answer_content": "庐山", - "is_standard_answer": 0 - }, - { - "answer_content": "白帝城", - "is_standard_answer": 0 - }, - { - "answer_content": "泰山", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“千里莺啼绿映红,水村山郭酒旗风”出自杜牧的哪首诗?", - "type": { - "person": "杜牧", - "type": "江南", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "秋夕", - "is_standard_answer": 0 - }, - { - "answer_content": "江南春", - "is_standard_answer": 1 - }, - { - "answer_content": "清明", - "is_standard_answer": 0 - }, - { - "answer_content": "遣怀", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "岭南非常有名的荔枝“妃子笑”,这个名称和谁有关?", - "type": { - "person": "杜牧", - "type": "婉约", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "王昭君", - "is_standard_answer": 0 - }, - { - "answer_content": "赵飞燕", - "is_standard_answer": 0 - }, - { - "answer_content": "西施", - "is_standard_answer": 0 - }, - { - "answer_content": "杨玉环", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "因写了句“红杏枝头春意闹”而被称为“红杏尚书”的宋代诗人是谁?", - "type": { - "person": "宋祁", - "type": "婉约", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "秦观", - "is_standard_answer": 0 - }, - { - "answer_content": "宋祁", - "is_standard_answer": 1 - }, - { - "answer_content": "王安石", - "is_standard_answer": 0 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "汉乐府《江南》中鱼戏莲叶东下一句", - "type": { - "person": "苏轼", - "type": "江南", - "grade": "小学", - "dynasty": "汉朝" - }, - "option_answers": [ - { - "answer_content": "鱼戏莲叶西", - "is_standard_answer": 1 - }, - { - "answer_content": "鱼戏莲叶南", - "is_standard_answer": 0 - }, - { - "answer_content": "鱼戏莲叶中", - "is_standard_answer": 0 - }, - { - "answer_content": "鱼戏莲叶北", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "此情可待成追忆?“________”", - "type": { - "person": "李商隐", - "type": "婉约", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "只是当时已惘然", - "is_standard_answer": 1 - }, - { - "answer_content": "到处相逢是偶然", - "is_standard_answer": 0 - }, - { - "answer_content": "拔剑四顾心茫然", - "is_standard_answer": 0 - }, - { - "answer_content": "只有相思无尽处", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "桃花潭水深千尺,“________”", - "type": { - "person": "李白", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "春江水暖鸭先知", - "is_standard_answer": 0 - }, - { - "answer_content": "烟花三月下扬州", - "is_standard_answer": 0 - }, - { - "answer_content": "千里江陵一日还", - "is_standard_answer": 0 - }, - { - "answer_content": "不及汪伦送我情", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“冲天香阵透长安,满城尽带黄金甲”描写的是什么花?", - "type": { - "person": "黄巢", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "牡丹", - "is_standard_answer": 0 - }, - { - "answer_content": "芙蓉", - "is_standard_answer": 0 - }, - { - "answer_content": "菊花", - "is_standard_answer": 1 - }, - { - "answer_content": "桂花", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“执子之手,与子偕老”出自《诗经》,它最初指代的是什么感情?", - "type": { - "person": "李白", - "type": "豪放", - "grade": "高中", - "dynasty": "先秦" - }, - "option_answers": [ - { - "answer_content": "夫妻情", - "is_standard_answer": 0 - }, - { - "answer_content": "父母情", - "is_standard_answer": 0 - }, - { - "answer_content": "战友情", - "is_standard_answer": 1 - }, - { - "answer_content": "知己情", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“但愿人长久,千里共婵娟。”是诗人写给什么人的?", - "type": { - "person": "苏轼", - "type": "思乡", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "朋友", - "is_standard_answer": 0 - }, - { - "answer_content": "妻子", - "is_standard_answer": 0 - }, - { - "answer_content": "父母", - "is_standard_answer": 0 - }, - { - "answer_content": "兄弟", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“东风不与周郎便,铜雀春深锁二乔”中东风指的哪个历史典故?", - "type": { - "person": "杜牧", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "火烧赤壁", - "is_standard_answer": 1 - }, - { - "answer_content": "蒋干盗书", - "is_standard_answer": 0 - }, - { - "answer_content": "苦肉计", - "is_standard_answer": 0 - }, - { - "answer_content": "草船借箭", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“李白乘舟将欲行,忽闻岸上踏歌声”,唱歌的人当时的职业是什么?", - "type": { - "person": "李白", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "卸任在家", - "is_standard_answer": 1 - }, - { - "answer_content": "琴师", - "is_standard_answer": 0 - }, - { - "answer_content": "县令", - "is_standard_answer": 0 - }, - { - "answer_content": "幕僚", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "黄沙百战穿金甲,不破“___”终不还", - "type": { - "person": "王昌龄", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "匈奴", - "is_standard_answer": 0 - }, - { - "answer_content": "单于", - "is_standard_answer": 0 - }, - { - "answer_content": "龙城", - "is_standard_answer": 0 - }, - { - "answer_content": "楼兰", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "春宵一刻值千金,“________”", - "type": { - "person": "苏轼", - "type": "春天", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "从此君王不早朝", - "is_standard_answer": 0 - }, - { - "answer_content": "赌书消得泼茶香", - "is_standard_answer": 0 - }, - { - "answer_content": "花有清香月有阴", - "is_standard_answer": 1 - }, - { - "answer_content": "待晓堂前拜舅姑", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“__”回首,那人却在,灯火阑珊处。", - "type": { - "person": "辛弃疾 ", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "默然", - "is_standard_answer": 0 - }, - { - "answer_content": "蓦然", - "is_standard_answer": 1 - }, - { - "answer_content": "幕然", - "is_standard_answer": 0 - }, - { - "answer_content": "墓然", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,月是故乡明", - "type": { - "person": "杜甫", - "type": "思乡", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "人是故乡亲", - "is_standard_answer": 0 - }, - { - "answer_content": "小时不识月", - "is_standard_answer": 0 - }, - { - "answer_content": "对此空长吟", - "is_standard_answer": 0 - }, - { - "answer_content": "露从今夜白", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“清风徐来,水波不兴”描写的是什么地方的景色?", - "type": { - "person": "苏轼", - "type": "自然", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "赤壁", - "is_standard_answer": 1 - }, - { - "answer_content": "西湖", - "is_standard_answer": 0 - }, - { - "answer_content": "秦淮河", - "is_standard_answer": 0 - }, - { - "answer_content": "醉翁亭", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“朱雀桥边野草花,乌衣巷口夕阳斜”,乌衣巷在哪个城市?", - "type": { - "person": "刘禹锡", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "苏州", - "is_standard_answer": 0 - }, - { - "answer_content": "杭州", - "is_standard_answer": 0 - }, - { - "answer_content": "西安", - "is_standard_answer": 0 - }, - { - "answer_content": "南京", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“知章骑马似乘船,眼花落井水底眠”说的是谁?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "王维", - "is_standard_answer": 0 - }, - { - "answer_content": "贺知章", - "is_standard_answer": 1 - }, - { - "answer_content": "杜甫", - "is_standard_answer": 0 - }, - { - "answer_content": "李白", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《蜀道难》的最后一句?", - "type": { - "person": "李白", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "侧身西望常咨嗟", - "is_standard_answer": 1 - }, - { - "answer_content": "难于上青天", - "is_standard_answer": 0 - }, - { - "answer_content": "嗟尔远道之人胡为乎来哉", - "is_standard_answer": 0 - }, - { - "answer_content": "不如早还家", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“商女不知亡国恨,隔江犹唱后庭花”,《后庭花》是谁写的?", - "type": { - "person": "杜牧 ", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "李隆基", - "is_standard_answer": 0 - }, - { - "answer_content": "陈叔宝", - "is_standard_answer": 1 - }, - { - "answer_content": "李煜", - "is_standard_answer": 0 - }, - { - "answer_content": "杨玉环", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "对名妓薛涛始乱终弃,写出“曾经沧海难为水,除却巫山不是云”的诗人是谁?", - "type": { - "person": "元稹", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "元稹", - "is_standard_answer": 1 - }, - { - "answer_content": "刘禹锡", - "is_standard_answer": 0 - }, - { - "answer_content": "李商隐", - "is_standard_answer": 0 - }, - { - "answer_content": "李贺", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "明月出天山,“________”", - "type": { - "person": "李白", - "type": "自然", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "时鸣春涧中", - "is_standard_answer": 0 - }, - { - "answer_content": "清泉石上流", - "is_standard_answer": 0 - }, - { - "answer_content": "呼作白玉盘", - "is_standard_answer": 0 - }, - { - "answer_content": "苍茫云海间", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“惜秦皇汉武,略输文采;唐宗宋祖,稍逊风骚”,秦皇汉武分别指的是谁?", - "type": { - "person": "毛泽东", - "type": "豪放", - "grade": "初中", - "dynasty": "近代" - }, - "option_answers": [ - { - "answer_content": "扶苏、刘秀", - "is_standard_answer": 0 - }, - { - "answer_content": "嬴政、刘彻", - "is_standard_answer": 1 - }, - { - "answer_content": "胡亥、刘备", - "is_standard_answer": 0 - }, - { - "answer_content": "嬴政、刘邦", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "苏轼在《江城子密州出猎》中,左手右手控制的分别是什么动物?", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "狼、鹰", - "is_standard_answer": 0 - }, - { - "answer_content": "狗、鹰", - "is_standard_answer": 1 - }, - { - "answer_content": "马、鹰", - "is_standard_answer": 0 - }, - { - "answer_content": "马、羊", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "哪句诗与《滕王阁序》出自同一位诗人?", - "type": { - "person": "王勃", - "type": "友情", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "愿君多采撷,此物最相思", - "is_standard_answer": 0 - }, - { - "answer_content": "离离原上草,一岁一枯荣", - "is_standard_answer": 0 - }, - { - "answer_content": "春眠不觉晓,处处闻啼鸟", - "is_standard_answer": 0 - }, - { - "answer_content": "海内存知己,天涯若比邻", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "象征陆游和唐婉爱情的那首《钗头凤·红酥手》最初被诗人题在了哪里?", - "type": { - "person": "陆游", - "type": "婉约", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "画上", - "is_standard_answer": 0 - }, - { - "answer_content": "墙上", - "is_standard_answer": 1 - }, - { - "answer_content": "扇子上", - "is_standard_answer": 0 - }, - { - "answer_content": "手帕上", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“丞相祠堂何处寻,锦官城外柏森森”,锦官城指的是哪里?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "成都", - "is_standard_answer": 1 - }, - { - "answer_content": "长安", - "is_standard_answer": 0 - }, - { - "answer_content": "金陵", - "is_standard_answer": 0 - }, - { - "answer_content": "汉中", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“谁家玉笛暗飞声,散入春风满洛城”,洛城指的是哪里?", - "type": { - "person": "李白", - "type": "春天", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "金陵", - "is_standard_answer": 0 - }, - { - "answer_content": "洛阳", - "is_standard_answer": 1 - }, - { - "answer_content": "长安", - "is_standard_answer": 0 - }, - { - "answer_content": "开封", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,多少楼台烟雨中", - "type": { - "person": "杜牧", - "type": "江南", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "南朝四百八十寺", - "is_standard_answer": 1 - }, - { - "answer_content": "南朝三百八十寺", - "is_standard_answer": 0 - }, - { - "answer_content": "南朝八百八十寺", - "is_standard_answer": 0 - }, - { - "answer_content": "南朝四百四十寺", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "鸟宿池边树,僧“__”月下门", - "type": { - "person": "贾岛", - "type": "自然", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "敲", - "is_standard_answer": 1 - }, - { - "answer_content": "推", - "is_standard_answer": 0 - }, - { - "answer_content": "关", - "is_standard_answer": 0 - }, - { - "answer_content": "翻", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "山不在高,有“___”则名", - "type": { - "person": "刘禹锡 ", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "灵", - "is_standard_answer": 0 - }, - { - "answer_content": "汝", - "is_standard_answer": 0 - }, - { - "answer_content": "龙", - "is_standard_answer": 0 - }, - { - "answer_content": "仙", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "醉卧沙场君莫笑,“________”", - "type": { - "person": "王翰", - "type": "豪放", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "万里长征人未还", - "is_standard_answer": 0 - }, - { - "answer_content": "梦回吹角连营", - "is_standard_answer": 0 - }, - { - "answer_content": "欲饮琵琶马上催", - "is_standard_answer": 0 - }, - { - "answer_content": "古来征战几人回", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“晴空一鹤排云上,便引诗情到碧霄”描写的是什么季节?", - "type": { - "person": "刘禹锡", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "冬", - "is_standard_answer": 0 - }, - { - "answer_content": "夏", - "is_standard_answer": 0 - }, - { - "answer_content": "秋", - "is_standard_answer": 1 - }, - { - "answer_content": "春", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“相貌丑陋却才华横溢,拒绝徒弟追求,被称作花间词派鼻祖”的是谁?", - "type": { - "person": "温庭筠", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "温庭筠", - "is_standard_answer": 1 - }, - { - "answer_content": "元稹", - "is_standard_answer": 0 - }, - { - "answer_content": "李贺", - "is_standard_answer": 0 - }, - { - "answer_content": "李煜", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“秦楼月,年年柳色,霸陵伤别”中霸陵是是的陵墓?", - "type": { - "person": "李白", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "汉武帝", - "is_standard_answer": 0 - }, - { - "answer_content": "唐玄宗", - "is_standard_answer": 0 - }, - { - "answer_content": "唐太宗", - "is_standard_answer": 0 - }, - { - "answer_content": "汉文帝", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "人生得意须尽欢,“__________”", - "type": { - "person": "李白", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "抽刀断水水更流", - "is_standard_answer": 0 - }, - { - "answer_content": "莫使金樽空对月", - "is_standard_answer": 1 - }, - { - "answer_content": "会须一饮三百杯", - "is_standard_answer": 0 - }, - { - "answer_content": "拔剑四顾心茫然", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "欲把西湖比西子,“________”", - "type": { - "person": "苏轼", - "type": "江南", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "拄杖无时夜叩门", - "is_standard_answer": 0 - }, - { - "answer_content": "山色空蒙雨亦奇", - "is_standard_answer": 0 - }, - { - "answer_content": "淡妆浓抹总相宜", - "is_standard_answer": 1 - }, - { - "answer_content": "门前流水尚能西", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,万水千山只等闲", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "小学", - "dynasty": "近现代" - }, - "option_answers": [ - { - "answer_content": "江山如此多娇", - "is_standard_answer": 0 - }, - { - "answer_content": "红军不怕远征难", - "is_standard_answer": 1 - }, - { - "answer_content": "恰同学少年", - "is_standard_answer": 0 - }, - { - "answer_content": "红军不胃远征难", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "八月湖水平,“________”", - "type": { - "person": "孟浩然", - "type": "友情", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "端居耻圣明", - "is_standard_answer": 0 - }, - { - "answer_content": "清泉石上流", - "is_standard_answer": 0 - }, - { - "answer_content": "涵虚混太清", - "is_standard_answer": 1 - }, - { - "answer_content": "波撼岳阳城", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“松下问童子,言师采药去”,请问是谁在问童子?", - "type": { - "person": "贾岛", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "贺知章", - "is_standard_answer": 0 - }, - { - "answer_content": "松下", - "is_standard_answer": 0 - }, - { - "answer_content": "李贺", - "is_standard_answer": 0 - }, - { - "answer_content": "贾岛", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“青青子衿,悠悠我心”最初出自哪里?", - "type": { - "person": "曹操", - "type": "豪放", - "grade": "高中", - "dynasty": "魏晋" - }, - "option_answers": [ - { - "answer_content": "刘邦", - "is_standard_answer": 0 - }, - { - "answer_content": "短歌行", - "is_standard_answer": 0 - }, - { - "answer_content": "孔雀东南飞", - "is_standard_answer": 0 - }, - { - "answer_content": "诗经", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "撩乱边愁听不尽,“________”", - "type": { - "person": "王昌龄", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "总是关山旧别情", - "is_standard_answer": 0 - }, - { - "answer_content": "孤城遥望玉门关", - "is_standard_answer": 0 - }, - { - "answer_content": "高高秋月照长城", - "is_standard_answer": 1 - }, - { - "answer_content": "山北山南总是烽", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,千里江陵一日还", - "type": { - "person": "李白", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "两岸猿声啼不住", - "is_standard_answer": 0 - }, - { - "answer_content": "朝辞白帝彩云间", - "is_standard_answer": 1 - }, - { - "answer_content": "黄河远上白云间", - "is_standard_answer": 0 - }, - { - "answer_content": "孤帆远影碧空尽", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "山重水复疑无路,“________”", - "type": { - "person": "陆游", - "type": "田园", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "病树前头万木春", - "is_standard_answer": 0 - }, - { - "answer_content": "柳暗花明又一村", - "is_standard_answer": 1 - }, - { - "answer_content": "千里江陵一日还", - "is_standard_answer": 0 - }, - { - "answer_content": "拄杖无时夜叩门", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "木欣欣以向荣,“_________”", - "type": { - "person": "陶渊明", - "type": "田园", - "grade": "高中", - "dynasty": "魏晋" - }, - "option_answers": [ - { - "answer_content": "泉涓涓而始流", - "is_standard_answer": 1 - }, - { - "answer_content": "人代代以不息", - "is_standard_answer": 0 - }, - { - "answer_content": "海滔滔以不竭", - "is_standard_answer": 0 - }, - { - "answer_content": "草生生以不息", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "张继那首有名的《枫桥夜泊》中,听到寒山寺的钟声,寒山寺在哪个城市?", - "type": { - "person": "张继", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "杭州", - "is_standard_answer": 0 - }, - { - "answer_content": "扬州", - "is_standard_answer": 0 - }, - { - "answer_content": "苏州", - "is_standard_answer": 1 - }, - { - "answer_content": "临安", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《琵琶行》中,琵琶女告诉白居易她是京城女,请问她住在哪里?", - "type": { - "person": "白居易", - "type": "友情", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "回龙观", - "is_standard_answer": 0 - }, - { - "answer_content": "蘑菇屯", - "is_standard_answer": 0 - }, - { - "answer_content": "蛤蟆陵", - "is_standard_answer": 1 - }, - { - "answer_content": "门头沟", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "写下“两情若是久长时,又岂在朝朝暮暮”,被称作“山抹微云君”的诗人是?", - "type": { - "person": "秦观 ", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "柳永", - "is_standard_answer": 0 - }, - { - "answer_content": "黄庭坚", - "is_standard_answer": 0 - }, - { - "answer_content": "秦观", - "is_standard_answer": 1 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "苏轼的《惠崇江晚景》描写的是一副鸭戏图,你知道这首诗被题在什么地方么?", - "type": { - "person": "苏轼", - "type": "春天", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "画上", - "is_standard_answer": 1 - }, - { - "answer_content": "扇子上", - "is_standard_answer": 0 - }, - { - "answer_content": "墙上", - "is_standard_answer": 0 - }, - { - "answer_content": "手帕上", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“西出阳关无故人”,阳关在哪个省?", - "type": { - "person": "王维", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "西藏", - "is_standard_answer": 0 - }, - { - "answer_content": "内蒙", - "is_standard_answer": 0 - }, - { - "answer_content": "甘肃", - "is_standard_answer": 1 - }, - { - "answer_content": "新疆", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "花径不曾缘客扫,“________”", - "type": { - "person": "杜甫", - "type": "友情", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "两山排闼送青来", - "is_standard_answer": 0 - }, - { - "answer_content": "但见群鸥日日来", - "is_standard_answer": 0 - }, - { - "answer_content": "蓬门今始为君开", - "is_standard_answer": 1 - }, - { - "answer_content": "樽酒家贫只旧醅", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "宁为百夫长,“________”", - "type": { - "person": "杨炯", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "胜作一书生", - "is_standard_answer": 1 - }, - { - "answer_content": "将军夜引弓", - "is_standard_answer": 0 - }, - { - "answer_content": "单于夜遁逃", - "is_standard_answer": 0 - }, - { - "answer_content": "心中自不平", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "竹外桃花三两枝,春江水暖“__”先知", - "type": { - "person": "苏轼", - "type": "春天", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "鸡", - "is_standard_answer": 0 - }, - { - "answer_content": "鸭", - "is_standard_answer": 1 - }, - { - "answer_content": "鸟", - "is_standard_answer": 0 - }, - { - "answer_content": "羊", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《兰亭集序》的作者是?", - "type": { - "person": "王羲之", - "type": "友情", - "grade": "高中", - "dynasty": "魏晋" - }, - "option_answers": [ - { - "answer_content": "王羲之", - "is_standard_answer": 1 - }, - { - "answer_content": "刘桢", - "is_standard_answer": 0 - }, - { - "answer_content": "陶渊明", - "is_standard_answer": 0 - }, - { - "answer_content": "陈寿", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“今人不见古时月,今月曾经照古人”是谁写的?", - "type": { - "person": "李白", - "type": "自然", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "孟浩然", - "is_standard_answer": 0 - }, - { - "answer_content": "李白", - "is_standard_answer": 1 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - }, - { - "answer_content": "王勃", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“此地别燕丹,壮士发冲冠”描写的是哪个历史事件?", - "type": { - "person": "骆宾王", - "type": "豪放", - "grade": "课外 ", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "赤壁之战", - "is_standard_answer": 0 - }, - { - "answer_content": "荆轲刺秦", - "is_standard_answer": 1 - }, - { - "answer_content": "巨鹿之战", - "is_standard_answer": 0 - }, - { - "answer_content": "屈原沉江", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“孤篇压全唐”是对哪首诗的评价?", - "type": { - "person": "张若虚", - "type": "春天", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "枫桥夜泊", - "is_standard_answer": 0 - }, - { - "answer_content": "春江花月夜", - "is_standard_answer": 1 - }, - { - "answer_content": "长恨歌", - "is_standard_answer": 0 - }, - { - "answer_content": "将进酒", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“暖风熏得游人醉,直把杭州作汴州”,杭州和汴州分别又叫做什么?", - "type": { - "person": "林升", - "type": "江南", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "姑苏、开封", - "is_standard_answer": 0 - }, - { - "answer_content": "临安、开封", - "is_standard_answer": 1 - }, - { - "answer_content": "临安、洛阳", - "is_standard_answer": 0 - }, - { - "answer_content": "姑苏、洛阳", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "王安石在春节时写的“爆竹声中一岁除,春风送暖入屠苏”中屠苏指的是什么?", - "type": { - "person": "王安石", - "type": "思乡", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "酒", - "is_standard_answer": 1 - }, - { - "answer_content": "祥瑞", - "is_standard_answer": 0 - }, - { - "answer_content": "茶", - "is_standard_answer": 0 - }, - { - "answer_content": "院子", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "此曲只应天上有,人间“__”几回闻", - "type": { - "person": "杜甫", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "哪得", - "is_standard_answer": 0 - }, - { - "answer_content": "只得", - "is_standard_answer": 0 - }, - { - "answer_content": "能得", - "is_standard_answer": 1 - }, - { - "answer_content": "值得", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "王维的“独在异乡为异客,每逢佳节倍思亲”,佳节指的是什么节日?", - "type": { - "person": "王维", - "type": "思乡", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "重阳节", - "is_standard_answer": 1 - }, - { - "answer_content": "端午节", - "is_standard_answer": 0 - }, - { - "answer_content": "元宵节", - "is_standard_answer": 0 - }, - { - "answer_content": "中秋节", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“斜阳草树,寻常巷陌,人道寄奴曾住”,寄奴和元嘉是什么关系?", - "type": { - "person": "辛弃疾", - "type": "豪放", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "友人", - "is_standard_answer": 0 - }, - { - "answer_content": "父子", - "is_standard_answer": 1 - }, - { - "answer_content": "兄弟", - "is_standard_answer": 0 - }, - { - "answer_content": "祖孙", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "洞房昨夜停红烛,“________”", - "type": { - "person": "朱庆馀", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "先遣小姑尝", - "is_standard_answer": 0 - }, - { - "answer_content": "妆罢低声问夫婿", - "is_standard_answer": 0 - }, - { - "answer_content": "春宵一刻值千金", - "is_standard_answer": 0 - }, - { - "answer_content": "待晓堂前拜舅姑", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "沉舟侧畔千帆过,“________”", - "type": { - "person": "刘禹锡", - "type": "友情", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "潦倒新停浊酒怀", - "is_standard_answer": 0 - }, - { - "answer_content": "西出阳关无故人", - "is_standard_answer": 0 - }, - { - "answer_content": "病树前头万木春", - "is_standard_answer": 1 - }, - { - "answer_content": "到乡翻似烂柯人", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“葡萄美酒夜光杯,欲饮琵琶马上催”是哪位诗人写的?", - "type": { - "person": "王翰", - "type": "豪放", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "李贺", - "is_standard_answer": 0 - }, - { - "answer_content": "王翰", - "is_standard_answer": 1 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - }, - { - "answer_content": "李白", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“鹅鹅鹅,曲项向天歌”是诗人几岁时写的?", - "type": { - "person": "骆宾王", - "type": "田园", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "7", - "is_standard_answer": 1 - }, - { - "answer_content": "5", - "is_standard_answer": 0 - }, - { - "answer_content": "3", - "is_standard_answer": 0 - }, - { - "answer_content": "16", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "白居易的《长恨歌》最后一句?", - "type": { - "person": "白居易", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "此恨绵绵无绝期", - "is_standard_answer": 1 - }, - { - "answer_content": "一别音容两渺茫", - "is_standard_answer": 0 - }, - { - "answer_content": "夜半无人私语时", - "is_standard_answer": 0 - }, - { - "answer_content": "在地愿为连理枝", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“莫笑农家腊酒浑,丰年留客足鸡豚”中豚指的是什么?", - "type": { - "person": "陆游", - "type": "自然", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "河豚", - "is_standard_answer": 0 - }, - { - "answer_content": "海豚", - "is_standard_answer": 0 - }, - { - "answer_content": "鸡肉", - "is_standard_answer": 0 - }, - { - "answer_content": "猪肉", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "三杯两盏淡酒,“________”", - "type": { - "person": "李清照", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "如今有谁堪摘", - "is_standard_answer": 0 - }, - { - "answer_content": "怎一个愁字了得", - "is_standard_answer": 0 - }, - { - "answer_content": "怎敌他晚来风急", - "is_standard_answer": 1 - }, - { - "answer_content": "雁过也", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“凤箫声动,玉壶光转,一夜鱼龙舞”描写的是什么节日?", - "type": { - "person": "辛弃疾 ", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "七夕", - "is_standard_answer": 0 - }, - { - "answer_content": "除夕", - "is_standard_answer": 0 - }, - { - "answer_content": "中秋", - "is_standard_answer": 0 - }, - { - "answer_content": "元夕", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“天阶夜色凉如水,坐看牵牛织女星”描写的是哪个季节?", - "type": { - "person": "杜牧", - "type": "自然", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "夏", - "is_standard_answer": 0 - }, - { - "answer_content": "冬", - "is_standard_answer": 0 - }, - { - "answer_content": "秋", - "is_standard_answer": 1 - }, - { - "answer_content": "春", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "白居易说“江南好,风景旧曾谙”,你知道白居易最忆的是江南哪里么?", - "type": { - "person": "白居易", - "type": "江南", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "杭州", - "is_standard_answer": 1 - }, - { - "answer_content": "姑苏", - "is_standard_answer": 0 - }, - { - "answer_content": "吴宫", - "is_standard_answer": 0 - }, - { - "answer_content": "扬州", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“借问汉宫谁得似,可怜飞燕倚新妆”,这个和赵飞燕相似的女子是谁?", - "type": { - "person": "李白", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "王昭君", - "is_standard_answer": 0 - }, - { - "answer_content": "杨玉环", - "is_standard_answer": 1 - }, - { - "answer_content": "班婕妤", - "is_standard_answer": 0 - }, - { - "answer_content": "貂蝉", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "漠漠水田飞白鹭,“________”", - "type": { - "person": "王维", - "type": "田园", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "两山排闼送青来", - "is_standard_answer": 0 - }, - { - "answer_content": "桃花流水鳜鱼肥", - "is_standard_answer": 0 - }, - { - "answer_content": "两个黄鹂鸣翠柳", - "is_standard_answer": 0 - }, - { - "answer_content": "阴阴夏木啭黄鹂", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "黄河远上白云间,“________”", - "type": { - "person": "王之涣", - "type": "豪放", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "将登太行雪满山", - "is_standard_answer": 0 - }, - { - "answer_content": "一片孤城万仞山", - "is_standard_answer": 1 - }, - { - "answer_content": "千里江陵一日还", - "is_standard_answer": 0 - }, - { - "answer_content": "春风不度玉门关", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "与《孔雀东南飞》并称“乐府双璧”的是?", - "type": { - "person": "李白", - "type": "豪放", - "grade": "初中", - "dynasty": "南北朝" - }, - "option_answers": [ - { - "answer_content": "蒹葭", - "is_standard_answer": 0 - }, - { - "answer_content": "木兰辞", - "is_standard_answer": 1 - }, - { - "answer_content": "长歌行", - "is_standard_answer": 0 - }, - { - "answer_content": "离骚", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“绿杨阴里白沙堤”、“苏堤春晓”都是西湖美景,白堤、苏堤哪个修建的更早?", - "type": { - "person": "白居易", - "type": "江南", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "无记载", - "is_standard_answer": 0 - }, - { - "answer_content": "苏堤", - "is_standard_answer": 0 - }, - { - "answer_content": "白堤", - "is_standard_answer": 1 - }, - { - "answer_content": "同时", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "杜甫的“正是江南好风景,落花时节又逢君”中,这个君的职业是什么?", - "type": { - "person": "杜甫", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "官员", - "is_standard_answer": 0 - }, - { - "answer_content": "秀才", - "is_standard_answer": 0 - }, - { - "answer_content": "乐师", - "is_standard_answer": 1 - }, - { - "answer_content": "农夫", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "天生丽质难自弃,“________”", - "type": { - "person": "白居易", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "一朝选在君王侧", - "is_standard_answer": 1 - }, - { - "answer_content": "始是新承恩泽时", - "is_standard_answer": 0 - }, - { - "answer_content": "养在深闺人未识", - "is_standard_answer": 0 - }, - { - "answer_content": "六宫粉黛无颜色", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "不识庐山真面目,“________”", - "type": { - "person": "苏轼", - "type": "自然", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "只因身在最高层", - "is_standard_answer": 0 - }, - { - "answer_content": "只因身在此山中", - "is_standard_answer": 0 - }, - { - "answer_content": "只缘身在最高层", - "is_standard_answer": 0 - }, - { - "answer_content": "只缘身在此山中", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“碧玉妆成一树高,万条缍下绿丝绦”,哪个字是错的", - "type": { - "person": "贺知章", - "type": "春天", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "缍->垂", - "is_standard_answer": 1 - }, - { - "answer_content": "绦->綯", - "is_standard_answer": 0 - }, - { - "answer_content": "高->蒿", - "is_standard_answer": 0 - }, - { - "answer_content": "妆->庄", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“_________”,长使英雄泪满襟。", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "出师未捷身先死", - "is_standard_answer": 1 - }, - { - "answer_content": "提携玉龙为君死", - "is_standard_answer": 0 - }, - { - "answer_content": "一将功成万骨枯", - "is_standard_answer": 0 - }, - { - "answer_content": "风萧萧兮易水寒", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "范仲淹在《江上渔者》中写到最爱什么鱼?", - "type": { - "person": "范仲淹", - "type": "田园", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "鳜鱼", - "is_standard_answer": 0 - }, - { - "answer_content": "鲈鱼", - "is_standard_answer": 1 - }, - { - "answer_content": "鲤鱼", - "is_standard_answer": 0 - }, - { - "answer_content": "草鱼", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "天下才有一石,谁占了八斗?", - "type": { - "person": "谢灵运", - "type": "豪放", - "grade": "课外", - "dynasty": "晋朝" - }, - "option_answers": [ - { - "answer_content": "曹植", - "is_standard_answer": 1 - }, - { - "answer_content": "谢灵运", - "is_standard_answer": 0 - }, - { - "answer_content": "曹丕", - "is_standard_answer": 0 - }, - { - "answer_content": "李白", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“群山万壑赴荆门,生长明妃尚有村”,明妃指的是?", - "type": { - "person": "杜甫", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "杨玉环", - "is_standard_answer": 0 - }, - { - "answer_content": "赵飞燕", - "is_standard_answer": 0 - }, - { - "answer_content": "王昭君", - "is_standard_answer": 1 - }, - { - "answer_content": "文成公主", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "旧时王谢堂前燕,“_________”", - "type": { - "person": "刘禹锡", - "type": "豪放", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "飞来飞去落谁家", - "is_standard_answer": 0 - }, - { - "answer_content": "更深月色半人家", - "is_standard_answer": 0 - }, - { - "answer_content": "蓬门今始为君开", - "is_standard_answer": 0 - }, - { - "answer_content": "飞入寻常百姓家", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "春眠不觉晓,“________”", - "type": { - "person": "孟浩然", - "type": "春天", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "处处闻啼鸟", - "is_standard_answer": 1 - }, - { - "answer_content": "花落知多少", - "is_standard_answer": 0 - }, - { - "answer_content": "处处蚊子咬", - "is_standard_answer": 0 - }, - { - "answer_content": "润物细无声", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“滚滚长江东逝水,浪花淘尽英雄”最初出自哪里?", - "type": { - "person": "杨慎", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "红楼梦", - "is_standard_answer": 0 - }, - { - "answer_content": "三国演义", - "is_standard_answer": 0 - }, - { - "answer_content": "临江仙·滚滚长江东逝水", - "is_standard_answer": 1 - }, - { - "answer_content": "水浒传", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“昔年有狂客,号尔谪仙人”是在说谁?", - "type": { - "person": "杜甫", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "孟浩然", - "is_standard_answer": 0 - }, - { - "answer_content": "白居易", - "is_standard_answer": 0 - }, - { - "answer_content": "李白", - "is_standard_answer": 1 - }, - { - "answer_content": "杜甫", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“但使龙城飞将在,不教胡马度阴山”中飞将指的是谁?", - "type": { - "person": "王昌龄", - "type": "豪放", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "卫青", - "is_standard_answer": 0 - }, - { - "answer_content": "周亚夫", - "is_standard_answer": 0 - }, - { - "answer_content": "霍去病", - "is_standard_answer": 0 - }, - { - "answer_content": "李广", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“________”,时鸣春涧中", - "type": { - "person": "王维", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "空山新雨后", - "is_standard_answer": 0 - }, - { - "answer_content": "夜静春山空", - "is_standard_answer": 0 - }, - { - "answer_content": "明月松间照", - "is_standard_answer": 0 - }, - { - "answer_content": "月出惊山鸟", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "海内存知己,“________”", - "type": { - "person": "王勃", - "type": "友情", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "竟夕起相思", - "is_standard_answer": 0 - }, - { - "answer_content": "天涯若比邻", - "is_standard_answer": 1 - }, - { - "answer_content": "天涯共此时", - "is_standard_answer": 0 - }, - { - "answer_content": "儿女共沾巾", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "一水护田将绿绕,“__”排闼送青来", - "type": { - "person": "王安石", - "type": "田园", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "两岸", - "is_standard_answer": 0 - }, - { - "answer_content": "千山", - "is_standard_answer": 0 - }, - { - "answer_content": "两山", - "is_standard_answer": 1 - }, - { - "answer_content": "一山", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "绿树村边合,“________”", - "type": { - "person": "孟浩然", - "type": "田园", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "把酒话桑麻", - "is_standard_answer": 0 - }, - { - "answer_content": "还来就菊花", - "is_standard_answer": 0 - }, - { - "answer_content": "结庐在人境", - "is_standard_answer": 0 - }, - { - "answer_content": "青山郭外斜", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "《扬州慢》中“纵豆蔻词工,青楼梦好,难赋深情”,与哪位诗人有关?", - "type": { - "person": "姜夔 ", - "type": "婉约", - "grade": "高中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "李清照", - "is_standard_answer": 0 - }, - { - "answer_content": "杜牧", - "is_standard_answer": 1 - }, - { - "answer_content": "李煜", - "is_standard_answer": 0 - }, - { - "answer_content": "柳永", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“__”一片月,万户捣衣声", - "type": { - "person": "李白", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "天上", - "is_standard_answer": 0 - }, - { - "answer_content": "杭州", - "is_standard_answer": 0 - }, - { - "answer_content": "长安", - "is_standard_answer": 1 - }, - { - "answer_content": "人间", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "关关雎鸠,在河之洲。窈窕淑女,君子“__”。", - "type": { - "person": "李白", - "type": "婉约", - "grade": "初中", - "dynasty": "先秦" - }, - "option_answers": [ - { - "answer_content": "好逑", - "is_standard_answer": 1 - }, - { - "answer_content": "好求", - "is_standard_answer": 0 - }, - { - "answer_content": "好浗", - "is_standard_answer": 0 - }, - { - "answer_content": "好仇", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“马作的卢飞快”中的卢是有名的快马,请问三国时“的卢救主”的故事里救的是谁?", - "type": { - "person": "辛弃疾", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "孙权", - "is_standard_answer": 0 - }, - { - "answer_content": "赵云", - "is_standard_answer": 0 - }, - { - "answer_content": "刘备", - "is_standard_answer": 1 - }, - { - "answer_content": "曹操", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "王维观猎时写到“忽过新丰市,还归细柳营”,细柳营是谁屯兵的地方?", - "type": { - "person": "王维", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "霍去病", - "is_standard_answer": 0 - }, - { - "answer_content": "卫青", - "is_standard_answer": 0 - }, - { - "answer_content": "周亚夫", - "is_standard_answer": 1 - }, - { - "answer_content": "李广", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“________”,山雨欲来风满楼", - "type": { - "person": "许浑", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "溪云初起日沉阁", - "is_standard_answer": 1 - }, - { - "answer_content": "行人莫问当年事", - "is_standard_answer": 0 - }, - { - "answer_content": "黑云压城城欲摧", - "is_standard_answer": 0 - }, - { - "answer_content": "山外青山楼外楼", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "《赋得古原草送别》全诗一共几句?", - "type": { - "person": "白居易", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "12", - "is_standard_answer": 0 - }, - { - "answer_content": "4", - "is_standard_answer": 0 - }, - { - "answer_content": "8", - "is_standard_answer": 1 - }, - { - "answer_content": "6", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“问世间,情为何物,直教生死相许”是谁写的?", - "type": { - "person": "元好问", - "type": "婉约", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "元好问", - "is_standard_answer": 1 - }, - { - "answer_content": "金庸", - "is_standard_answer": 0 - }, - { - "answer_content": "李莫愁", - "is_standard_answer": 0 - }, - { - "answer_content": "古龙", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "\"________\",西出阳关无故人", - "type": { - "person": "王维", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "莫愁前路无知己", - "is_standard_answer": 0 - }, - { - "answer_content": "劝君更饮一杯酒", - "is_standard_answer": 0 - }, - { - "answer_content": "渭城朝雨浥轻尘", - "is_standard_answer": 0 - }, - { - "answer_content": "劝君更尽一杯酒", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“洞房昨夜停红烛”这句诗是写给谁的?", - "type": { - "person": "朱庆馀", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "张籍", - "is_standard_answer": 1 - }, - { - "answer_content": "妻子", - "is_standard_answer": 0 - }, - { - "answer_content": "考官", - "is_standard_answer": 0 - }, - { - "answer_content": "丈夫", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "曹操的《短歌行》中写到“周公吐哺天下归心”,周公是谁?", - "type": { - "person": "曹操", - "type": "豪放", - "grade": "高中", - "dynasty": "魏晋" - }, - "option_answers": [ - { - "answer_content": "周公旦", - "is_standard_answer": 1 - }, - { - "answer_content": "刘备", - "is_standard_answer": 0 - }, - { - "answer_content": "刘邦", - "is_standard_answer": 0 - }, - { - "answer_content": "曹操", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "辛弃疾的《清平乐·村居》中,小儿在做什么?", - "type": { - "person": "辛弃疾", - "type": "田园", - "grade": "小学", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "钓鱼", - "is_standard_answer": 0 - }, - { - "answer_content": "除豆", - "is_standard_answer": 0 - }, - { - "answer_content": "剥莲蓬", - "is_standard_answer": 1 - }, - { - "answer_content": "织鸡笼", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“凤兮凤兮归故乡,遨游四海求其凰”是谁写的?", - "type": { - "person": "苏轼", - "type": "豪放", - "grade": "课外", - "dynasty": "汉朝" - }, - "option_answers": [ - { - "answer_content": "刘备", - "is_standard_answer": 0 - }, - { - "answer_content": "李白", - "is_standard_answer": 0 - }, - { - "answer_content": "司马相如", - "is_standard_answer": 1 - }, - { - "answer_content": "诸葛亮", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "传说因为公主和李白成为情敌而不相往来,被称作诗佛的人是谁?", - "type": { - "person": "王维", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "王维", - "is_standard_answer": 1 - }, - { - "answer_content": "孟浩然", - "is_standard_answer": 0 - }, - { - "answer_content": "白居易", - "is_standard_answer": 0 - }, - { - "answer_content": "李贺", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "人生若只如初见,“________”", - "type": { - "person": "纳兰性德", - "type": "婉约", - "grade": "课外", - "dynasty": "清朝" - }, - "option_answers": [ - { - "answer_content": "何事秋风悲画扇", - "is_standard_answer": 1 - }, - { - "answer_content": "比翼连枝当日愿", - "is_standard_answer": 0 - }, - { - "answer_content": "何如薄幸锦衣郎", - "is_standard_answer": 0 - }, - { - "answer_content": "只道当时是寻常", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "曲径通幽处,“_________”", - "type": { - "person": "常建 ", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "禅房花木深", - "is_standard_answer": 1 - }, - { - "answer_content": "红衣浅复深", - "is_standard_answer": 0 - }, - { - "answer_content": "城春草木深", - "is_standard_answer": 0 - }, - { - "answer_content": "恨别鸟惊心", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“二十四桥明月夜,玉人何处教吹箫”是描写的哪个城市?", - "type": { - "person": "杜牧", - "type": "江南", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "苏州", - "is_standard_answer": 0 - }, - { - "answer_content": "南京", - "is_standard_answer": 0 - }, - { - "answer_content": "扬州", - "is_standard_answer": 1 - }, - { - "answer_content": "杭州", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“孤舟蓑笠翁,独钓寒江雪”是哪位诗人写的?", - "type": { - "person": "柳宗元", - "type": "自然", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "王安石", - "is_standard_answer": 0 - }, - { - "answer_content": "柳宗元", - "is_standard_answer": 1 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - }, - { - "answer_content": "韩愈", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“八百里分麾下炙,五十弦翻塞外声”,八百里指的是什么动物?", - "type": { - "person": "辛弃疾", - "type": "豪放", - "grade": "初中", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "牛", - "is_standard_answer": 1 - }, - { - "answer_content": "马", - "is_standard_answer": 0 - }, - { - "answer_content": "羊", - "is_standard_answer": 0 - }, - { - "answer_content": "驴", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "行到水穷处,“________”", - "type": { - "person": "王维", - "type": "田园", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "独坐敬亭山", - "is_standard_answer": 0 - }, - { - "answer_content": "谈笑无还期", - "is_standard_answer": 0 - }, - { - "answer_content": "坐看云起时", - "is_standard_answer": 1 - }, - { - "answer_content": "王孙自可留", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "骆宾王的《咏鹅》中,鹅掌是什么颜色的?", - "type": { - "person": "骆宾王", - "type": "友情", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "红", - "is_standard_answer": 1 - }, - { - "answer_content": "绿", - "is_standard_answer": 0 - }, - { - "answer_content": "灰", - "is_standard_answer": 0 - }, - { - "answer_content": "白", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“座中泣下谁最多,江州司马青衫湿”,江州司马是谁?", - "type": { - "person": "白居易", - "type": "豪放", - "grade": "高中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "王维", - "is_standard_answer": 0 - }, - { - "answer_content": "白居易", - "is_standard_answer": 1 - }, - { - "answer_content": "苏轼", - "is_standard_answer": 0 - }, - { - "answer_content": "元稹", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“谁言寸草心,报得三春辉”,哪个字是错误的", - "type": { - "person": "孟郊", - "type": "思乡", - "grade": "小学", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "得->的", - "is_standard_answer": 0 - }, - { - "answer_content": "辉->晖", - "is_standard_answer": 1 - }, - { - "answer_content": "谁->莫", - "is_standard_answer": 0 - }, - { - "answer_content": "报->抱", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“一声何满子,双泪落君前”中何满子指的是什么?", - "type": { - "person": "张祜", - "type": "豪放", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "词牌名", - "is_standard_answer": 0 - }, - { - "answer_content": "曲名", - "is_standard_answer": 1 - }, - { - "answer_content": "曹操", - "is_standard_answer": 0 - }, - { - "answer_content": "刘备", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“看朱成碧思纷纷,憔悴支离为忆君”,这个君指的是谁?", - "type": { - "person": "武则天", - "type": "思乡", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "李世民", - "is_standard_answer": 0 - }, - { - "answer_content": "刘彻", - "is_standard_answer": 0 - }, - { - "answer_content": "李治", - "is_standard_answer": 1 - }, - { - "answer_content": "李隆基", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "李白到了黄鹤楼却说出“眼前有景道不得”,以下哪句诗是他看到的?", - "type": { - "person": "崔颢", - "type": "自然", - "grade": "初中", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "晴川历历汉阳树", - "is_standard_answer": 1 - }, - { - "answer_content": "一拳捶碎黄鹤楼", - "is_standard_answer": 0 - }, - { - "answer_content": "眼前有景道不得", - "is_standard_answer": 0 - }, - { - "answer_content": "故人西辞黄鹤楼", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "去年今日此门中,“________”", - "type": { - "person": "崔护", - "type": "婉约", - "grade": "课外", - "dynasty": "唐朝" - }, - "option_answers": [ - { - "answer_content": "人面不知何处去", - "is_standard_answer": 0 - }, - { - "answer_content": "桃花依旧笑春风", - "is_standard_answer": 0 - }, - { - "answer_content": "微雨燕双飞", - "is_standard_answer": 0 - }, - { - "answer_content": "人面桃花相映红", - "is_standard_answer": 1 - } - ] - }, - { - "question_content": "“一年好景君须记”,的下一句中提到了几种颜色?", - "type": { - "person": "苏轼", - "type": "友情", - "grade": "课外", - "dynasty": "宋朝" - }, - "option_answers": [ - { - "answer_content": "2", - "is_standard_answer": 1 - }, - { - "answer_content": "7", - "is_standard_answer": 0 - }, - { - "answer_content": "5", - "is_standard_answer": 0 - }, - { - "answer_content": "4", - "is_standard_answer": 0 - } - ] - }, - { - "question_content": "“曲有误,周郎顾”,周郎是谁?", - "type": { - "person": "李白", - "type": "婉约", - "grade": "课外", - "dynasty": "三国" - }, - "option_answers": [ - { - "answer_content": "周瑜", - "is_standard_answer": 1 - }, - { - "answer_content": "庄周", - "is_standard_answer": 0 - }, - { - "answer_content": "周公", - "is_standard_answer": 0 - }, - { - "answer_content": "文王", - "is_standard_answer": 0 - } - ] - } - ] -} \ No newline at end of file diff --git a/ht/test/index.html b/ht/test/index.html deleted file mode 100644 index e2149a4..0000000 --- a/ht/test/index.html +++ /dev/null @@ -1,422 +0,0 @@ - - - - - - 诗词答题 API 测试 - - - -
-
-

📚 诗词答题 API 测试

-

测试所有接口功能

-
- -
-
-

🎯 接口测试

- -
- - - - - - -
- -
- - -
- -
- - -
- -
- - -
- -
等待请求...
- -
-
- -
-

📤 响应结果

-
-
-
点击左侧按钮开始测试...
-
-
-
-
- - - - diff --git a/ht/uploads/img_69c3f26541236_20260325.jpg b/ht/uploads/img_69c3f26541236_20260325.jpg deleted file mode 100644 index 066e07e..0000000 Binary files a/ht/uploads/img_69c3f26541236_20260325.jpg and /dev/null differ diff --git a/ht/vote.php b/ht/vote.php deleted file mode 100644 index c052e14..0000000 --- a/ht/vote.php +++ /dev/null @@ -1,650 +0,0 @@ -table('vote') . " v - INNER JOIN " . $db->table('recs') . " r ON v.id = r.topic_id - WHERE r.user_id = " . $user['id'] . " - ORDER BY r.vote_time DESC"; - - $result = $db->query($sql); - $myVotes = []; - if ($result) { - while ($row = $result->fetch_assoc()) { - $myVotes[] = $row; - } - } - - // 计算分页信息 - $total = count($myVotes); - $pagination = getPagination($total, $page, $pageSize); - - // 按分页截取数据 - $myVotesList = array_slice($myVotes, $pagination['offset'], $pagination['pageSize']); - - // 页面标题 - $pageTitle = "我的投票"; - - ?> - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
- -
- - -
-

我的投票记录

- - -
- - $now) { - $voteStatus = '未开始'; - $statusClass = 'vote-status-pending'; - } elseif ($vote['endtime'] < $now) { - $voteStatus = '已结束'; - $statusClass = 'vote-status-ended'; - } else { - $voteStatus = '进行中'; - $statusClass = 'vote-status-active'; - } - } - ?> -
-
-

- - -

-

- - 100): ?>... -

-

类型:

-

时间:

- -
-
- -
- - - - -
-
-

您还没有参与过任何投票

-

- 去投票 -

-
-
- -
- - - - - - getOne('vote', "id = $voteId"); -if (!$vote) { - header('Location: index.php'); - exit; -} - -// 更新浏览次数 -$db->update('vote', ['iview' => $vote['iview'] + 1], "id = $voteId"); - -// 获取投票选项 -$options = $db->getAll('xuan', "topic_id = $voteId", '*', 'sort ASC, id ASC'); - -// 检查用户是否已投票 -$hasVoted = false; -$userVotes = []; - -if ($user) { - $userVoteRecords = $db->getAll('recs', "topic_id = $voteId AND user_id = {$user['id']}"); - - if (!empty($userVoteRecords)) { - $hasVoted = true; - foreach ($userVoteRecords as $record) { - $userVotes[] = $record['option_id']; - } - } -} - -// 获取投票结果 -$voteResults = []; -$totalVotes = 0; - -$sql = "SELECT option_id, COUNT(*) as vote_count FROM " . $db->table('recs') . " WHERE topic_id = $voteId GROUP BY option_id"; -$result = $db->query($sql); - -if ($result) { - while ($row = $result->fetch_assoc()) { - $voteResults[$row['option_id']] = $row['vote_count']; - $totalVotes += $row['vote_count']; - } -} - -// 当前时间,用于判断投票状态 -$now = date('Y-m-d H:i:s'); -$canVote = $vote['status'] == 1 && $vote['statime'] <= $now && $vote['endtime'] >= $now && !$hasVoted && $user; - -// 页面标题 -$pageTitle = $vote['title']; -?> - - - - - - <?php echo $pageTitle; ?> - <?php echo getSiteTitle(); ?> - - - - - -
-
- - -
-
- - -
-
-
-

- - - $now) { - $voteStatus = '未开始'; - $statusClass = 'vote-status-pending'; - } elseif ($vote['endtime'] < $now) { - $voteStatus = '已结束'; - $statusClass = 'vote-status-ended'; - } else { - $voteStatus = '进行中'; - $statusClass = 'vote-status-active'; - } - } - ?> - -

- -
- 类型: - 时间: - 浏览: -
- -
- -
- - -

投票选项

- - - -
- - - - -
- -
- - - - - - - -
- -
- -
- -
-
- - -
- - 0 ? round(($voteCount / $totalVotes) * 100, 1) : 0; - $isUserVoted = in_array($option['id'], $userVotes); - ?> -
-
-

- - (已选) -

- - - <?php echo htmlspecialchars($option['name']); ?> - - - -

- - -
-
-
-
-
- 票 (%) -
-
-
-
- -
- - -
-

您需要登录才能参与投票

-

- 立即登录 - 注册账号 -

-
- -
-

该投票已被禁用

-
- $now): ?> -
-

该投票尚未开始,请在开始时间后再来参与

-
- -
-

该投票已经结束

-
- -
-

您已经参与过该投票,感谢您的参与!

-
- - - - -
- - 0 ? round(($voteCount / $totalVotes) * 100, 1) : 0; - ?> -
-
-

- - - <?php echo htmlspecialchars($option['name']); ?> - - - -

- - -
-
-
-
-
- 票 (%) -
-
-
-
- -
- -
-

您需要登录才能参与投票

-

- 立即登录 - 注册账号 -

-
- - -
-

暂无投票选项

-
- -
-
-
- - - - - diff --git a/ht/vote_api.php b/ht/vote_api.php deleted file mode 100644 index 8b37889..0000000 --- a/ht/vote_api.php +++ /dev/null @@ -1,490 +0,0 @@ -= 0) { - $whereConditions[] = "status = $status"; - } - if ($type >= 0) { - $whereConditions[] = "itype = $type"; - } - - $whereStr = !empty($whereConditions) ? implode(' AND ', $whereConditions) : ''; - - // 获取总记录数 - $total = $db->count('vote', $whereStr); - - // 计算分页信息 - $pagination = getPagination($total, $page, $pageSize); - - // 获取投票列表 - $orderBy = "addtime DESC"; - $limit = "{$pagination['offset']}, {$pagination['pageSize']}"; - $voteList = $db->getAll('vote', $whereStr, '*', $orderBy, $limit); - - // 当前时间,用于判断投票状态 - $now = date('Y-m-d H:i:s'); - - // 处理投票状态 - foreach ($voteList as &$vote) { - $vote['status_text'] = ''; - $vote['status_class'] = ''; - - if ($vote['status'] == 0) { - $vote['status_text'] = '已禁用'; - $vote['status_class'] = 'vote-status-disabled'; - } else { - if ($vote['statime'] > $now) { - $vote['status_text'] = '未开始'; - $vote['status_class'] = 'vote-status-pending'; - } elseif ($vote['endtime'] < $now) { - $vote['status_text'] = '已结束'; - $vote['status_class'] = 'vote-status-ended'; - } else { - $vote['status_text'] = '进行中'; - $vote['status_class'] = 'vote-status-active'; - } - } - } - - apiResponse(0, '获取成功', [ - 'list' => $voteList, - 'pagination' => $pagination - ]); -} - -/** - * 处理获取投票详情 - * @param array $params 请求参数 - * @param DB $db 数据库操作对象 - */ -function handleGetVoteDetail($params, $db) { - // 获取投票ID - $voteId = isset($params['id']) ? intval($params['id']) : 0; - - if (!$voteId) { - apiResponse(1, '参数错误'); - } - - // 获取投票信息 - $vote = $db->getOne('vote', "id = $voteId"); - if (!$vote) { - apiResponse(1, '投票不存在'); - } - - // 更新浏览次数 - $db->update('vote', ['iview' => $vote['iview'] + 1], "id = $voteId"); - - // 获取投票选项 - $options = $db->getAll('xuan', "topic_id = $voteId", '*', 'sort ASC, id ASC'); - - // 当前时间,用于判断投票状态 - $now = date('Y-m-d H:i:s'); - - // 处理投票状态 - $vote['status_text'] = ''; - $vote['status_class'] = ''; - - if ($vote['status'] == 0) { - $vote['status_text'] = '已禁用'; - $vote['status_class'] = 'vote-status-disabled'; - } else { - if ($vote['statime'] > $now) { - $vote['status_text'] = '未开始'; - $vote['status_class'] = 'vote-status-pending'; - } elseif ($vote['endtime'] < $now) { - $vote['status_text'] = '已结束'; - $vote['status_class'] = 'vote-status-ended'; - } else { - $vote['status_text'] = '进行中'; - $vote['status_class'] = 'vote-status-active'; - } - } - - // 检查用户是否已投票 - $hasVoted = false; - $userVotes = []; - $user = checkLogin(); - - if ($user) { - $userVoteRecords = $db->getAll('recs', "topic_id = $voteId AND user_id = {$user['id']}"); - - if (!empty($userVoteRecords)) { - $hasVoted = true; - foreach ($userVoteRecords as $record) { - $userVotes[] = $record['option_id']; - } - } - } - - // 计算是否可以投票 - $canVote = $vote['status'] == 1 && $vote['statime'] <= $now && $vote['endtime'] >= $now && !$hasVoted && $user; - - apiResponse(0, '获取成功', [ - 'vote' => $vote, - 'options' => $options, - 'hasVoted' => $hasVoted, - 'userVotes' => $userVotes, - 'canVote' => $canVote - ]); -} - -/** - * 处理提交投票 - * @param array $params 请求参数 - * @param DB $db 数据库操作对象 - */ -function handleSubmitVote($params, $db) { - // 验证权限 - $user = checkLogin(); - if (!$user) { - apiResponse(1, '请先登录'); - } - - // 获取参数 - $topicId = isset($params['topic_id']) ? intval($params['topic_id']) : 0; - $options = isset($params['options']) ? $params['options'] : []; - - // 参数验证 - if (empty($topicId) || empty($options)) { - apiResponse(1, '参数错误'); - } - - // 确保options是数组 - if (!is_array($options)) { - $options = explode(',', $options); - } - - if (empty($options)) { - apiResponse(1, '请至少选择一个选项'); - } - - // 获取投票信息 - $vote = $db->getOne('vote', "id = $topicId"); - if (!$vote) { - apiResponse(1, '投票不存在'); - } - - // 验证投票状态 - $now = date('Y-m-d H:i:s'); - if ($vote['status'] != 1) { - apiResponse(1, '该投票已被禁用'); - } - - if ($vote['statime'] > $now) { - apiResponse(1, '该投票尚未开始'); - } - - if ($vote['endtime'] < $now) { - apiResponse(1, '该投票已经结束'); - } - - // 检查用户是否已投票 - $hasVoted = $db->count('recs', "topic_id = $topicId AND user_id = {$user['id']}"); - if ($hasVoted > 0) { - apiResponse(1, '您已经参与过该投票'); - } - - // 验证选项数量 - if ($vote['itype'] == 1 && count($options) > $vote['maxtime']) { - apiResponse(1, "最多只能选择 {$vote['maxtime']} 项"); - } - - // 验证选项是否存在 - foreach ($options as $optionId) { - $option = $db->getOne('xuan', "id = $optionId AND topic_id = $topicId"); - if (!$option) { - apiResponse(1, '选项不存在'); - } - } - - // 开始事务 - $db->startTransaction(); - - try { - // 添加投票记录 - $ip = $_SERVER['REMOTE_ADDR']; - $time = date('Y-m-d H:i:s'); - - foreach ($options as $optionId) { - $result = $db->insert('recs', [ - 'topic_id' => $topicId, - 'user_id' => $user['id'], - 'option_id' => $optionId, - 'vote_time' => $time, - 'ip' => $ip - ]); - - if (!$result) { - throw new Exception('提交投票失败'); - } - } - - // 记录日志 - writeLog($user['id'], 'vote', "参与投票:{$vote['title']}"); - - // 提交事务 - $db->commit(); - - apiResponse(0, '投票成功'); - } catch (Exception $e) { - // 回滚事务 - $db->rollback(); - apiResponse(1, $e->getMessage()); - } -} - -/** - * 处理获取投票结果 - * @param array $params 请求参数 - * @param DB $db 数据库操作对象 - */ -function handleGetVoteResult($params, $db) { - // 获取投票ID - $voteId = isset($params['id']) ? intval($params['id']) : 0; - - if (!$voteId) { - apiResponse(1, '参数错误'); - } - - // 获取投票信息 - $vote = $db->getOne('vote', "id = $voteId"); - if (!$vote) { - apiResponse(1, '投票不存在'); - } - - // 获取选项列表 - $options = $db->getAll('xuan', "topic_id = $voteId", '*', 'sort ASC, id ASC'); - if (empty($options)) { - apiResponse(1, '暂无投票选项'); - } - - // 获取投票结果 - $sql = "SELECT option_id, COUNT(*) as vote_count FROM " . $db->table('recs') . " WHERE topic_id = $voteId GROUP BY option_id"; - $result = $db->query($sql); - - $voteResults = []; - $totalVotes = 0; - - if ($result) { - while ($row = $result->fetch_assoc()) { - $voteResults[$row['option_id']] = $row['vote_count']; - $totalVotes += $row['vote_count']; - } - } - - // 格式化结果 - $formattedResults = []; - foreach ($options as $option) { - $voteCount = isset($voteResults[$option['id']]) ? $voteResults[$option['id']] : 0; - $percentage = $totalVotes > 0 ? round(($voteCount / $totalVotes) * 100, 1) : 0; - - $formattedResults[] = [ - 'id' => $option['id'], - 'name' => $option['name'], - 'idesc' => $option['idesc'], - 'imgs' => $option['imgs'], - 'count' => $voteCount, - 'percentage' => $percentage - ]; - } - - // 用户是否已投票 - $hasVoted = false; - $userVotes = []; - $user = checkLogin(); - - if ($user) { - $userVoteRecords = $db->getAll('recs', "topic_id = $voteId AND user_id = {$user['id']}"); - - if (!empty($userVoteRecords)) { - $hasVoted = true; - foreach ($userVoteRecords as $record) { - $userVotes[] = $record['option_id']; - } - } - } - - apiResponse(0, '获取成功', [ - 'vote' => $vote, - 'options' => $formattedResults, - 'totalVotes' => $totalVotes, - 'hasVoted' => $hasVoted, - 'userVotes' => $userVotes - ]); -} - -/** - * 处理获取用户的投票记录 - * @param array $params 请求参数 - * @param DB $db 数据库操作对象 - */ -function handleGetUserVotes($params, $db) { - // 验证权限 - $user = checkLogin(); - if (!$user) { - apiResponse(1, '请先登录'); - } - - // 获取分页参数 - $page = isset($params['page']) ? intval($params['page']) : 1; - $pageSize = isset($params['pageSize']) ? intval($params['pageSize']) : 10; - - // 查询该用户参与的投票 - $sql = "SELECT DISTINCT v.* FROM " . $db->table('vote') . " v - INNER JOIN " . $db->table('recs') . " r ON v.id = r.topic_id - WHERE r.user_id = " . $user['id'] . " - ORDER BY r.vote_time DESC"; - - $result = $db->query($sql); - $myVotes = []; - if ($result) { - while ($row = $result->fetch_assoc()) { - $myVotes[] = $row; - } - } - - // 计算分页信息 - $total = count($myVotes); - $pagination = getPagination($total, $page, $pageSize); - - // 按分页截取数据 - $myVotesList = array_slice($myVotes, $pagination['offset'], $pagination['pageSize']); - - // 当前时间,用于判断投票状态 - $now = date('Y-m-d H:i:s'); - - // 处理投票状态 - foreach ($myVotesList as &$vote) { - $vote['status_text'] = ''; - $vote['status_class'] = ''; - - if ($vote['status'] == 0) { - $vote['status_text'] = '已禁用'; - $vote['status_class'] = 'vote-status-disabled'; - } else { - if ($vote['statime'] > $now) { - $vote['status_text'] = '未开始'; - $vote['status_class'] = 'vote-status-pending'; - } elseif ($vote['endtime'] < $now) { - $vote['status_text'] = '已结束'; - $vote['status_class'] = 'vote-status-ended'; - } else { - $vote['status_text'] = '进行中'; - $vote['status_class'] = 'vote-status-active'; - } - } - } - - apiResponse(0, '获取成功', [ - 'list' => $myVotesList, - 'pagination' => $pagination - ]); -} - -/** - * 统一API响应格式 - * @param int $code 状态码,0表示成功,非0表示失败 - * @param string $msg 提示信息 - * @param array $data 返回数据 - */ -function apiResponse($code = 0, $msg = '', $data = []) { - echo json_encode([ - 'code' => $code, - 'msg' => $msg, - 'data' => $data - ], JSON_UNESCAPED_UNICODE); - exit; -} \ No newline at end of file diff --git a/server_monitor.html b/server_monitor.html deleted file mode 100644 index 0d3a297..0000000 --- a/server_monitor.html +++ /dev/null @@ -1,418 +0,0 @@ - - - - - - 服务器监控面板 - - - -
-
-

🖥️ 服务器监控面板

-

实时监控服务器状态与性能

-
正在加载...
-
- -
- -
- -
-
-
- 📊 -
-
服务器负载
-
-
-
- - -
-
-
- 🌐 -
-
网络延迟
-
-
-
- - -
-
-
- ⚡ -
-
服务器响应时间
-
-
-
-
- -
最后更新: --
-
- - - - - - \ No newline at end of file diff --git a/server_monitor_api.php b/server_monitor_api.php deleted file mode 100644 index 400e775..0000000 --- a/server_monitor_api.php +++ /dev/null @@ -1,80 +0,0 @@ - round($load[0], 2), - '5min' => round($load[1], 2), - '15min' => round($load[2], 2) - ]; -} - -function getNetworkLatency() { - $hosts = [ - '8.8.8.8' => 'Google DNS', - '1.1.1.1' => 'Cloudflare DNS', - '114.114.114.114' => '114 DNS' - ]; - - $results = []; - foreach ($hosts as $ip => $name) { - $start = microtime(true); - $socket = @fsockopen($ip, 53, $errno, $errstr, 2); - $end = microtime(true); - - if ($socket) { - fclose($socket); - $latency = round(($end - $start) * 1000, 2); - $results[] = [ - 'host' => $name, - 'ip' => $ip, - 'latency' => $latency, - 'status' => 'online' - ]; - } else { - $results[] = [ - 'host' => $name, - 'ip' => $ip, - 'latency' => null, - 'status' => 'offline' - ]; - } - } - - return $results; -} - -function getTimestamp() { - return [ - 'unix' => time(), - 'datetime' => date('Y-m-d H:i:s'), - 'timezone' => date_default_timezone_get() - ]; -} - -// 记录请求开始时间 -$start_time = microtime(true); - -$response = [ - 'status' => 'success', - 'timestamp' => getTimestamp(), - 'server' => [ - 'load' => getServerLoad() - ], - 'network' => [ - 'latency' => getNetworkLatency(), - 'server_response_time' => round((microtime(true) - $start_time) * 1000, 2) // 服务器响应时间(毫秒) - ] -]; - -echo json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); -?> \ No newline at end of file