Browse Source

创建智算任务增加token

pull/380/head
zhangwei 10 months ago
parent
commit
a458c85231
5 changed files with 17 additions and 12 deletions
  1. +11
    -11
      desc/core/pcm-core.api
  2. +3
    -1
      internal/handler/cloud/commitgeneraltaskhandler.go
  3. +1
    -0
      internal/logic/cloud/commitgeneraltasklogic.go
  4. +1
    -0
      internal/types/types.go
  5. +1
    -0
      pkg/utils/remoteUtil/BlockChain.go

+ 11
- 11
desc/core/pcm-core.api View File

@@ -157,6 +157,7 @@ type (

type (
GeneralTaskReq {
Token string `json:"token"`
Name string `json:"name"`
AdapterIds []string `json:"adapterIds"`
ClusterIds []string `json:"clusterIds"`
@@ -317,8 +318,8 @@ type (
}
)

type(
asynCommitAiTaskReq{
type (
asynCommitAiTaskReq {
Name string `json:"name,optional"`
AdapterIds []string `json:"adapterIds,optional"`
ClusterIds []string `json:"clusterIds,optional"`
@@ -329,15 +330,14 @@ type(
Command string `json:"command,optional"`
FlavorId string `json:"flavorId,optional"`
Status string `json:"status,optional"`
ClusterId int64 `json:"clusterId,optional"`
AdapterId string `json:"adapterId,optional"`

ClusterId int64 `json:"clusterId,optional"`
AdapterId string `json:"adapterId,optional"`
}

asynCommitAiTaskResp{
Code int32 `json:"code"`
Msg string `json:"msg"`
TaskId int64 `json:"taskId"`
asynCommitAiTaskResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
TaskId int64 `json:"taskId"`
}
)

@@ -991,7 +991,7 @@ type adapterInfoNameReqResp {
Code int32 `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
ErrorMsg string `json:"errorMsg,omitempty"`
InfoList InfoList `json:"infoList,omitempty"`
InfoList InfoList `json:"infoList,omitempty"`
}

type InfoList {
@@ -1279,7 +1279,7 @@ type (
TaskName string `json:"taskName"`
Incident string `json:"incident"`
}
ListNoticeReq{
ListNoticeReq {
}

ListNoticeResp {


+ 3
- 1
internal/handler/cloud/commitgeneraltaskhandler.go View File

@@ -11,12 +11,14 @@ import (

func CommitGeneralTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {

var req types.GeneralTaskReq
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}

token := r.Header.Get("Authorization")
req.Token = token
l := cloud.NewCommitGeneralTaskLogic(r.Context(), svcCtx)
err := l.CommitGeneralTask(&req)
result.HttpResult(r, w, nil, err)


+ 1
- 0
internal/logic/cloud/commitgeneraltasklogic.go View File

@@ -144,6 +144,7 @@ func (l *CommitGeneralTaskLogic) CommitGeneralTask(req *types.GeneralTaskReq) er
FunctionName: l.svcCtx.Config.BlockChain.FunctionName,
MemberName: l.svcCtx.Config.BlockChain.MemberName,
Type: l.svcCtx.Config.BlockChain.Type,
Token: req.Token,
Args: []string{strconv.FormatInt(taskModel.Id, 10), string(bytes)},
})
if db.Error != nil {


+ 1
- 0
internal/types/types.go View File

@@ -141,6 +141,7 @@ type Region struct {
}

type GeneralTaskReq struct {
Token string `json:"token"`
Name string `json:"name"`
AdapterIds []string `json:"adapterIds"`
ClusterIds []string `json:"clusterIds"`


+ 1
- 0
pkg/utils/remoteUtil/BlockChain.go View File

@@ -11,6 +11,7 @@ type EvidenceParam struct {
ContractAddress string `json:"contractAddress"`
FunctionName string `json:"functionName"`
Args []string `json:"args"`
Token string `json:"token"`
}

func Evidence(EvidenceParam EvidenceParam) error {


Loading…
Cancel
Save