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

add dashboard/account

This commit is contained in:
源文雨
2023-03-21 00:29:25 +08:00
parent 1573b63d8b
commit dae0830d24
15 changed files with 463 additions and 49 deletions

View File

@@ -120,6 +120,31 @@ func init() {
writeresult(w, codeSuccess, n, messageOk, typeSuccess)
}}
apimap["/api/getUsersList"] = &apihandler{"GET", func(w http.ResponseWriter, r *http.Request) {
token := r.Header.Get("Authorization")
ret, err := getUsersList(token)
if err != nil {
writeresult(w, codeError, nil, err.Error(), typeError)
return
}
writeresult(w, codeSuccess, &ret, messageOk, typeSuccess)
}}
apimap["/api/isNameExist"] = &apihandler{"GET", func(w http.ResponseWriter, r *http.Request) {
token := r.Header.Get("Authorization")
name := r.URL.Query().Get("username")
if name == "" {
writeresult(w, codeError, nil, "empty username", typeError)
return
}
yes, err := isNameExist(token, name)
if err != nil {
writeresult(w, codeError, nil, err.Error(), typeError)
return
}
writeresult(w, codeSuccess, yes, messageOk, typeSuccess)
}}
apimap["/api/setPassword"] = &apihandler{"POST", func(w http.ResponseWriter, r *http.Request) {
type setpasswordbody struct {
Token string `json:"token"`