|
- package http
-
- import (
- "net/http"
-
- "github.com/gin-gonic/gin"
- "gitlink.org.cn/cloudream/jcs-pub/client/internal/http/types"
- cliapi "gitlink.org.cn/cloudream/jcs-pub/client/sdk/api/v1"
- "gitlink.org.cn/cloudream/jcs-pub/common/ecode"
- )
-
- type SystemService struct {
- *Server
- }
-
- func (s *Server) System() *SystemService {
- return &SystemService{
- Server: s,
- }
- }
-
- func (s *SystemService) Status(ctx *gin.Context) {
- var req cliapi.SystemStatus
- if err := ctx.ShouldBindQuery(&req); err != nil {
- ctx.JSON(http.StatusBadRequest, types.Failed(ecode.BadArgument, "%v", err))
- return
- }
-
- ctx.JSON(http.StatusOK, types.OK(cliapi.SystemStatusResp{
- SpeedStats: s.svc.SpeedStats.DumpStatus(),
- }))
- }
|