From a1b3aa4ba618134803b0ef5d76c84181902417f5 Mon Sep 17 00:00:00 2001 From: zhangwei <894646498@qq.com> Date: Tue, 22 Oct 2024 21:18:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4ceph?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 064ce4fba3268c9caa2a73b6fc9092a3da79340b --- desc/core/pcm-core.api | 2 +- desc/pcm.api | 4 -- internal/handler/routes.go | 5 -- .../handler/storage/screenstoragehandler.go | 24 ---------- internal/logic/core/getclusterbyidlogic.go | 2 +- internal/types/types.go | 46 +++++++++---------- 6 files changed, 25 insertions(+), 58 deletions(-) delete mode 100644 internal/handler/storage/screenstoragehandler.go diff --git a/desc/core/pcm-core.api b/desc/core/pcm-core.api index 86052596..79740d04 100644 --- a/desc/core/pcm-core.api +++ b/desc/core/pcm-core.api @@ -898,7 +898,7 @@ type ( RegionDict string `json:"regionDict,omitempty" db:"region_dict"` Location string `json:"location,omitempty" db:"location"` CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"` - Environment map[string]string `json:"environment,omitempty" db:"environment"` + Environment string `json:"environment,omitempty" db:"environment"` } ) diff --git a/desc/pcm.api b/desc/pcm.api index 9e3e7054..91ce46e0 100644 --- a/desc/pcm.api +++ b/desc/pcm.api @@ -400,10 +400,6 @@ service pcm { group: storage ) service pcm { - @doc "存储概览" - @handler screenStorageHandler - get /storage/screenStorage (StorageScreenReq) returns (StorageScreenResp) - @doc "日常算力查询" @handler dailyPowerScreenHandler get /storage/dailyPowerScreen returns (DailyPowerScreenResp) diff --git a/internal/handler/routes.go b/internal/handler/routes.go index 0891a8f8..a1a02c4b 100644 --- a/internal/handler/routes.go +++ b/internal/handler/routes.go @@ -473,11 +473,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { server.AddRoutes( []rest.Route{ - { - Method: http.MethodGet, - Path: "/storage/screenStorage", - Handler: storage.ScreenStorageHandler(serverCtx), - }, { Method: http.MethodGet, Path: "/storage/dailyPowerScreen", diff --git a/internal/handler/storage/screenstoragehandler.go b/internal/handler/storage/screenstoragehandler.go deleted file mode 100644 index cebffc15..00000000 --- a/internal/handler/storage/screenstoragehandler.go +++ /dev/null @@ -1,24 +0,0 @@ -package storage - -import ( - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/storage" - "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" -) - -func ScreenStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StorageScreenReq - if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) - return - } - - l := storage.NewScreenStorageLogic(r.Context(), svcCtx) - resp, err := l.ScreenStorage(&req) - result.HttpResult(r, w, resp, err) - } -} diff --git a/internal/logic/core/getclusterbyidlogic.go b/internal/logic/core/getclusterbyidlogic.go index d622f5da..9337613b 100644 --- a/internal/logic/core/getclusterbyidlogic.go +++ b/internal/logic/core/getclusterbyidlogic.go @@ -26,7 +26,7 @@ func NewGetClusterByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge func (l *GetClusterByIdLogic) GetClusterById(req *types.GetClusterByIdReq) (resp *types.GetClusterByIdResp, err error) { resp = &types.GetClusterByIdResp{} - tx := l.svcCtx.DbEngin.Raw("select * from t_cluster where id = ?", req.ClusterId).Scan(&resp) + tx := l.svcCtx.DbEngin.Raw("select * from t_cluster where id = ?", req.ClusterId).Scan(&resp.ClusterInfo) if tx.Error != nil { logx.Errorf(tx.Error.Error()) return nil, errors.New("cluster create failed") diff --git a/internal/types/types.go b/internal/types/types.go index 21579b4b..28800461 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -812,29 +812,29 @@ type ClusterCreateReq struct { } type ClusterInfo struct { - Id string `json:"id,omitempty" db:"id"` - AdapterId string `json:"adapterId,omitempty" db:"adapter_id"` - Name string `json:"name,omitempty" db:"name"` - Nickname string `json:"nickname,omitempty" db:"nickname"` - Description string `json:"description,omitempty" db:"description"` - Server string `json:"server,omitempty" db:"server"` - MonitorServer string `json:"monitorServer,omitempty" db:"monitor_server"` - Username string `json:"username,omitempty" db:"username"` - Password string `json:"password,omitempty" db:"password"` - Token string `json:"token,omitempty" db:"token"` - Ak string `json:"ak,omitempty" db:"ak"` - Sk string `json:"sk,omitempty" db:"sk"` - Region string `json:"region,omitempty" db:"region"` - ProjectId string `json:"projectId,omitempty" db:"project_id"` - Version string `json:"version,omitempty" db:"version"` - Label string `json:"label,omitempty" db:"label"` - OwnerId string `json:"ownerId,omitempty" db:"owner_id"` - AuthType string `json:"authType,omitempty" db:"auth_type"` - ProducerDict string `json:"producerDict,omitempty" db:"producer_dict"` - RegionDict string `json:"regionDict,omitempty" db:"region_dict"` - Location string `json:"location,omitempty" db:"location"` - CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"` - Environment map[string]string `json:"environment,omitempty" db:"environment"` + Id string `json:"id,omitempty" db:"id"` + AdapterId string `json:"adapterId,omitempty" db:"adapter_id"` + Name string `json:"name,omitempty" db:"name"` + Nickname string `json:"nickname,omitempty" db:"nickname"` + Description string `json:"description,omitempty" db:"description"` + Server string `json:"server,omitempty" db:"server"` + MonitorServer string `json:"monitorServer,omitempty" db:"monitor_server"` + Username string `json:"username,omitempty" db:"username"` + Password string `json:"password,omitempty" db:"password"` + Token string `json:"token,omitempty" db:"token"` + Ak string `json:"ak,omitempty" db:"ak"` + Sk string `json:"sk,omitempty" db:"sk"` + Region string `json:"region,omitempty" db:"region"` + ProjectId string `json:"projectId,omitempty" db:"project_id"` + Version string `json:"version,omitempty" db:"version"` + Label string `json:"label,omitempty" db:"label"` + OwnerId string `json:"ownerId,omitempty" db:"owner_id"` + AuthType string `json:"authType,omitempty" db:"auth_type"` + ProducerDict string `json:"producerDict,omitempty" db:"producer_dict"` + RegionDict string `json:"regionDict,omitempty" db:"region_dict"` + Location string `json:"location,omitempty" db:"location"` + CreateTime string `json:"createTime,omitempty" db:"created_time" gorm:"autoCreateTime"` + Environment string `json:"environment,omitempty" db:"environment"` } type ClusterDelReq struct {