API 文档

洛克王国远行商人数据接口

📡 接口概览

本API提供洛克王国远行商人商品数据查询服务,支持获取当前时段及所有时段的商品信息。

GET https://rocom-api.ovofish.com/api/shop

认证方式

所有请求需要在Header中携带API Key进行认证:

X-API-Key: your_api_key

🔑 公开KEY

以下为公开免费使用的API Key,可直接用于开发和测试:

X-API-Key: sk-f2141ba4be3a9832106d2dc4042454666e354414d3ed0ce9

✓ 公共KEY,免费使用 · 无需申请

📋 请求参数

参数名 类型 必填 说明
all boolean 设为 true 时返回所有时段的商品数据

💻 请求示例

基本请求(当前时段)

curl -H "X-API-Key: sk-your_key" \ https://rocom-api.ovofish.com/api/shop

获取所有时段

curl -H "X-API-Key: sk-your_key" \ "https://rocom-api.ovofish.com/api/shop?all=true"

JavaScript Fetch

// 基本请求 fetch('https://rocom-api.ovofish.com/api/shop', { headers: { 'X-API-Key': 'sk-your_api_key' } }) .then(res => res.json()) .then(data => console.log(data)); // 获取所有时段 fetch('https://rocom-api.ovofish.com/api/shop?all=true', { headers: { 'X-API-Key': 'sk-your_api_key' } }) .then(res => res.json()) .then(data => console.log(data));

📤 响应格式

响应示例 - 营业中(首次获取)

{
  "status": "success",
  "timestamp": "2026-06-02 12:05",
  "period": "12:00-16:00",
  "count": 3,
  "data": [
    {
      "name": "国王球",
      "price": "160000",
      "image_url": "https://rocom-api.ovofish.com/images/items/咕噜球/国王球.png",
      "period": "12:00-16:00",
      "end_time": "2026-06-02 16:00",
      "limit": "不限购"
    },
    {
      "name": "魔力果",
      "price": "6000",
      "image_url": "https://rocom-api.ovofish.com/images/items/材料/魔力果.png",
      "period": "12:00-16:00",
      "end_time": "2026-06-02 16:00",
      "limit": "20"
    }
  ],
  "duration_ms": 150,
  "cached": false
}

响应示例 - 营业中(返回缓存)

{
  "status": "success",
  "timestamp": "2026-06-02 12:05",
  "period": "12:00-16:00",
  "count": 3,
  "data": [...],
  "duration_ms": 0,
  "cached": true,
  "cache_expire": "2026-06-02 16:00:00"
}

响应示例 - 前置引擎工作中(每时段前2分钟)

{
  "status": "loading",
  "message": "前置引擎工作中,等待数据更新",
  "timestamp": "2026-06-02 12:01",
  "next_refresh": "2026-06-02 12:02",
  "count": 0,
  "data": []
}

响应示例 - 未营业(00:00-08:00)

{
  "status": "closed",
  "message": "远行商人未营业",
  "timestamp": "2026-06-02 03:00",
  "next_refresh": "2026-06-02 08:02",
  "count": 0,
  "data": []
}

响应示例 - 错误

{
  "status": "error",
  "message": "获取商品信息失败",
  "timestamp": "2026-06-02 12:05",
  "count": 0,
  "data": []
}

响应字段说明

字段 类型 说明
status string 状态:success 成功 / loading 加载中 / closed 未营业 / error 错误
timestamp string 数据时间戳
period string 当前时段,格式如 08:00-12:00
count number 商品数量
data array 商品列表
duration_ms number API处理耗时(毫秒),缓存时为 0
cached boolean 是否为缓存数据
cache_expire string 缓存过期时间(仅缓存时返回)
message string 状态说明(非 success 时返回)
next_refresh string 下次刷新时间(loading/closed 时返回)

商品字段说明

字段 类型 说明
name string 商品名称
price string 价格(洛克贝)
image_url string 商品图片URL
period string 商品所属时段
end_time string 商品下架时间
limit string 限购数量,不限购 或数字

⏰ 时段说明

远行商人商品按时段轮换,每天共4个时段:

时段 时间范围
上午场 08:00 - 12:00
下午场 12:00 - 16:00
傍晚场 16:00 - 20:00
夜间场 20:00 - 24:00

🔧 在线测试

尝试调用API

输入你的API Key来测试接口