feat(platform): aggregate realtime by vehicle

This commit is contained in:
lingniu
2026-07-03 23:09:28 +08:00
parent 71b714bbf7
commit 37f9d7a307
12 changed files with 291 additions and 13 deletions

View File

@@ -29,6 +29,7 @@ func (h *Handler) routes() {
h.mux.HandleFunc("GET /api/vehicles", h.handleVehicles)
h.mux.HandleFunc("GET /api/vehicles/coverage", h.handleVehicleCoverage)
h.mux.HandleFunc("GET /api/vehicles/detail", h.handleVehicleDetail)
h.mux.HandleFunc("GET /api/realtime/vehicles", h.handleVehicleRealtime)
h.mux.HandleFunc("GET /api/realtime/locations", h.handleRealtimeLocations)
h.mux.HandleFunc("GET /api/history/locations", h.handleHistoryLocations)
h.mux.HandleFunc("GET /api/history/raw-frames", h.handleRawFramesGet)
@@ -63,6 +64,11 @@ func (h *Handler) handleVehicleDetail(w http.ResponseWriter, r *http.Request) {
h.write(w, r, data, err)
}
func (h *Handler) handleVehicleRealtime(w http.ResponseWriter, r *http.Request) {
data, err := h.service.VehicleRealtime(r.Context(), r.URL.Query())
h.write(w, r, data, err)
}
func (h *Handler) handleRealtimeLocations(w http.ResponseWriter, r *http.Request) {
data, err := h.service.RealtimeLocations(r.Context(), r.URL.Query())
h.write(w, r, data, err)