创建智算任务增加token

This commit is contained in:
zhangwei 2025-01-02 17:47:36 +08:00
parent 16758c05c0
commit a458c85231
5 changed files with 17 additions and 12 deletions

View File

@ -157,6 +157,7 @@ type (
type ( type (
GeneralTaskReq { GeneralTaskReq {
Token string `json:"token"`
Name string `json:"name"` Name string `json:"name"`
AdapterIds []string `json:"adapterIds"` AdapterIds []string `json:"adapterIds"`
ClusterIds []string `json:"clusterIds"` ClusterIds []string `json:"clusterIds"`
@ -317,8 +318,8 @@ type (
} }
) )
type( type (
asynCommitAiTaskReq{ asynCommitAiTaskReq {
Name string `json:"name,optional"` Name string `json:"name,optional"`
AdapterIds []string `json:"adapterIds,optional"` AdapterIds []string `json:"adapterIds,optional"`
ClusterIds []string `json:"clusterIds,optional"` ClusterIds []string `json:"clusterIds,optional"`
@ -329,15 +330,14 @@ type(
Command string `json:"command,optional"` Command string `json:"command,optional"`
FlavorId string `json:"flavorId,optional"` FlavorId string `json:"flavorId,optional"`
Status string `json:"status,optional"` Status string `json:"status,optional"`
ClusterId int64 `json:"clusterId,optional"` ClusterId int64 `json:"clusterId,optional"`
AdapterId string `json:"adapterId,optional"` AdapterId string `json:"adapterId,optional"`
} }
asynCommitAiTaskResp{ asynCommitAiTaskResp {
Code int32 `json:"code"` Code int32 `json:"code"`
Msg string `json:"msg"` Msg string `json:"msg"`
TaskId int64 `json:"taskId"` TaskId int64 `json:"taskId"`
} }
) )
@ -991,7 +991,7 @@ type adapterInfoNameReqResp {
Code int32 `json:"code,omitempty"` Code int32 `json:"code,omitempty"`
Msg string `json:"msg,omitempty"` Msg string `json:"msg,omitempty"`
ErrorMsg string `json:"errorMsg,omitempty"` ErrorMsg string `json:"errorMsg,omitempty"`
InfoList InfoList `json:"infoList,omitempty"` InfoList InfoList `json:"infoList,omitempty"`
} }
type InfoList { type InfoList {
@ -1279,7 +1279,7 @@ type (
TaskName string `json:"taskName"` TaskName string `json:"taskName"`
Incident string `json:"incident"` Incident string `json:"incident"`
} }
ListNoticeReq{ ListNoticeReq {
} }
ListNoticeResp { ListNoticeResp {

View File

@ -11,12 +11,14 @@ import (
func CommitGeneralTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { func CommitGeneralTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.GeneralTaskReq var req types.GeneralTaskReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err) result.ParamErrorResult(r, w, err)
return return
} }
token := r.Header.Get("Authorization")
req.Token = token
l := cloud.NewCommitGeneralTaskLogic(r.Context(), svcCtx) l := cloud.NewCommitGeneralTaskLogic(r.Context(), svcCtx)
err := l.CommitGeneralTask(&req) err := l.CommitGeneralTask(&req)
result.HttpResult(r, w, nil, err) result.HttpResult(r, w, nil, err)

View File

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

View File

@ -141,6 +141,7 @@ type Region struct {
} }
type GeneralTaskReq struct { type GeneralTaskReq struct {
Token string `json:"token"`
Name string `json:"name"` Name string `json:"name"`
AdapterIds []string `json:"adapterIds"` AdapterIds []string `json:"adapterIds"`
ClusterIds []string `json:"clusterIds"` ClusterIds []string `json:"clusterIds"`

View File

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