简洁、高效的资源数据查询接口,支持多种筛选条件和分页功能
接口地址
api.php
请求方法
GET
响应格式
JSON
跨域支持
允许所有域 (Access-Control-Allow-Origin: *)
功能描述
查询API表中未删除(is_delete=0)且启用(status=1)的资源数据,支持条件筛选、排序和分页
| 参数名 | 类型 | 是否必填 | 描述 | 示例 |
|---|---|---|---|---|
| id | int | 否 | 按资源ID精确查询 | ?id=123 |
| category | int | 否 | 按分类ID筛选(对应source_category_id) | ?category=2 |
| type | int | 否 |
按资源类型筛选(对应is_type): 0=夸克网盘 1=阿里网盘 2=百度网盘 3=UC网盘 4=迅雷网盘 |
?type=0 |
| search | string | 否 |
模糊搜索关键词,匹配字段: title(资源名称) description(副标题) vod_content(资源介绍) |
?search=电影 |
| sort | string | 否 |
排序字段(默认:create_time),允许值: source_id(资源ID) title(资源名称) create_time(创建时间) update_time(修改时间) page_views(浏览量) |
?sort=page_views |
| order | string | 否 |
排序方式: asc(升序) desc(降序,默认) |
?order=asc |
| page | int | 否 | 分页页码(默认:1,最小1) | ?page=2 |
| limit | int | 否 | 每页条数(默认:20,范围1-100) | ?limit=50 |
{
"success": true,
"data": {
"items": [
{
"source_id": 1,
"title": "示例资源名称",
"url": "https://example.com/resource",
"description": "资源副标题",
"content": "资源详细内容...",
"page_views": 156,
"is_time": 0,
"is_user": 0,
"fid": "quark_123456",
"is_type": 0,
"code": "abc1",
"source_category_id": 2,
"vod_content": "这是一个示例资源介绍",
"vod_pic": "https://example.com/image.jpg",
"status": 1,
"is_delete": 0,
"create_time": 1620000000,
"update_time": 1620000000
}
// 更多资源...
],
"pagination": {
"total": 120, // 符合条件的总条数
"page": 1, // 当前页码
"limit": 20, // 每页条数
"pages": 6 // 总页数
}
},
"message": "查询成功"
}
{
"success": false,
"data": [],
"message": "错误描述信息" // 例如:数据库错误、参数错误等
}
请求URL:
api.php
说明:返回所有符合条件的资源,按创建时间降序排列
请求URL:
api.php?category=2&search=科幻
说明:查询分类ID=2且标题/描述/介绍中包含"科幻"的资源
请求URL:
api.php?type=0&sort=page_views&order=desc&page=2&limit=10
说明:查询夸克网盘资源,按浏览量降序排列,取第2页(10条/页)
limit参数最大限制为100,超过会自动调整为100sort参数仅支持指定的字段,传递其他值会自动使用默认值(create_time)message字段中返回,便于排查问题(如数据库连接失败、参数格式错误等)