diff --git a/desc/core/pcm-core.api b/desc/core/pcm-core.api index bf09d145..c704c872 100644 --- a/desc/core/pcm-core.api +++ b/desc/core/pcm-core.api @@ -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 { diff --git a/internal/handler/cloud/commitgeneraltaskhandler.go b/internal/handler/cloud/commitgeneraltaskhandler.go index 952d6ec0..78a056fd 100644 --- a/internal/handler/cloud/commitgeneraltaskhandler.go +++ b/internal/handler/cloud/commitgeneraltaskhandler.go @@ -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) diff --git a/internal/logic/cloud/commitgeneraltasklogic.go b/internal/logic/cloud/commitgeneraltasklogic.go index ae774b8b..7fbaf2ae 100644 --- a/internal/logic/cloud/commitgeneraltasklogic.go +++ b/internal/logic/cloud/commitgeneraltasklogic.go @@ -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 { diff --git a/internal/types/types.go b/internal/types/types.go index 95575427..985b992e 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -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"` diff --git a/pkg/utils/remoteUtil/BlockChain.go b/pkg/utils/remoteUtil/BlockChain.go index cd95eea9..8b5cb3d0 100644 --- a/pkg/utils/remoteUtil/BlockChain.go +++ b/pkg/utils/remoteUtil/BlockChain.go @@ -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 {