1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-12 12:10:25 +08:00

finish dashboard/anaylsis

This commit is contained in:
源文雨
2023-03-21 23:30:52 +08:00
parent 6269a9544f
commit f2a26a6067
5 changed files with 26 additions and 7 deletions

View File

@@ -375,6 +375,20 @@ func init() {
}
writeresult(w, codeSuccess, "成功", messageOk, typeSuccess)
}}
apimap["/api/getAnnualVisits"] = &apihandler{"GET", func(w http.ResponseWriter, r *http.Request) {
token := r.Header.Get("Authorization")
user := usertokens.Get(token)
if user == nil {
writeresult(w, codeError, nil, errInvalidToken.Error(), typeError)
return
}
if !user.IsSuper() {
writeresult(w, codeError, nil, errNoSetRolePermission.Error(), typeError)
return
}
writeresult(w, codeSuccess, global.UserDB.GetAnnualAPIVisitCount(), messageOk, typeSuccess)
}}
}
// APIHandler serves all backend /api call