fix bugs
Signed-off-by: devad <cossjie@foxmail.com> Former-commit-id: 9c6277828c079646dc8dc9be70aab65d893444d6
This commit is contained in:
parent
4fda5e80bf
commit
56a60801b5
|
@ -5,7 +5,7 @@ import (
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/apps"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/apps"
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/jcce-pcm/utils/result"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/apps"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/apps"
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/jcce-pcm/utils/result"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package apps
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes/kubernetes"
|
"gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes/kubernetes"
|
||||||
|
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||||
|
@ -25,15 +24,16 @@ func NewAppDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AppDeta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *AppDetailLogic) AppDetail(req *types.AppDetailReq) (resp *types.AppDetailResp, err error) {
|
func (l *AppDetailLogic) AppDetail(req *types.AppDetailReq) (resp *kubernetes.AppDetailResp, err error) {
|
||||||
// todo: add your logic here and delete this line
|
|
||||||
fmt.Println(req.Name)
|
|
||||||
//调用p端接口
|
//调用p端接口
|
||||||
appDetail, err := l.svcCtx.K8sRpc[1727670068428410880].GetAppDetail(context.Background(), &kubernetes.AppDetailReq{
|
appDetail, err := l.svcCtx.K8sRpc[1727670068428410880].GetAppDetail(context.Background(), &kubernetes.AppDetailReq{
|
||||||
Namespace: req.NsID,
|
Namespace: req.NsID,
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
})
|
})
|
||||||
fmt.Println("应用详情:", appDetail)
|
if err != nil {
|
||||||
|
appDetail.Code = "500"
|
||||||
return
|
appDetail.Msg = err.Error()
|
||||||
|
}
|
||||||
|
appDetail.Code = "200"
|
||||||
|
return appDetail, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package {{.PkgName}}
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/jcce-pcm/utils/result"
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
|
||||||
"net/http"
|
"net/http"
|
||||||
{{.ImportPackages}}
|
{{.ImportPackages}}
|
||||||
)
|
)
|
||||||
|
|
|
@ -47,6 +47,10 @@ func HttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err er
|
||||||
body.Data = resp
|
body.Data = resp
|
||||||
httpx.OkJson(w, body)
|
httpx.OkJson(w, body)
|
||||||
return
|
return
|
||||||
|
} else if body.Msg == "success" {
|
||||||
|
body.Code = 200
|
||||||
|
body.TraceID = traceIDFromContext(r.Context())
|
||||||
|
httpx.OkJson(w, body)
|
||||||
} else {
|
} else {
|
||||||
body.TraceID = traceIDFromContext(r.Context())
|
body.TraceID = traceIDFromContext(r.Context())
|
||||||
httpx.OkJson(w, body)
|
httpx.OkJson(w, body)
|
||||||
|
|
Loading…
Reference in New Issue