知識王
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: API 規劃發想 - 行雲知識王 tags: 行雲知識王, 寒訓 --- [< 回首頁](/TTNiCAWfRz6aGHQfw-Zrrw) # 參考資料 - https://app.swaggerhub.com/apis/moontai0724/hackathon/0.0.1 # 查看資料庫 - URL: http://120.110.114.73:23080/phpmyadmin - Account: app - Password: app # 文件圖示說明 :::danger :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": [] } ``` 註:若發生未知錯誤,也會回傳此錯誤。 ::: # 會員系統 規劃者/柏瑄 製作者/柏瑄 - :accept: 登入: http://120.110.114.73:23080/index.php/api/User/login :::spoiler - parameters: - account: 帳號 - password: 密碼 - response - success: 登入成功 ```json= { "code": 1, "message": "Login success.", "data": { "session_id": "grhch426cc3t8sdfhulga8tggsj0ao3k" } } ``` - fail: 帳號或密碼錯誤 ```json= { "code": 0, "message": "Login failed, account or password incorrect.", "data": [] } ``` ::: - :closed_lock_with_key: :accept: 登出: http://120.110.114.73:23080/index.php/api/User/logout :::spoiler - parameters: [] - response - success: 登出成功 ```json= { "code": 1, "message": "logout success.", "data": [] } ``` ::: - :accept: 註冊: http://120.110.114.73:23080/index.php/api/User/register :::spoiler - parameters: - name: 暱稱 - account: 帳號 - password: 密碼 - mail: 電子郵件 - response - success: 註冊成功 ```json= { "code": 1, "message": "Registration success.", "data": [] } ``` - fail: 帳號已被註冊 ```json= { "code": 0, "message": "Invalid input", "data": [ "account": "Account is already used." ] } ``` - fail: 電子郵件已被註冊 ```json= { "code": 0, "message": "Invalid input", "data": [ "mail": "Mail is already used." ] } ``` - fail: 欄位不能為空 ```json= { "code": 0, "message": "Invalid input", "data": [ "account": "Field cannot be empty.", "password": "Field cannot be empty." ] } ``` - fail: 格式錯誤 ```json= { "code": 0, "message": "Invalid input.", "data": [ "account": "Wrong format.", "mail": "Wrong format." ] } ``` ::: <!-- - 忘記密碼 --> - :closed_lock_with_key: :accept: 修改密碼 http://120.110.114.73:23080/index.php/api/User/modifypassword :::spoiler - parameters: - password: 密碼 - newPassword: 新密碼 - response - success: 修改成功 ```json= { "code": 1, "message": "Modify success.", "data": [] } ``` - fail: 舊密碼不正確 ```json= { "code": 0, "message": "Old password is wrong.", "data": [] } ``` ::: - :closed_lock_with_key: :accept: 修改暱稱 http://120.110.114.73:23080/index.php/api/User/modifyName :::spoiler - paramters: - newName: 新暱稱 - response: - success: 修改成功 ```json { "code": 1, "message": "Modify success." } ``` - fail: 欄位不能為空 ```json { "code": 0, "message": "Field cannot be empty." } ``` ::: - :closed_lock_with_key: 更換頭貼 - :closed_lock_with_key: :accept: 獲取個人資訊 http://120.110.114.73:23080/index.php/api/User/getUserInformation :::spoiler - paramters: - response: - success: 獲取成功 ```json { code: 1, message: "Success.", "data": { "name": "222222", "mail": "111@gmail.com", "account": "11111", "total_answered_amount": "0", "total_correct_amount": "0", "photo_path": null } } ``` ::: <!-- - 登入天數 --> # 歷史紀錄 規劃者/彬瑞 製作者/ - :closed_lock_with_key: :accept: 獲取全部歷史紀錄: http://120.110.114.73:23080/index.php/api/History/getList :::spoiler - parameters: [] - response - success: 成功 ```json= { "code": 1, "message": "success", "data": [ { "id": "1", "user_id": "1", "score": "100", "average_correct_rate": "0", "average_time_used": "5", "time": "2020-02-26 15:08:29" } ] } ``` - fail: 錯誤 ```json= { "code": 0, "message": "No data found.", "data": [] } ``` ::: - :closed_lock_with_key: :accept: 獲取紀錄的詳細資訊 http://120.110.114.73:23080/index.php/api/History/getDetail :::warning # 備註 ## selected_option 若此選項為 0,則為使用使用者沒有回答這個問題 1、2、3、4 分別代表選擇了 option_1、option_2、option_3、option_4 ## correctness 0 為 錯誤,1 為正確 ::: :::spoiler - parameters: - history_id - response - success: 成功 ```json= { "code": 1, "message": "Success.", "data": [ { "history_id": "5", "question_id": "14", "selected_option": "0", "correctness": "0", "time_used": "0", "score": "0", "time": "2020-02-27 15:39:20", "author_id": "1", "category_id": "2", "title": "請問如果想要撈出 app 資料庫中 user 資料表的 id, name, account 欄位,如何下才是正確的?", "option_1": "SELECT * FROM user", "option_2": "SELECT id, name, account FROM app", "option_3": "SELECT id, name, account FROM user", "option_4": "SELECT * FROM app", "answer": "3" } ] } ``` - fail: 錯誤 ```json= { "code": 0, "message": "No data found.", "data": [] } ``` ::: # 題目 規劃者/柏瑄 製作者/彬瑞、泓亦 - :closed_lock_with_key: :accept: 獲取題目類別: http://120.110.114.73:23080/index.php/api/Category/getAllCategory :::spoiler - parameters: [] - response: - success: 獲取成功 ```json= { "code": 1, "message": "Success.", "data": [ { "id": "1", "abstract_category_id": "1", "difficulty": "易", "question_amount": "0", "title": "SQL", "group_title": "1", "group_image_path": null, "group_id": "1" }, { "id": "2", "abstract_category_id": "1", "difficulty": "中", "question_amount": "1", "title": "SQL", "group_title": "1", "group_image_path": null, "group_id": "1" }, { "id": "3", "abstract_category_id": "1", "difficulty": "難", "question_amount": "0", "title": "SQL", "group_title": "1", "group_image_path": null, "group_id": "1" }, { "id": "4", "abstract_category_id": "2", "difficulty": "易", "question_amount": "0", "title": "ListView", "group_title": "2", "group_image_path": null, "group_id": "2" }, { "id": "5", "abstract_category_id": "2", "difficulty": "中", "question_amount": "0", "title": "ListView", "group_title": "2", "group_image_path": null, "group_id": "2" }, ... ] } ``` ::: <!-- - 題目難易度 --> - :closed_lock_with_key: :accept: 獲取題目: http://120.110.114.73:23080/index.php/api/Question/startGame :::spoiler - parameters: - category_id: 類別id - response - success: 如果題目不足十題 ```json= { "code": 1, "message": "Success.", "data": { "history_id": 4, "questions": [ { "id": "1", "category_id": "3", "title": "請問如果想要撈出 app 資料庫中 user 資料表的 id, name, account 欄位,如何下才是正確的?", "option_1": "SELECT * FROM user", "option_2": "SELECT id, name, account FROM app", "option_3": "SELECT id, name, account FROM user", "option_4": "SELECT * FROM app", "time_limit": "15" }, { "id": "2", "category_id": "3", "title": "請問如果想要撈出 app 資料庫中 user 資料表的 id, name, account 欄位,如何下才是正確的?", "option_1": "SELECT * FROM user", "option_2": "SELECT id, name, account FROM app", "option_3": "SELECT id, name, account FROM user", "option_4": "SELECT * FROM app", "time_limit": "15" }, { "id": "3", "category_id": "3", "title": "請問如果想要撈出 app 資料庫中 user 資料表的 id, name, account 欄位,如何下才是正確的?", "option_1": "SELECT * FROM user", "option_2": "SELECT id, name, account FROM app", "option_3": "SELECT id, name, account FROM user", "option_4": "SELECT * FROM app", "time_limit": "15" } ... ] } } ``` - sucess: 如果題目完整 ```json= { "code": 1, "message": "Success.", "data": { "history_id": 5, "questions": [ { "id": "51", "category_id": "2", "title": "請問如果想要撈出 app 資料庫中 user 資料表的 id, name, account 欄位,如何下才是正確的?", "option_1": "SELECT * FROM user", "option_2": "SELECT id, name, account FROM app", "option_3": "SELECT id, name, account FROM user", "option_4": "SELECT * FROM app", "time_limit": "15" }, { "id": "22", "category_id": "2", "title": "請問如果想要撈出 app 資料庫中 user 資料表的 id, name, account 欄位,如何下才是正確的?", "option_1": "SELECT * FROM user", "option_2": "SELECT id, name, account FROM app", "option_3": "SELECT id, name, account FROM user", "option_4": "SELECT * FROM app", "time_limit": "15" }, { "id": "34", "category_id": "2", "title": "請問如果想要撈出 app 資料庫中 user 資料表的 id, name, account 欄位,如何下才是正確的?", "option_1": "SELECT * FROM user", "option_2": "SELECT id, name, account FROM app", "option_3": "SELECT id, name, account FROM user", "option_4": "SELECT * FROM app", "time_limit": "15" } ... } ``` - fail: 建立歷史紀錄失敗 ```json= { "code": 0, "message": "Error, create history failed.", "data": [] } ``` - fail: 找不到題目 ```json= { "code": 0, "message": "Error, no question found.", "data": [] } ``` - fail: 沒有提供 Category ID ```json= { "code": 0, "message": "No category id given.", "data": [] } ``` ::: - :closed_lock_with_key: 回答題目 :::spoiler - parameter - history_id: 歷史紀錄流水號 - question_id: 問題流水號 - selected_option: 選了哪個選項 (1, 2, 3, 4) - time_used: 做題使用幾秒 - response - success ```json= { "code": 1, "message": "Update success.", "data": { "id": "7", "user_id": "1", "score": "293", "total_answered_amount": "1", "total_correct_amount": "1", "total_time_limit": "15", "total_time_used": "8", "average_correct_rate": "0", "average_time_used": "0", "time": "2020-02-27 16:18:29" } } ``` - failed: 沒有相符的紀錄 ```json= { "code": 0, "message": "Did not found any history detail with provided history_id and question_id.", "data": [] } ``` - failed: 選項無效 ```json= { "code": 0, "message": "Provided selected_option is not valid.", "data": [] } ``` ::: <!-- - 線上對戰 --> # 排行榜 規劃者/柏瑄 製作者/嘉洋 - :closed_lock_with_key: 獲取排行榜 :::spoiler - parameter - selectedCatagories : 選擇類別 - type(array) - response - sucess 成功 ```json= { "code": 1, "message": "Success.", "data": [ { "user_id": "7", "name": "kk" "score": "1200", }, { "user_id": "1", "name": "管理員", "score": "500", }, { "user_id": "23", "name": "wqewqe", "score": "500", }, { "user_id": "15", "name": "kkf", "score": "100", } ] } ``` - fail 無任何使用者排行紀錄 ```json= { "code": 0, "message": ":Lack of class score.", "data": [] } ``` ::: <!-- - 勝率制 --> # 大家的規劃文件 - [彬瑞](/eVH3h8DHR8OEnTxVrqzMWg) - [柏瑄](/zr8lF_gIQKK2A2WjfD7CFA) - [泓亦](/LGAQp5ZCTN6JS6FAgDgrgw) <style> details { border: 1px solid gray; border-radius: 10px; padding: 15px; margin: 5px; box-shadow: 5px 5px lightgray; } details summary:after { content: "詳細資訊"; } </style>

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully