Signed-off-by: devad <cossjie@foxmail.com>

Former-commit-id: 9c6277828c079646dc8dc9be70aab65d893444d6
This commit is contained in:
devad 2023-11-24 16:51:40 +08:00
parent 4fda5e80bf
commit 56a60801b5
5 changed files with 14 additions and 10 deletions

View File

@ -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/svc"
"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"
)

View File

@ -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/svc"
"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"
)

View File

@ -2,7 +2,6 @@ package apps
import (
"context"
"fmt"
"gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes/kubernetes"
"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) {
// todo: add your logic here and delete this line
fmt.Println(req.Name)
func (l *AppDetailLogic) AppDetail(req *types.AppDetailReq) (resp *kubernetes.AppDetailResp, err error) {
//调用p端接口
appDetail, err := l.svcCtx.K8sRpc[1727670068428410880].GetAppDetail(context.Background(), &kubernetes.AppDetailReq{
Namespace: req.NsID,
Name: req.Name,
})
fmt.Println("应用详情:", appDetail)
return
if err != nil {
appDetail.Code = "500"
appDetail.Msg = err.Error()
}
appDetail.Code = "200"
return appDetail, err
}

View File

@ -2,7 +2,7 @@ package {{.PkgName}}
import (
"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"
{{.ImportPackages}}
)

View File

@ -47,6 +47,10 @@ func HttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err er
body.Data = resp
httpx.OkJson(w, body)
return
} else if body.Msg == "success" {
body.Code = 200
body.TraceID = traceIDFromContext(r.Context())
httpx.OkJson(w, body)
} else {
body.TraceID = traceIDFromContext(r.Context())
httpx.OkJson(w, body)