完善了Web管理端

This commit is contained in:
2026-06-20 18:18:50 +08:00
parent aedc199777
commit c5f296fb0d
11 changed files with 735 additions and 82 deletions
+6
View File
@@ -4,6 +4,7 @@ import (
"Embalming_Girl_Server/admin"
"Embalming_Girl_Server/db"
"Embalming_Girl_Server/handler"
"encoding/json"
"log"
"net/http"
)
@@ -33,6 +34,11 @@ func main() {
"online_clients": hub.OnlineCount(),
}
})
admin.RegisterUpdateRoutes(mux)
mux.HandleFunc("/api/admin/online", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(hub.OnlineClientsList())
})
addr := ":8080"
log.Printf("Server started on %s", addr)