| @@ -39,3 +39,10 @@ type AccessLog struct { | |||||
| AccessTime time.Time `gorm:"column:access_time" json:"accessTime"` | AccessTime time.Time `gorm:"column:access_time" json:"accessTime"` | ||||
| AccessType string `gorm:"column:access_type" json:"accessType"` | AccessType string `gorm:"column:access_type" json:"accessType"` | ||||
| } | } | ||||
| type User struct { | |||||
| ID int64 `gorm:"column:id" json:"id"` | |||||
| SsoID string `gorm:"column:sso_id" json:"ssoID"` | |||||
| UserName string `gorm:"column:username" json:"userName"` | |||||
| Created time.Time `gorm:"column:created_at" json:"created"` | |||||
| } | |||||
| @@ -25,7 +25,8 @@ func (c *Client) GetClusterInfo(req GetClusterInfoReq) ([]ClusterDetail, error) | |||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| resp, err := http2.PostJSON(targetUrl, http2.RequestParam{Body: req}) | |||||
| //resp, err := http2.PostJSON(targetUrl, http2.RequestParam{Body: req}) | |||||
| resp, err := http2.PostJSON(targetUrl, http2.RequestParam{}) | |||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| @@ -37,8 +38,17 @@ func (c *Client) GetClusterInfo(req GetClusterInfoReq) ([]ClusterDetail, error) | |||||
| return nil, fmt.Errorf("parsing response: %w", err) | return nil, fmt.Errorf("parsing response: %w", err) | ||||
| } | } | ||||
| // 该接口传入参数后查询效率很低,所以需要在这里特殊处理 | |||||
| if codeResp.Code == ResponseCodeOK { | if codeResp.Code == ResponseCodeOK { | ||||
| return codeResp.Data, nil | |||||
| var results []ClusterDetail | |||||
| for _, cluster := range codeResp.Data { | |||||
| for _, id := range req.IDs { | |||||
| if cluster.ClusterId == id { | |||||
| results = append(results, cluster) | |||||
| } | |||||
| } | |||||
| } | |||||
| return results, nil | |||||
| } | } | ||||
| return nil, codeResp.ToError() | return nil, codeResp.ToError() | ||||
| @@ -37,6 +37,8 @@ type Binding struct { | |||||
| type BindingAccessData struct { | type BindingAccessData struct { | ||||
| ID DataID `gorm:"column:id;primaryKey;autoIncrement" json:"ID"` | ID DataID `gorm:"column:id;primaryKey;autoIncrement" json:"ID"` | ||||
| UserID cdssdk.UserID `gorm:"column:user_id" json:"userID"` | UserID cdssdk.UserID `gorm:"column:user_id" json:"userID"` | ||||
| UserName string `gorm:"column:username" json:"userName"` | |||||
| SSOId string `gorm:"column:sso_id" json:"ssoID"` | |||||
| Name string `gorm:"column:name" json:"Name"` | Name string `gorm:"column:name" json:"Name"` | ||||
| DataType string `gorm:"column:data_type" json:"dataType"` | DataType string `gorm:"column:data_type" json:"dataType"` | ||||
| Content string `gorm:"column:content" json:"Content"` | Content string `gorm:"column:content" json:"Content"` | ||||
| @@ -48,6 +50,8 @@ type BindingAccessData struct { | |||||
| type BindingDetail struct { | type BindingDetail struct { | ||||
| ID DataID `json:"ID"` | ID DataID `json:"ID"` | ||||
| UserID cdssdk.UserID `json:"ownerID"` | UserID cdssdk.UserID `json:"ownerID"` | ||||
| UserName string `json:"userName"` | |||||
| SSOId string `json:"ssoID"` | |||||
| Name string `json:"Name"` | Name string `json:"Name"` | ||||
| Info sch.DataBinding `json:"info"` | Info sch.DataBinding `json:"info"` | ||||
| Packages []Package `json:"packages"` | Packages []Package `json:"packages"` | ||||