获取文章分类列表

接口描述:

  • 获取文章分类列表。

请求 URL:

  • http|https://host/api/v1/article_cat/method/get.article.cat.list/

请求方式:

  • GET
  • POST

是否授权:

业务参数:

参数名 类型 是否必须 范围值 默认值 示例值 描述
article_cat_id integer egt:0 0 1 文章分类编号
level integer egt:0 0 文章分类深度
is_layer integer in:0,1 0 1 是否返回本级分类 0=否 1=是

响应参数:

参数名 类型 是否返回 示例值 描述
status integer 200 状态码
message string success 消息信息
data array [] 返回数组
data 类型 是否返回 示例值 描述
article_cat_id integer 1 文章分类编号
parent_id integer 0 文章分类上级编号
cat_name string 商城公告 文章分类名称
cat_type integer 0 文章分类类型(自定义)
keywords string 关键词 文章分类关键词
description string 描述 文章分类描述
sort integer 50 文章分类排序值
is_navi integer 0 是否显示到导航 0=否 1=是
children_total integer 0 该分类下子级分类数的合计
article_total integer 12 该分类下关联文章的合计
level integer 0 该分类的层级深度

响应示例:

  1. {
  2. "status": 200,
  3. "message": "success",
  4. "data": [
  5. {
  6. "article_cat_id": 1,
  7. "parent_id": 0,
  8. "cat_name": "商城公告",
  9. "cat_type": 0,
  10. "keywords": "关键词",
  11. "description": "描述",
  12. "sort": 50,
  13. "is_navi": 0,
  14. "children_total": 0,
  15. "article_total": 12,
  16. "level": 0
  17. },
  18. {
  19. "article_cat_id": 2,
  20. "parent_id": 0,
  21. "cat_name": "最新活动",
  22. "cat_type": 0,
  23. "keywords": "关键词",
  24. "description": "描述",
  25. "sort": 50,
  26. "is_navi": 0,
  27. "children_total": 0,
  28. "article_total": 0,
  29. "level": 0
  30. }
  31. ]
  32. }

备注:

  1. 该接口支持条件搜索,如果不带入业务参数则使用默认值。

  2. article_cat_id参数值为 0 表示获取所有分类,如果参数值非 0 表示从指定的编号开始获取。

参数示例: 假设某个分类列表:

  1. 最顶层分类(ID=0)
  2. ├─ A1 // (ID=1)
  3. └─ A2
  4. └─ A3
  5. └─ B1
  6. └─ B2
  7. └─ B3
  1. 不传入level参数时表示返回所有层级的分类列表。

  2. level值为 0 时返回A1 B1,值为 1 时返回A1 A2 B1 B2,值为 2 时返回A1 A2 A3 B1 B2 B3

  3. article_cat_id值为A1(ID=1),并且level值为 0 时返回A1,值为 1 时返回A1 A2,因为is_layer参数默认为 1,所以会返回本级。如果将is_layer参数值设为 0 并且level值为 0 时返回A2,值为 1 时返回A2 A3