diff --git a/desc/inference/inference.api b/desc/inference/inference.api index 7379c9a0..fd84a272 100644 --- a/desc/inference/inference.api +++ b/desc/inference/inference.api @@ -122,7 +122,7 @@ type ( } StartAllByDeployTaskIdReq { - Id string `form:"deployTaskid"` + Id string `form:"deployTaskId"` } StartAllByDeployTaskIdResp { @@ -130,7 +130,7 @@ type ( } StopAllByDeployTaskIdReq { - Id string `form:"deployTaskid"` + Id string `form:"deployTaskId"` } StopAllByDeployTaskIdResp { diff --git a/internal/handler/inference/startallbydeploytaskidhandler.go b/internal/handler/inference/startallbydeploytaskidhandler.go index 49cd0f7a..38e016c5 100644 --- a/internal/handler/inference/startallbydeploytaskidhandler.go +++ b/internal/handler/inference/startallbydeploytaskidhandler.go @@ -1,6 +1,7 @@ package inference import ( + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -13,16 +14,13 @@ func StartAllByDeployTaskIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc return func(w http.ResponseWriter, r *http.Request) { var req types.StartAllByDeployTaskIdReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := inference.NewStartAllByDeployTaskIdLogic(r.Context(), svcCtx) resp, err := l.StartAllByDeployTaskId(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) + } } diff --git a/internal/handler/inference/stopallbydeploytaskidhandler.go b/internal/handler/inference/stopallbydeploytaskidhandler.go index edaad256..cb2c470c 100644 --- a/internal/handler/inference/stopallbydeploytaskidhandler.go +++ b/internal/handler/inference/stopallbydeploytaskidhandler.go @@ -1,6 +1,7 @@ package inference import ( + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -13,16 +14,13 @@ func StopAllByDeployTaskIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.StopAllByDeployTaskIdReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := inference.NewStopAllByDeployTaskIdLogic(r.Context(), svcCtx) resp, err := l.StopAllByDeployTaskId(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) + } }