forked from JointCloud/pcm-coordinator
parent
c94c0a00c2
commit
cbc4a679bc
|
@ -5,9 +5,8 @@ import (
|
|||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -18,12 +17,15 @@ func PageListTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
token := r.Header.Get("Authorization")
|
||||
// 获取用户信息
|
||||
userStr := r.Header.Get("User")
|
||||
user := &models.JccUserInfo{}
|
||||
json.Unmarshal([]byte(userStr), user)
|
||||
req.UserId = user.Id
|
||||
req.UserName = user.UserName
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.UserId = jccUserInfo.Id
|
||||
req.UserName = jccUserInfo.UserName
|
||||
l := core.NewPageListTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.PageListTask(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
|
|
|
@ -2,6 +2,7 @@ package inference
|
|||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
|
@ -17,7 +18,14 @@ func CreateInferenceTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
token := r.Header.Get("Authorization")
|
||||
// 获取用户信息
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.UserId = jccUserInfo.Id
|
||||
l := inference.NewCreateInferenceTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateInferenceTask(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/inference"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -18,12 +17,15 @@ func DeployInstanceListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
userStr := r.Header.Get("User")
|
||||
user := &models.JccUserInfo{}
|
||||
json.Unmarshal([]byte(userStr), user)
|
||||
req.UserId = user.Id
|
||||
req.UserName = user.UserName
|
||||
token := r.Header.Get("Authorization")
|
||||
// 获取用户信息
|
||||
jccUserInfo, err := utils.ParseTokenWithoutVerify(token)
|
||||
if err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.UserId = jccUserInfo.Id
|
||||
req.UserName = jccUserInfo.UserName
|
||||
|
||||
l := inference.NewDeployInstanceListLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeployInstanceList(&req)
|
||||
|
|
Loading…
Reference in New Issue