接口概览

以下接口仅用于读取公开资源数据,不提供用户资料、评论、后台管理、举报处理等能力。

接口 方法 说明
/api/resources.php GET 获取已审核公开资源列表,可按分类和类型进行筛选。
/api/search.php GET 按关键字搜索公开资源,可按名称、作者、描述进行搜索。
/api/resource.php GET 获取单个资源详情,包括版本、文件、推荐资源等信息。

1. 获取资源列表

GET /api/resources.php

返回已审核公开资源列表,默认按发布时间倒序排列。

参数名 类型 说明 示例
page integer 页码,从 1 开始。 1
limit integer 每页数量,默认 20,最大 100。 20
category string 按资源分类筛选。 工具
type string 按资源类型筛选,例如 plugin、mod、package 等。 plugin
200 OK 400 Bad Request
GET /api/resources.php?page=1&limit=20
GET /api/resources.php?category=工具&type=plugin

2. 搜索资源

GET /api/search.php?q=插件&mode=name

根据关键字搜索已审核公开资源,支持按名称、作者、描述进行检索。

参数名 类型 说明 示例
q string 搜索关键字,不能为空。 插件
mode string 搜索模式:name、author、description。 name
type string 可选,按资源类型筛选。 plugin
category string 可选,按分类筛选。 工具
page integer 页码,从 1 开始。 1
limit integer 每页数量,默认 20,最大 100。 20
200 OK 400 Bad Request
GET /api/search.php?q=插件&mode=name&page=1&limit=20
GET /api/search.php?q=管理员&mode=author

3. 获取单个资源详情

GET /api/resource.php?id=123

返回单个已公开资源的详细信息,包含基础字段、版本历史、文件列表以及同分类推荐资源。

参数名 类型 说明 示例
id integer 资源数据库 ID。 123
uuid string 资源 UUID,和 id 二选一使用。 7fb7b4b8-3d2a-4f2c-bd8a-4d7b7f40f000
200 OK 404 Not Found
GET /api/resource.php?id=123
GET /api/resource.php?uuid=7fb7b4b8-3d2a-4f2c-bd8a-4d7b7f40f000

3. 返回结构说明

接口统一返回 JSON,成功时使用 success 为 true,失败时返回 success 为 false,并附带说明信息。

字段 类型 说明
success boolean 请求是否成功。
message string 状态说明,成功时通常是 ok。
page integer 当前页码,仅列表接口返回。
limit integer 每页数量,仅列表接口返回。
total integer 符合条件的总记录数,仅列表接口返回。
data object / array 实际返回内容,单个资源接口返回对象,列表接口返回数组对象。

4. 示例

以下示例仅展示公开数据结构,字段内容可根据实际平台状态变化。

列表接口返回示例

{
  "success": true,
  "message": "ok",
  "page": 1,
  "limit": 20,
  "total": 2,
  "data": [
    {
      "id": 101,
      "uuid": "7fb7b4b8-3d2a-4f2c-bd8a-4d7b7f40f000",
      "name": "Example Plugin",
      "type": "plugin",
      "category": "工具",
      "version": "x26.06.19",
      "short_desc": "这是一个示例插件",
      "downloads": 120,
      "views": 350,
      "likes_count": 40,
      "author_name": "管理员",
      "author_uid": "10001",
      "created_at": "2026-10-06 01:28:00",
      "detail_url": "/resources/detail.php?id=7fb7b4b8-3d2a-4f2c-bd8a-4d7b7f40f000"
    }
  ]
}

单个资源返回示例

{
  "success": true,
  "message": "ok",
  "data": {
    "id": 101,
    "uuid": "7fb7b4b8-3d2a-4f2c-bd8a-4d7b7f40f000",
    "name": "Example Plugin",
    "type": "plugin",
    "category": "工具",
    "version": "x26.06.19",
    "short_desc": "这是一个示例插件",
    "detail_desc": "详细介绍内容",
    "content": "说明文本",
    "downloads": 120,
    "views": 350,
    "likes_count": 40,
    "source_url": "https://example.com/source",
    "doc_url": "https://example.com/doc",
    "tutorial_url": "https://example.com/tutorial",
    "author_name": "管理员",
    "author_uid": "10001",
    "created_at": "2026-10-06 01:28:00",
    "updated_at": "2026-10-06 02:00:00",
    "versions": [
      {
        "id": 2,
        "version": "x26.06.19",
        "changelog": "修复若干问题",
        "is_current": true,
        "created_at": "2026-10-06 01:30:00"
      }
    ],
    "files": [
      {
        "file_name": "example-plugin.zip",
        "file_size": 123456,
        "file_type": "zip",
        "is_image": false
      }
    ]
  }
}