NKUST-ITC / NKUST-AP-API

NKUST-AP-v3-完善計畫
MIT License
7 stars 5 forks source link

支援學校各項QR掃描 #90

Closed takidog closed 4 years ago

takidog commented 4 years ago

除課堂QR code掃描之外 也許會同時有多個需要掃QR code的服務

應該要像請假系統可以讓使用者選擇對應的服務(? e.g. GET /xxx/info

{
    "data": [
        {
            "service_id": "service_1234",
            "name": "上課掃QR",
            "description": "就是要你上課掃",
            "require": [
                "GPS"
            ]
        },
        {
            "service_id": "service_4567",
            "name": "其他掃QR",
            "description": "說明",
            "require": []
        }
    ],
    "default": {
        "service_id": "abcd123",
        "name": "上課掃QR",
        "description": "就是要你上課掃",
        "require": [
            "GPS"
        ]
    }
}

POST or PUT /xxx/xxx?service_id=abcd123 request body

{
    "service_id": "service_1234",
    "require": {
        "longitude": 12.1,
        "latitude": 12.1
    }
}

service_id 看要放在內requests內還是query string

abc873693 commented 4 years ago

單純送qrcode上面的資訊而已

takidog commented 4 years ago

單純送qrcode上面的資訊而已

跟巡邏箱一樣ㄇ 拍下來在家裡自己掃(?

abc873693 commented 4 years ago

單純送qrcode上面的資訊而已

跟巡邏箱一樣ㄇ 拍下來在家裡自己掃(?

度 但是當然不建議這樣搞

takidog commented 4 years ago

單純送qrcode上面的資訊而已

跟巡邏箱一樣ㄇ 拍下來在家裡自己掃(?

度 但是當然不建議這樣搞

可能是我把它想得太高級了

abc873693 commented 4 years ago

預期App會加入一些限制

takidog commented 4 years ago

POST /event data

{
    "data":{url}
}

關於path我沒什麼頭緒 這樣應該可以 QR掃描後的東西直接往後端傳送就可以了

200成功 400失敗 500異常錯誤 503學校方timeout

401 校務通後端token過期或是失效 403 禁止使用

abc873693 commented 4 years ago

POST /event data

{
    "data":{url}
}

關於path我沒什麼頭緒 這樣應該可以 QR掃描後的東西直接往後端傳送就可以了

200成功 400失敗 500異常錯誤 503學校方timeout

401 校務通後端token過期或是失效 403 禁止使用

需要再補一個 非上課時間的錯誤 理論上系統會去看你的課表 來判斷現在可不可以打卡 有其他的就以此類推

另外 data應該只是個string?

takidog commented 4 years ago

因為我現在沒有辦法捕捉所有的錯誤

status code統一用500 再透過body回傳哪一種錯誤

像是leaves/submit的400一樣

前端的alert 直接顯示錯誤的description不知道這樣行不行

{
  "code": 530,
  "description": "Not in class time" 
}

補充

那是那套系統的response

{"status":"error","data":"查無此座位"}

我可以直接把description直接顯示他的錯誤

abc873693 commented 4 years ago

這樣好了 除了400、403我會用內建的回傳資訊 其他我才會直接回傳 description API 回傳統一使用這個

{
  "code": 530,
  "description": "Not in class time" 
}
takidog commented 4 years ago

feature/qr_check_in

暫時使用,可能沒有合併的必要 先關閉