1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-05 07:50:23 +08:00

finish accept message

This commit is contained in:
源文雨
2023-03-19 23:14:40 +08:00
parent 7d9b1456c4
commit 7abe88c190
4 changed files with 67 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package backend
import (
"encoding/json"
"net/http"
"strconv"
"strings"
"github.com/fumiama/paper-manager/backend/utils"
@@ -253,6 +254,20 @@ func init() {
}
writeresult(w, codeSuccess, ret, messageOk, typeSuccess)
}}
apimap["/api/acceptMessage"] = &apihandler{"GET", func(w http.ResponseWriter, r *http.Request) {
id, err := strconv.Atoi(r.URL.Query().Get("id"))
if err != nil {
writeresult(w, codeError, nil, err.Error(), typeError)
return
}
err = acceptMessage(r.Header.Get("Authorization"), id)
if err != nil {
writeresult(w, codeError, nil, err.Error(), typeError)
return
}
writeresult(w, codeSuccess, "成功", messageOk, typeSuccess)
}}
}
// APIHandler serves all backend /api call