(w http.ResponseWriter, r *http.Request)
| 27 | } |
| 28 | |
| 29 | func (s *Service) GetUserOnlineStat(w http.ResponseWriter, r *http.Request) { |
| 30 | var request common.StatRequest |
| 31 | if err := common.ReadProtoBody(r.Body, &request); err != nil { |
| 32 | http.Error(w, err.Error(), http.StatusBadRequest) |
| 33 | return |
| 34 | } |
| 35 | |
| 36 | stats, err := s.Backend().GetUserOnlineStats(r.Context(), request.GetName()) |
| 37 | if err != nil { |
| 38 | err = common.InterceptNotFound(err) |
| 39 | st, _ := status.FromError(err) |
| 40 | httpCode := common.GrpcCodeToHTTP(st.Code()) |
| 41 | http.Error(w, err.Error(), httpCode) |
| 42 | return |
| 43 | } |
| 44 | |
| 45 | common.SendProtoResponse(w, stats) |
| 46 | } |
| 47 | |
| 48 | func (s *Service) GetUserOnlineIpListStats(w http.ResponseWriter, r *http.Request) { |
| 49 | var request common.StatRequest |
nothing calls this directly
no test coverage detected