--- title: 新 API 文件與規劃 - 行雲知識王 tags: 行雲知識王, 寒訓 --- [< 回首頁](/TTNiCAWfRz6aGHQfw-Zrrw) [TOC] # 文件圖示說明 :::danger :bulb: <- 此圖示代表:該 API 尚未實作。 :accept: <- 此圖示代表:API 已經上線並經過測試。 :closed_lock_with_key: <- 此圖示代表:需要登入才能使用的 API ::: # :closed_lock_with_key: 要求登入的 API :::warning ## session_id 當沒有 cookie 使用時,可以在 post 參數中加入 session_id 來登入。 ## 當沒有登入時,API 會回傳以下錯誤 ```json= { "code": 0, "message": "Unknown error occurred, or not logged in.", "data": [] } ``` 註:若發生未知錯誤,也會回傳此錯誤。 ::: # 前台 (遊戲) # 後台 (管理) ## 使用者 ### 獲取所有使用者 - STATE: :bulb: :closed_lock_with_key: - URL: http://120.110.112.73:23080/index.php/api/management/User/list :::spoiler - Parameters: - None. - Responses: - Success: ```json= { "success": 0, "message": "Success.", "data": [ { "id": 2, "name": "網頁組長", "permission_groups": [ { "id": 2, "title": "使用者管理", /* 這個群組會有這些權限 */ "permissions": [ { "id": 1, "title": "管理-使用者-列出" }, { "id": 2, "title": "管理-使用者-更新" } ] } ], "permissions": [ { "id": 2, "title": "管理-使用者-更新", /* 個人權限蓋過群組權限 */ /* 雖然群組權限中,擁有「管理-使用者-更新」 */ /* 但 value 為 false 的 permission 代表 */ /* 不讓這個使用者擁有「管理-使用者-更新」 */ "value": false }, { "id": 10, "title": "管理-關卡-抽象類別-列出", "value": true } ] } ] } ``` ::: ### 更新使用者 - STATE: :bulb: :closed_lock_with_key: - URL: http://120.110.112.73:23080/index.php/api/management/User/update :::spoiler {state="open"} - Parameters: - users: `Array<JSON>` 要更新的使用者與內容 - Responses: - Success: - Fail: ::: ## 權限管理 ## 類別管理 ### 獲取所有類別 - STATE: :bulb: :closed_lock_with_key: - URL: http://120.110.112.73:23080/index.php/api/management/Category/get :::spoiler {state="open"} - Parameters: - None. - Responses: - Success: - Fail: ::: ### 新增類別 - STATE: :bulb: :closed_lock_with_key: - URL: http://120.110.112.73:23080/index.php/api/management/Category/create :::spoiler {state="open"} - Parameters: - None. - Responses: - Success: - Fail: ::: ### 編輯類別 - STATE: :bulb: :closed_lock_with_key: - URL: http://120.110.112.73:23080/index.php/api/management/Category/update :::spoiler {state="open"} - Parameters: - None. - Responses: - Success: - Fail: ::: ### 刪除類別 - STATE: :bulb: :closed_lock_with_key: - URL: http://120.110.112.73:23080/index.php/api/management/Category/delete :::spoiler {state="open"} - Parameters: - None. - Responses: - Success: - Fail: ::: ## 題目管理 ### 獲取所有題目 - STATE: :bulb: :closed_lock_with_key: - URL: http://120.110.112.73:23080/index.php/api/management/Question :::spoiler {state="open"} - Parameters: - None. - Responses: - Success: - Fail: ::: <style> details { border: 1px solid gray; border-radius: 10px; padding: 15px; margin: 5px; box-shadow: 5px 5px lightgray; } details summary:after { content: "詳細資訊"; } </style>