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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user