# 道道集市 API 接口文档 基础地址: `http://localhost:3000` ## 响应格式 ```json // 成功 { "code": 0, "data": ... } // 失败 { "code": -1, "msg": "错误信息" } ``` ## 道具分类 API | 方法 | 路径 | 说明 | |------|------|------| | GET | `/api/item-categories` | 获取所有分类 | | POST | `/api/item-categories` | 添加分类 | | PUT | `/api/item-categories/:id` | 更新分类 | | DELETE | `/api/item-categories/:id` | 删除分类 | ## 道具物品 API | 方法 | 路径 | 说明 | |------|------|------| | GET | `/api/items` | 获取所有道具 (支持 category_id, keyword 筛选) | | GET | `/api/items/search?q=关键字` | 搜索道具 (名称或简称) | | POST | `/api/items` | 添加道具 | | PUT | `/api/items/:id` | 更新道具 | | DELETE | `/api/items/:id` | 删除道具 | ## 统计和系统 API | 方法 | 路径 | 说明 | |------|------|------| | GET | `/api/stats` | 获取总览数据 | | GET | `/api/health` | 健康检查 | ## 请求示例 ### 添加道具 ```bash POST /api/items Content-Type: application/json { "name": "超级黑水晶", "short_name": "黑水晶", "category_id": 1, "price_yb": 100 } ``` ### 获取所有道具 ```bash GET /api/items?category_id=1 ``` ### 搜索道具 ```bash GET /api/items/search?q=黑水 ```