3.分類管理
阿新 • • 發佈:2018-06-15
date_time IT 參數 ID name 職業 3.2 CA cat 3.分類管理接口
3.1.查詢分類樹
查詢所有分類,返回一個樹形結構。
-
請求
/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,表示沒有下級目錄。
3.2.查詢分類列表
查詢某個分類下的分類列表。
-
請求
/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" } ] } }
3.3.查詢一個分類
-
請求
/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" } ] } }
3.分類管理