标签:完整 没有 返回 child _id 查询 语文 lis 3.1
3.分类管理接口查询所有分类,返回一个树形结构。
请求
/catalog/all
响应
{
"code": 0,
"data": {
"count": 3,
"ts": 1528888319,
"items": [
{
"id": "1",
"name": "高中教育",
"parent_id": "0",
"cover": null,
"comment": null,
"add_time": "2018-06-13 16:11:09",
"update_time": "2018-06-13 16:11:09",
"status": "1",
"children": [
{
"id": "101",
"name": "语文",
"parent_id": "1",
"cover": null,
"comment": null,
"add_time": "2018-06-13 16:11:09",
"update_time": "2018-06-13 16:11:09",
"status": "1"
},
{
"id": "102",
"name": "数学",
"parent_id": "1",
"cover": null,
"comment": null,
"add_time": "2018-06-13 16:11:09",
"update_time": "2018-06-13 16:11:09",
"status": "1"
}
]
},
{
"id": "3",
"name": "职业教育",
"parent_id": "0",
"cover": null,
"comment": null,
"add_time": "2018-06-13 16:11:10",
"update_time": "2018-06-13 16:11:10",
"status": "1"
}
]
}
}
name 分类名。
parent_id 上级目录编号。
cover 封面,完整的url。
comment 描述信息。
children 该目录下的子目录,数组。 没有该属性,或该属性为null,表示没有下级目录。
查询某个分类下的分类列表。
请求
/catalog/list?parent_id=0
parent_id 上级分类参数,忽略或为0时表示查询一级目录。
响应
{
"code": 0,
"data": {
"count": 3,
"ts": 1528888710,
"items": [
{
"id": "1",
"name": "高中教育",
"parent_id": "0",
"cover": null,
"comment": null,
"add_time": "2018-06-13 16:11:09",
"update_time": "2018-06-13 16:11:09",
"status": "1"
},
{
"id": "2",
"name": "艺术教育",
"parent_id": "0",
"cover": null,
"comment": null,
"add_time": "2018-06-13 16:11:10",
"update_time": "2018-06-13 16:11:10",
"status": "1"
},
{
"id": "3",
"name": "职业教育",
"parent_id": "0",
"cover": null,
"comment": null,
"add_time": "2018-06-13 16:11:10",
"update_time": "2018-06-13 16:11:10",
"status": "1"
}
]
}
}
请求
/catalog/get?id=1
响应
{
"code": 0,
"data": {
"count": 1,
"ts": 1528889117,
"items": [
{
"id": "1",
"name": "高中教育",
"parent_id": "0",
"cover": null,
"comment": null,
"add_time": "2018-06-13 16:11:09",
"update_time": "2018-06-13 16:11:09",
"status": "1"
}
]
}
}
标签:完整 没有 返回 child _id 查询 语文 lis 3.1
原文地址:http://blog.51cto.com/livestreaming/2129713