zhibo/模块文档/10-分类管理模块.md
2025-12-30 11:11:11 +08:00

2.7 KiB

分类管理模块接口文档

模块概述

分类管理模块提供直播间分类、作品分类的查询和统计功能。


接口列表

1. 获取直播间分类列表

接口路径: GET /api/front/category/live-room

请求参数: 无

返回参数:

{
  "code": 200,
  "msg": "success",
  "data": [
    {
      "id": 分类ID,
      "name": "分类名称",
      "pid": 父分类ID,
      "sort": 排序,
      "extra": "扩展字段"
    }
  ]
}

2. 获取作品分类列表

接口路径: GET /api/front/category/work

请求参数: 无

返回参数:

{
  "code": 200,
  "msg": "success",
  "data": [
    {
      "id": 分类ID,
      "name": "分类名称",
      "pid": 父分类ID,
      "sort": 排序,
      "extra": "扩展字段"
    }
  ]
}

3. 获取指定类型的分类列表

接口路径: GET /api/front/category/list

请求参数:

type: 分类类型 (1=商品, 3=文章, 8=直播间, 9=作品)

返回参数:

{
  "code": 200,
  "msg": "success",
  "data": [
    {
      "id": 分类ID,
      "name": "分类名称",
      "pid": 父分类ID,
      "sort": 排序,
      "extra": "扩展字段"
    }
  ]
}

4. 获取分类详情

接口路径: GET /api/front/category/{id}

请求参数:

id: 分类ID (路径参数)

返回参数:

{
  "code": 200,
  "msg": "success",
  "data": {
    "id": 分类ID,
    "name": "分类名称",
    "pid": 父分类ID,
    "sort": 排序,
    "extra": "扩展字段"
  }
}

5. 获取分类统计信息

接口路径: GET /api/front/category/statistics

请求参数:

type: 分类类型 (8=直播间, 9=作品)

返回参数:

{
  "code": 200,
  "msg": "success",
  "data": [
    {
      "categoryId": 分类ID,
      "categoryName": "分类名称",
      "count": 数量
    }
  ]
}

6. 获取热门分类

接口路径: GET /api/front/category/hot

请求参数:

type: 分类类型 (8=直播间, 9=作品)
limit: 返回数量限制 (默认10)

返回参数:

{
  "code": 200,
  "msg": "success",
  "data": [
    {
      "id": 分类ID,
      "name": "分类名称",
      "pid": 父分类ID,
      "sort": 排序,
      "extra": "扩展字段"
    }
  ]
}

7. 获取子分类列表

接口路径: GET /api/front/category/{parentId}/children

请求参数:

parentId: 父分类ID (路径参数)
recursive: 是否递归获取所有子分类 (默认false)

返回参数:

{
  "code": 200,
  "msg": "success",
  "data": [
    {
      "id": 分类ID,
      "name": "分类名称",
      "pid": 父分类ID,
      "sort": 排序,
      "extra": "扩展字段"
    }
  ]
}