Former-commit-id: c20c9dbb5a
pull/71/head
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.AdapterQueryReq | var req types.AdapterQueryReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewAdaptersListLogic(r.Context(), svcCtx) | l := adapters.NewAdaptersListLogic(r.Context(), svcCtx) | ||||
| resp, err := l.AdaptersList(&req) | resp, err := l.AdaptersList(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ClusterReq | var req types.ClusterReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewClusterListLogic(r.Context(), svcCtx) | l := adapters.NewClusterListLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ClusterList(&req) | resp, err := l.ClusterList(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.AdapterCreateReq | var req types.AdapterCreateReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx) | l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateAdapter(&req) | resp, err := l.CreateAdapter(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ClusterCreateReq | var req types.ClusterCreateReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewCreateClusterLogic(r.Context(), svcCtx) | l := adapters.NewCreateClusterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateCluster(&req) | resp, err := l.CreateCluster(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.AdapterDelReq | var req types.AdapterDelReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx) | l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteAdapter(&req) | resp, err := l.DeleteAdapter(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.FId | var req types.FId | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx) | l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteCluster(&req) | resp, err := l.DeleteCluster(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.AdapterDelReq | var req types.AdapterDelReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewGetAdapterLogic(r.Context(), svcCtx) | l := adapters.NewGetAdapterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetAdapter(&req) | resp, err := l.GetAdapter(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.AdapterRelationQueryReq | var req types.AdapterRelationQueryReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx) | l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetAdapterRelation(&req) | resp, err := l.GetAdapterRelation(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.FId | var req types.FId | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewGetClusterLogic(r.Context(), svcCtx) | l := adapters.NewGetClusterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetCluster(&req) | resp, err := l.GetCluster(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ClusterSumReq | var req types.ClusterSumReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx) | l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetClusterSum(&req) | resp, err := l.GetClusterSum(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.AdapterReq | var req types.AdapterReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx) | l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.UpdateAdapter(&req) | resp, err := l.UpdateAdapter(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package adapters | package adapters | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ClusterCreateReq | var req types.ClusterCreateReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx) | l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.UpdateCluster(&req) | resp, err := l.UpdateCluster(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CreateAlgorithmReq | var req types.CreateAlgorithmReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx) | l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateAlgorithm(&req) | resp, err := l.CreateAlgorithm(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CreateDataSetReq | var req types.CreateDataSetReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewCreateDataSetLogic(r.Context(), svcCtx) | l := ai.NewCreateDataSetLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateDataSet(&req) | resp, err := l.CreateDataSet(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateExportTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateExportTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CreateExportTaskReq | var req types.CreateExportTaskReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx) | l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateExportTask(&req) | resp, err := l.CreateExportTask(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CreateNotebookReq | var req types.CreateNotebookReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewCreateNotebookLogic(r.Context(), svcCtx) | l := ai.NewCreateNotebookLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateNotebook(&req) | resp, err := l.CreateNotebook(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateProcessorTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateProcessorTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CreateProcessorTaskReq | var req types.CreateProcessorTaskReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx) | l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateProcessorTask(&req) | resp, err := l.CreateProcessorTask(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CreateServiceReq | var req types.CreateServiceReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewCreateServiceLogic(r.Context(), svcCtx) | l := ai.NewCreateServiceLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateService(&req) | resp, err := l.CreateService(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ImportTaskDataReq | var req types.ImportTaskDataReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewCreateTaskLogic(r.Context(), svcCtx) | l := ai.NewCreateTaskLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateTask(&req) | resp, err := l.CreateTask(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CreateTrainingJobReq | var req types.CreateTrainingJobReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx) | l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateTrainingJob(&req) | resp, err := l.CreateTrainingJob(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CreateVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CreateVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CreateVisualizationJobReq | var req types.CreateVisualizationJobReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx) | l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CreateVisualizationJob(&req) | resp, err := l.CreateVisualizationJob(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteAlgorithmReq | var req types.DeleteAlgorithmReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx) | l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteAlgorithm(&req) | resp, err := l.DeleteAlgorithm(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteDataSetReq | var req types.DeleteDataSetReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx) | l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteDataSet(&req) | resp, err := l.DeleteDataSet(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteServiceReq | var req types.DeleteServiceReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewDeleteServiceLogic(r.Context(), svcCtx) | l := ai.NewDeleteServiceLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteService(&req) | resp, err := l.DeleteService(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteTrainingJobReq | var req types.DeleteTrainingJobReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx) | l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteTrainingJob(&req) | resp, err := l.DeleteTrainingJob(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetExportTasksOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetExportTasksOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.GetExportTasksOfDatasetReq | var req types.GetExportTasksOfDatasetReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx) | l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetExportTasksOfDataset(&req) | resp, err := l.GetExportTasksOfDataset(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetExportTaskStatusOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetExportTaskStatusOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.GetExportTaskStatusOfDatasetReq | var req types.GetExportTaskStatusOfDatasetReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx) | l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetExportTaskStatusOfDataset(&req) | resp, err := l.GetExportTaskStatusOfDataset(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetListTrainingJobsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetListTrainingJobsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ListTrainingJobsreq | var req types.ListTrainingJobsreq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx) | l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetListTrainingJobs(&req) | resp, err := l.GetListTrainingJobs(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.GetNotebookStorageReq | var req types.GetNotebookStorageReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx) | l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetNotebookStorage(&req) | resp, err := l.GetNotebookStorage(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.GetVisualizationJobReq | var req types.GetVisualizationJobReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx) | l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetVisualizationJob(&req) | resp, err := l.GetVisualizationJob(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ListAlgorithmsReq | var req types.ListAlgorithmsReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx) | l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListAlgorithms(&req) | resp, err := l.ListAlgorithms(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListClustersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListClustersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ListClustersReq | var req types.ListClustersReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewListClustersLogic(r.Context(), svcCtx) | l := ai.NewListClustersLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListClusters(&req) | resp, err := l.ListClusters(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DataSetReq | var req types.DataSetReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewListDataSetLogic(r.Context(), svcCtx) | l := ai.NewListDataSetLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListDataSet(&req) | resp, err := l.ListDataSet(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListImportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListImportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ListImportTasksReq | var req types.ListImportTasksReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewListImportLogic(r.Context(), svcCtx) | l := ai.NewListImportLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListImport(&req) | resp, err := l.ListImport(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ListNotebookReq | var req types.ListNotebookReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewListNotebookLogic(r.Context(), svcCtx) | l := ai.NewListNotebookLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListNotebook(&req) | resp, err := l.ListNotebook(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListServicesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListServicesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ListServicesReq | var req types.ListServicesReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewListServicesLogic(r.Context(), svcCtx) | l := ai.NewListServicesLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListServices(&req) | resp, err := l.ListServices(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func MountNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func MountNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.MountNotebookStorageReq | var req types.MountNotebookStorageReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx) | l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx) | ||||
| resp, err := l.MountNotebookStorage(&req) | resp, err := l.MountNotebookStorage(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ShowAlgorithmByUuidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ShowAlgorithmByUuidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ShowAlgorithmByUuidReq | var req types.ShowAlgorithmByUuidReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx) | l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ShowAlgorithmByUuid(&req) | resp, err := l.ShowAlgorithmByUuid(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ShowServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ShowServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ShowServiceReq | var req types.ShowServiceReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewShowServiceLogic(r.Context(), svcCtx) | l := ai.NewShowServiceLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ShowService(&req) | resp, err := l.ShowService(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func StartNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func StartNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.StartNotebookReq | var req types.StartNotebookReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewStartNotebookLogic(r.Context(), svcCtx) | l := ai.NewStartNotebookLogic(r.Context(), svcCtx) | ||||
| resp, err := l.StartNotebook(&req) | resp, err := l.StartNotebook(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package ai | package ai | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func StopNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func StopNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.StopNotebookReq | var req types.StopNotebookReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := ai.NewStopNotebookLogic(r.Context(), svcCtx) | l := ai.NewStopNotebookLogic(r.Context(), svcCtx) | ||||
| resp, err := l.StopNotebook(&req) | resp, err := l.StopNotebook(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package apps | package apps | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func AppDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func AppDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.AppDetailReq | var req types.AppDetailReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := apps.NewAppDetailLogic(r.Context(), svcCtx) | l := apps.NewAppDetailLogic(r.Context(), svcCtx) | ||||
| resp, err := l.AppDetail(&req) | resp, err := l.AppDetail(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package apps | package apps | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func AppListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func AppListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.AppListReq | var req types.AppListReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := apps.NewAppListLogic(r.Context(), svcCtx) | l := apps.NewAppListLogic(r.Context(), svcCtx) | ||||
| resp, err := l.AppList(&req) | resp, err := l.AppList(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package apps | package apps | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func AppPodsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func AppPodsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.AppDetailReq | var req types.AppDetailReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := apps.NewAppPodsLogic(r.Context(), svcCtx) | l := apps.NewAppPodsLogic(r.Context(), svcCtx) | ||||
| resp, err := l.AppPods(&req) | resp, err := l.AppPods(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package apps | package apps | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteAppReq | var req types.DeleteAppReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx) | l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteAppByAppName(&req) | resp, err := l.DeleteAppByAppName(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package apps | package apps | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.AppDetailReq | var req types.AppDetailReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := apps.NewGetAppByAppNameLogic(r.Context(), svcCtx) | l := apps.NewGetAppByAppNameLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetAppByAppName(&req) | resp, err := l.GetAppByAppName(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package apps | package apps | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func PauseAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func PauseAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteAppReq | var req types.DeleteAppReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx) | l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx) | ||||
| resp, err := l.PauseAppByAppName(&req) | resp, err := l.PauseAppByAppName(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package apps | package apps | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func RestartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func RestartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteAppReq | var req types.DeleteAppReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx) | l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx) | ||||
| resp, err := l.RestartAppByAppName(&req) | resp, err := l.RestartAppByAppName(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package apps | package apps | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func StartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func StartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteAppReq | var req types.DeleteAppReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx) | l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx) | ||||
| resp, err := l.StartAppByAppName(&req) | resp, err := l.StartAppByAppName(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package apps | package apps | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func UpdateAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func UpdateAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteAppReq | var req types.DeleteAppReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx) | l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx) | ||||
| resp, err := l.UpdateAppByAppName(&req) | resp, err := l.UpdateAppByAppName(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package cloud | package cloud | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := cloud.NewCloudListLogic(r.Context(), svcCtx) | l := cloud.NewCloudListLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CloudList() | resp, err := l.CloudList() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package cloud | package cloud | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ControllerMetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ControllerMetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ControllerMetricsReq | var req types.ControllerMetricsReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx) | l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ControllerMetrics(&req) | resp, err := l.ControllerMetrics(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package cloud | package cloud | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteClusterReq | var req types.DeleteClusterReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx) | l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteCluster(&req) | resp, err := l.DeleteCluster(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package cloud | package cloud | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ApplyReq | var req types.ApplyReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx) | l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteYaml(&req) | resp, err := l.DeleteYaml(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package cloud | package cloud | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.GetClusterListReq | var req types.GetClusterListReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := cloud.NewGetClusterListLogic(r.Context(), svcCtx) | l := cloud.NewGetClusterListLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetClusterList(&req) | resp, err := l.GetClusterList(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package cloud | package cloud | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func NoticeTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func NoticeTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx) | l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx) | ||||
| resp, err := l.NoticeTenant() | resp, err := l.NoticeTenant() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package cloud | package cloud | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func RegisterClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func RegisterClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.RegisterClusterReq | var req types.RegisterClusterReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx) | l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.RegisterCluster(&req) | resp, err := l.RegisterCluster(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package cloud | package cloud | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func UpdateTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func UpdateTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.UpdateTenantReq | var req types.UpdateTenantReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := cloud.NewUpdateTenantLogic(r.Context(), svcCtx) | l := cloud.NewUpdateTenantLogic(r.Context(), svcCtx) | ||||
| resp, err := l.UpdateTenant(&req) | resp, err := l.UpdateTenant(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CenterResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CenterResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewCenterResourcesLogic(r.Context(), svcCtx) | l := core.NewCenterResourcesLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CenterResources() | resp, err := l.CenterResources() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CommitTaskReq | var req types.CommitTaskReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := core.NewCommitTaskLogic(r.Context(), svcCtx) | l := core.NewCommitTaskLogic(r.Context(), svcCtx) | ||||
| err := l.CommitTask(&req) | err := l.CommitTask(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.Ok(w) | |||||
| } | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CommitVmTaskReq | var req types.CommitVmTaskReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := core.NewCommitVmTaskLogic(r.Context(), svcCtx) | l := core.NewCommitVmTaskLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CommitVmTask(&req) | resp, err := l.CommitVmTask(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DeleteTaskReq | var req types.DeleteTaskReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := core.NewDeleteTaskLogic(r.Context(), svcCtx) | l := core.NewDeleteTaskLogic(r.Context(), svcCtx) | ||||
| err := l.DeleteTask(&req) | err := l.DeleteTask(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.Ok(w) | |||||
| } | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetComputilityStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetComputilityStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewGetComputilityStatisticsLogic(r.Context(), svcCtx) | l := core.NewGetComputilityStatisticsLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetComputilityStatistics() | resp, err := l.GetComputilityStatistics() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetComputingPowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetComputingPowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewGetComputingPowerLogic(r.Context(), svcCtx) | l := core.NewGetComputingPowerLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetComputingPower() | resp, err := l.GetComputingPower() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetGeneralInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetGeneralInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewGetGeneralInfoLogic(r.Context(), svcCtx) | l := core.NewGetGeneralInfoLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetGeneralInfo() | resp, err := l.GetGeneralInfo() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewGetRegionLogic(r.Context(), svcCtx) | l := core.NewGetRegionLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetRegion() | resp, err := l.GetRegion() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx) | l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetResourcePanelConfig() | resp, err := l.GetResourcePanelConfig() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewJobTotalLogic(r.Context(), svcCtx) | l := core.NewJobTotalLogic(r.Context(), svcCtx) | ||||
| resp, err := l.JobTotal() | resp, err := l.JobTotal() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListCenterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListCenterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewListCenterLogic(r.Context(), svcCtx) | l := core.NewListCenterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListCenter() | resp, err := l.ListCenter() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ListClusterReq | var req types.ListClusterReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := core.NewListClusterLogic(r.Context(), svcCtx) | l := core.NewListClusterLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListCluster(&req) | resp, err := l.ListCluster(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewListDomainResourceLogic(r.Context(), svcCtx) | l := core.NewListDomainResourceLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListDomainResource() | resp, err := l.ListDomainResource() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewListRegionLogic(r.Context(), svcCtx) | l := core.NewListRegionLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListRegion() | resp, err := l.ListRegion() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewMetricsLogic(r.Context(), svcCtx) | l := core.NewMetricsLogic(r.Context(), svcCtx) | ||||
| err := l.Metrics() | err := l.Metrics() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.Ok(w) | |||||
| } | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewNodeAssetsLogic(r.Context(), svcCtx) | l := core.NewNodeAssetsLogic(r.Context(), svcCtx) | ||||
| resp, err := l.NodeAssets() | resp, err := l.NodeAssets() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := core.NewParticipantListLogic(r.Context(), svcCtx) | l := core.NewParticipantListLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ParticipantList() | resp, err := l.ParticipantList() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ResourcePanelConfigReq | var req types.ResourcePanelConfigReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx) | l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx) | ||||
| err := l.PutResourcePanelConfig(&req) | err := l.PutResourcePanelConfig(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.Ok(w) | |||||
| } | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.SyncClusterLoadReq | var req types.SyncClusterLoadReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx) | l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx) | ||||
| err := l.SyncClusterLoad(&req) | err := l.SyncClusterLoad(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.Ok(w) | |||||
| } | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.TaskDetailReq | var req types.TaskDetailReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := core.NewTaskDetailLogic(r.Context(), svcCtx) | l := core.NewTaskDetailLogic(r.Context(), svcCtx) | ||||
| resp, err := l.TaskDetail(&req) | resp, err := l.TaskDetail(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package core | package core | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func TaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func TaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.TaskListReq | var req types.TaskListReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := core.NewTaskListLogic(r.Context(), svcCtx) | l := core.NewTaskListLogic(r.Context(), svcCtx) | ||||
| resp, err := l.TaskList(&req) | resp, err := l.TaskList(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DictEditReq | var req types.DictEditReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewAddDictLogic(r.Context(), svcCtx) | l := dictionary.NewAddDictLogic(r.Context(), svcCtx) | ||||
| resp, err := l.AddDict(&req) | resp, err := l.AddDict(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DictItemEditReq | var req types.DictItemEditReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx) | l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx) | ||||
| resp, err := l.AddDictItem(&req) | resp, err := l.AddDictItem(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CId | var req types.CId | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx) | l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteDict(&req) | resp, err := l.DeleteDict(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CId | var req types.CId | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx) | l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DeleteDictItem(&req) | resp, err := l.DeleteDictItem(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DictEditReq | var req types.DictEditReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewEditDictLogic(r.Context(), svcCtx) | l := dictionary.NewEditDictLogic(r.Context(), svcCtx) | ||||
| resp, err := l.EditDict(&req) | resp, err := l.EditDict(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DictItemEditReq | var req types.DictItemEditReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx) | l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx) | ||||
| resp, err := l.EditDictItem(&req) | resp, err := l.EditDictItem(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CId | var req types.CId | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewGetDictLogic(r.Context(), svcCtx) | l := dictionary.NewGetDictLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetDict(&req) | resp, err := l.GetDict(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CId | var req types.CId | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx) | l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx) | ||||
| resp, err := l.GetDictItem(&req) | resp, err := l.GetDictItem(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DictReq | var req types.DictReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewListDictLogic(r.Context(), svcCtx) | l := dictionary.NewListDictLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListDict(&req) | resp, err := l.ListDict(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DictCodeReq | var req types.DictCodeReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx) | l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListDictItemByCode(&req) | resp, err := l.ListDictItemByCode(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package dictionary | package dictionary | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.DictItemReq | var req types.DictItemReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := dictionary.NewListDictItemLogic(r.Context(), svcCtx) | l := dictionary.NewListDictItemLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListDictItem(&req) | resp, err := l.ListDictItem(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package hpc | package hpc | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CommitHpcTaskReq | var req types.CommitHpcTaskReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx) | l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx) | ||||
| resp, err := l.CommitHpcTask(&req) | resp, err := l.CommitHpcTask(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package hpc | package hpc | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListHistoryJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListHistoryJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ListHistoryJobReq | var req types.ListHistoryJobReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx) | l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListHistoryJob(&req) | resp, err := l.ListHistoryJob(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package hpc | package hpc | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.ListJobReq | var req types.ListJobReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := hpc.NewListJobLogic(r.Context(), svcCtx) | l := hpc.NewListJobLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ListJob(&req) | resp, err := l.ListJob(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package hpc | package hpc | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx) | l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx) | ||||
| resp, err := l.QueueAssets() | resp, err := l.QueueAssets() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package image | package image | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := image.NewChunkLogic(r.Context(), svcCtx) | l := image.NewChunkLogic(r.Context(), svcCtx) | ||||
| err := l.Chunk() | err := l.Chunk() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.Ok(w) | |||||
| } | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,28 +1,24 @@ | |||||
| package image | package image | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | "github.com/zeromicro/go-zero/rest/httpx" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func DataSetCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func DataSetCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| var req types.CheckReq | var req types.CheckReq | ||||
| if err := httpx.Parse(r, &req); err != nil { | if err := httpx.Parse(r, &req); err != nil { | ||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | return | ||||
| } | } | ||||
| l := image.NewDataSetCheckLogic(r.Context(), svcCtx) | l := image.NewDataSetCheckLogic(r.Context(), svcCtx) | ||||
| resp, err := l.DataSetCheck(&req) | resp, err := l.DataSetCheck(&req) | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package image | package image | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := image.NewImageListLogic(r.Context(), svcCtx) | l := image.NewImageListLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ImageList() | resp, err := l.ImageList() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package image | package image | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := image.NewUploadDataSetLogic(r.Context(), svcCtx) | l := image.NewUploadDataSetLogic(r.Context(), svcCtx) | ||||
| err := l.UploadDataSet() | err := l.UploadDataSet() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.Ok(w) | |||||
| } | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package image | package image | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := image.NewUploadLogic(r.Context(), svcCtx) | l := image.NewUploadLogic(r.Context(), svcCtx) | ||||
| err := l.Upload() | err := l.Upload() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.Ok(w) | |||||
| } | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,21 +1,16 @@ | |||||
| package schedule | package schedule | ||||
| import ( | import ( | ||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | ) | ||||
| func ScheduleGetAiResourceTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | func ScheduleGetAiResourceTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||||
| return func(w http.ResponseWriter, r *http.Request) { | return func(w http.ResponseWriter, r *http.Request) { | ||||
| l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx) | l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx) | ||||
| resp, err := l.ScheduleGetAiResourceTypes() | resp, err := l.ScheduleGetAiResourceTypes() | ||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | } | ||||
| } | } | ||||